XMLMC API File Upload Sample

From Hornbill
Revision as of 11:11, 14 October 2021 by Samuels (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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
Authorization: ESP-APIKEY ...

test text

After you receive the 200 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.