attachment API

Shabbir1
Tera Contributor

Hi 

 

We have created attachment API for incident by using rest API explorer it is attaching the document from my local storage to incident but the content in document is missing can anyone suggest how to achieve this how to attach all type of documents to the incident without missing the content in the document sharing screen shots for reference

Shabbir1_0-1701142291262.png

API :  

https://dev187065.service-now.com/api/now/attachment/file?table_name=incident&table_sys_id=ba1814384...

 

JSON BODY 

 

{

"contentType": "(*/*)"

}

4 REPLIES 4

Maik Skoddow
Tera Patron
Tera Patron

Hi @Shabbir1 

 

in your screenshot it is not visible what the body is. You have to select "Binary" and then pick a file. Did you do this?

 

MaikSkoddow_0-1701146366598.png

Maik

 

Hi maik

Thank you  for your reply yes I have selected the option binary and chosen the file it is working but how can I check this with postman & what will be the JSON body ? and how it will pickup the document from my local storage .I tried with the API and JSON which I have mentioned above from postman it is adding the document but the content in the document is missing 

Hi  @Shabbir1 

 

you are mixing apples with oranges. JSON is a text-based format for structured data used to exchange data between systems. A binary file is something completely different. But there is a way to transform binary data to text data for including it in a JSON-based body. But this depends on the requirements which are given by the recipient API.

And regarding postman: Why don't you search in the internet. A simple Google search would provide for example the following documentation: https://www.postman.com/postman/workspace/postman-answers/documentation/13455110-00378d5c-5b08-4813-...

 

Maik

And re

Roshan Tiwari
Tera Guru

Remove bracket and then try:

 

Content-Type:*/*