How to attach file in incident via API

Rani11
Tera Expert

Hi All,

I have come up with query like. Thirty party is trying to use servicenow table API to query the records . And they are doing some delete action. When they tries to delete a record somehow its not deleted. They are getting error. So in such cases they wanted to create incident and attach those records in xls sheet and attach it in the respective incident via API.Is it possible to attach a "attachment file" via api to servicenow form third party? Can anyone come across such scenario? 

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@Rani

you can use OOB Attachment API

But remember 3rd party will have to know the incident record sys_id so they will have to consume API 2 times

1) get the incident sys_id using Incident Table API

2) then use the Attachment API

Attachment API

ServiceNow REST Attachment API Example Python Example

Another alternative is to create Scripted REST API and they can send the details

Refer below link where I have shared the solution

Scripted Rest API to update incident with attachment

Regards
Ankur

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