Looking for Attachment API and sample payload details for 3rd party tool to send attachments to SN

Suggy
Giga Sage

There is an external 3rd party tool which creates incidents in ServiceNow. We have shared the scripted end point.

 

But now need to share the API details for Attachment, along with sample payload.

 

I shared below, 

https://xxxxx.service-now.com/api/now/attachment/file

 
but they are asking what is file above? how do they send the file? They need sample payload.
 
Please help!
9 REPLIES 9

Maik Skoddow
Tera Patron
Tera Patron

Hi @Suggy 

 

as you can see on https://www.servicenow.com/docs/bundle/yokohama-api-reference/page/integrate/inbound-rest/concept/c_... 

a typical CURL command for the upload could look like this:

curl "https://instance.servicenow.com/api/now/attachment/file?table_name=incident&table_sys_id=d71f7935c0a8016700802b64c67c11c6&file_name=Issue_screenshot" \
--request POST \
--header "Accept:application/json" \
--header "Content-Type: image/jpeg" \
--user "username":"password" \
--data-binary "@ location of the file on file system"

So the content of the request body must contain the binary data of the file to be sent.

Maik

SN_Learn
Kilo Patron
Kilo Patron

@Suggy ,

 

Check the below: 

How to Make REST Attachment API Requests 

send the attachment from postman tool to servicenow 

 

 

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

Suggy
Giga Sage

@Maik Skoddow @SN_Learn  Thanks for replying. Can you share the sample java script payload containing the attachment file details in the payload.

Hi @Suggy 

I already explained that the payload is nothing else than the binary content of the file. And this cannot be given as an example because binary data cannot be printed in a plain text field.

Maik