ServiceDesk Plus On Demand API V3 - Error with adding attachment to Request

ServiceDesk Plus On Demand API V3 - Error with adding attachment to Request

Hi,

I have a problem with adding attachments to requests using the API V3. The attachment seems to be uploaded (status code 200), but it does not appear on the Request screen.

It is important that:
  1. This is with ME SDP On Demand.
  2. When ME SDP On Demand used the earlier API, I could successfully attach files to a Request.
  3. Authentication is fine, I can create a request using the API.
I suspect that the problem is that (according to the documentation https://www.manageengine.com/products/service-desk/sdpod-v3-api/SDPOD-V3-API.html#add-attachment-to-a-request), "addtoattachment" should be set to "true", but I don't know how to set it in the HTTP request.

Details:

I make the HTTP Post to this URL:


HTTP headers:

 

content-type: multipart/form-data; boundary=BA96A98380C2E39E048F2F9E4DF9DE1B0

content-length: 9155

charset: UTF-8

accept: application/vnd.manageengine.sdp.v3+json

authorization: xxxxxxxxxxxxx

user-agent: SAP NetWeaver Application Server (1.0;740)

host: sdpondemand.manageengine.com

accept-encoding: gzip

sap-trace: 2

 

 

Request body:

 

--BA96A98380C2E39E048F2F9E4DF9DE1B0

Content-Type: text/html

Content-Length: 8925

content-disposition: form-data; name="filename"; filename="SU53_output_passed_157_S72_20180816.html";

 

....file content....


--BA96A98380C2E39E048F2F9E4DF9DE1B0—


This is the response I get:

{"response_status":[{"status_code":2000,"status":"success"}],"files":[{"content_type":"text/html","size":"8925","file_id":"77006","name":"SU53_output_passed_157_S72_20180816.html","content_url":"/requests/uploads/77006"}]}

Notice that the content_url is different from the one in the documentation: 

$ curl api/v3/requests/{request_id}/uploads \
      -H "Accept: application/vnd.manageengine.sdp.v3+json" \
      -H "Authorization: ad88xyszde6c84565aae47dweraf8cc05b" \
      -F "filename=@local_file_path" -F "addtoattachment=true"
Response Example

{
  "response_status": [
    {
      "status_code": 2000,
      "status": "success"
    }
  ],
  "files": [
    {
      "content_type": "application/zip",
      "size": "36171",
      "file_id": "4001",
      "name": "test_file.txt",
      "content_url": "/requests/1234233323423432/uploads/4001"
    }
  ]
}

Here it looks like the attachment is linked to the request, but not in the request I get.

Can you please help me on how to add the attachment to the request?

Thanks and best regards,
Tamás

                New to ADSelfService Plus?