Difference between revisions of "XMLMC API File Upload Sample"
(Created page with "Uploading files is also possible. There is a WebDAV endpoint which is the same instance URL as you would use for the XMLMC, but with '''dav''' replacing the '''xmlmc''' part o...") |
|||
Line 7: | Line 7: | ||
PUT /INSTANCE/dav/session/thisisatest.txt HTTP/1.1 | PUT /INSTANCE/dav/session/thisisatest.txt HTTP/1.1 | ||
Host: ....hornbill.com | Host: ....hornbill.com | ||
+ | Content-Length: 9 | ||
Authorization: ESP-APIKEY ... | Authorization: ESP-APIKEY ... | ||
Line 12: | Line 13: | ||
</pre> | </pre> | ||
− | After you receive the | + | |
+ | After you receive the 201 (Created) result, you can use the API to attach the file from session to the request (IN00000083 in the example below). | ||
<pre> | <pre> | ||
Line 29: | Line 31: | ||
This particular API renames the file in question, should a file with the same name already exist against the call AND this API also handles the WebDAV '''DELETE'''. | This particular API renames the file in question, should a file with the same name already exist against the call AND this API also handles the WebDAV '''DELETE'''. | ||
+ | |||
+ | Uploading binary files would require headers of '''Content-Type: application/binary''', before passing on the payload in the body. |
Latest revision as of 11:46, 14 October 2021
Uploading files is also possible. There is a WebDAV endpoint which is the same instance URL as you would use for the XMLMC, but with dav replacing the xmlmc part of the URL i.e. https://api.hornbill.com/INSTANCE/dav/ Within the DAV area, we request that you use the "session" folder to place/PUT files.
For instance, to attach a file to a request, first place the file to your session folder using PUT to the DAV endpoint:
PUT /INSTANCE/dav/session/thisisatest.txt HTTP/1.1 Host: ....hornbill.com Content-Length: 9 Authorization: ESP-APIKEY ... test text
After you receive the 201 (Created) result, you can use the API to attach the file from session to the request (IN00000083 in the example below).
POST /INSTANCE/xmlmc/apps/com.hornbill.servicemanager/Requests?op=attachFileFromSession HTTP/1.1 Content-Type: text/xmlmc; charset=utf-8 Authorization: ESP-APIKEY ... <methodCall service="apps/com.hornbill.servicemanager/Requests" method="attachFileFromSession"> <params> <requestId>IN00000083</requestId> <fileName>/session/thisisatest.txt</fileName> <description>a description must be given</description> </params> </methodCall>
This particular API renames the file in question, should a file with the same name already exist against the call AND this API also handles the WebDAV DELETE.
Uploading binary files would require headers of Content-Type: application/binary, before passing on the payload in the body.