Need Help with Attachments in integration

Swetha Guligari
Tera Contributor
Hi Team, I am working on Integration between servicenow and third party. Currently working on attachment part. I using scripted Rest API to create incident in servicenow. Third party is sending the JSON payload based on that incident is getting created. Now third party will be including attachment data in the same JSON payload. Based on that i would need to include attachment to the incident created. 1) can someone share the sample payload how third party need to send the file(s)(Attachment data in JSON format) info to service now API. 2)Can i use the same above scripted rest API for the attachment as well? Please help me with the input. Thanks, Swetha
7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@Swetha Guligari 

check this link on how to use Scripted REST API where I shared solution, please enhance to accept other incident fields and create. this example talks about adding file to INC, but you can create and then attach

Sending attachments using custom scripted web service 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur, 

Thanks for your response. I followed your post and it was really helpful. Client has specified that they would be sending the attachment file data in multipart format. How can i convert multipart format into an attachment in scripted rest API. Please suggest me.

@Swetha Guligari 

I believe I answered your original question.

The subsequent question can still be discussed on answered thread.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Swetha Guligari 

for receiving multi-part it's somewhat complex

check these links

Inbound Multipart/form-data via the Scripted REST API (in a scoped application) 

Handling 'text/plain' and Other Unsupported Content Types in ServiceNow Scripted REST APIs 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader