Attachment API

Shabbir1
Tera Contributor

Hi

 

can anyone suggest how to create incident attachment  POST API along with the fields short description and description by using REST API explorer

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@Shabbir1 

incident attachment post API?

Are you saying while creating incident itself you want to send attachment data?

That's not possible using either Table API or Attachment API

1st you need to use Table API to create incident and then use Attachment API to post a file to that newly created incident

OR
You can use scripted rest api and create incident and at same time add file to it

check this link and enhance your logic to create incident and tag the file with it

https://community.servicenow.com/community?id=community_question&sys_id=8e4fcc7b1bad6c1038739979b04b... 

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 thank you for your response

 

In REST API explorer there are three mandatory fields while creating attachment POST API for incident can you please give me one example what values I need to place in those three fields 1 table name (we can give incident table name) 2 table_sys_id( is this individual incident sys id??) 3  File _name(??)  sharing screen shot for reference kindly help me in this

 

Shabbir1_0-1697687049191.png

 

@Shabbir1 

you need to give the name of table -> incident

then the record sysId to which the file should be attached and the file name

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

Hi Ankur

following above steps 1.table name (incident) 2.tabale_sys_id(incident sys id -82247108db4588500bc0ef3c0b96198b ) 3.filename (image002) but I am getting the error code BAD request sharing screen shot for reference

 

Shabbir1_1-1697694831332.pngShabbir1_2-1697694852082.png