cancel
Showing results for 
Search instead for 
Did you mean: 

Reading attachment from service now

Harsha3
New Contributor III

Hello,

I am trying to access the attachment and the data present in the attachment file (.csv). I used the rest snap to access the service now API endpoint. I was able to navigate to all the fields except the attachment.

Thanks,
Harshavardhana

5 REPLIES 5

Aleksandar_A
Contributor III

Hi @Harsha3,

If you want to access the binary file, there is a specific endpoint to do that:

https://instance.servicenow.com/api/now/attachment/{sys_id}/file

For more informations and guidelines head over to:
Attachment API | ServiceNow

Once you got the response you need to map it and change the output view on the Mapper Snap to binary, the mapping is shown below:
mapper
And then you can use the CSV Parser Snap to parse the content.

Let me know if this helps you,

BR Aleksandar.

Harsha3
New Contributor III

@AleksandarAngelevski

Thanks for the reply, however, there is a 502 error when I am trying to invoke a REST API call. I got the sysid of the task but unfortunately, I could not proceed further.

Thanks,
Harshavardhana

Hello Harsha,

In the Rest Get Snap use the Response Entity Type as Binary and that should let you download the file.

Thanks

Harsha3
New Contributor III

Thanks @Karuna_M I was able to get the attachment response, can you please guide me on how to get the actual contents in the file.?This is the mapper response that I obtained after the REST GET response when invoking the attachment API of the service NOW.

image

Thanks,
Harshavardhana