Service Manager / Service Center Practitioners Forum

RESTful API - Attachments for Incident

Honored Contributor.

RESTful API - Attachments for Incident

Hello Experts


I am quite new to RESTful. We have configured REStful for incidents, service requests and problem. I would like to know how I can add attachments for the same.


The current setup is 


1. There is an User portal from there incidents or service requests are created.

2. Users may want to attach these tickets which will be pushed to SM

3. The attachments should be available in Service Manager side as well.


Any help would be much appreciated.




Kindly assign kudos if the post is helpful!
Micro Focus Expert

Re: RESTful API - Attachments for Incident


Not sure if this will help or not but there is a discussion

"HP Support
If you find that this post or any post resolves your issue, please make sure to mark it as an accepted solution."
Valued Contributor.

Re: RESTful API - Attachments for Incident



yeah it's a good question - i spent some hours and found a solution.


I have tested with HPSM 9.33.0035 (WIN).

To simulate your external user portal, i have used soapUI in version 5.0.0.


My latest configuration is the following:


Method: POST


Resource: /SM/9/rest/interactions/<your-interaction-id>/attachments


As Post Body, i have the following JSON Code (but i think, the post body is not required)


   "attachments" : [
      "attachment" : {
         "name" : "soapui.log"



I have attached an attachment in soapUI, named "soapui.log".

The Attachment is cached in my example.

The Content-Type of the attachment is "application/octet-stream".


Now the important part :)


You have to set a Header key named "Content-Dispostion".

The Value of this header is "attachment; filename=soapui.log"


The second Header key is "Content-Type".

The value of this header is "application/octet-stream" (without this, your attachment gets "application/json" as content-type.


Now, if you send your request to the HPSM, you should get the following response:


"Messages": [],
"ReturnCode": 0,
"attachment": {
"href": "cid:53467b610011401020594248",
"len": 85,
"name": "soapui.log",
"type": "application/octet-stream",
"xmime:contentType": "application/octet-stream"



Without the header (Content-Disposition) you will get something like this


"Messages": ["Attachment name is required."],
"ReturnCode": 71



I have attached some screenshots, which explains it in pictures ;)



Hope this helps.