ServiceNow Attachment API

Zion Deluyas
Kilo Contributor

Hi, I'm trying out the attachment API in Rest API Explorer. Particularly I'm trying out 

GET https://dev101268.service-now.com/api/now/attachment/{sys_id}/file

My goal is to get the content of the csv file of an incident ticket. But when I'm trying out the
Attachment Api above, I always get this error message:
{"error":{"detail":"Record doesn't exist or ACL restricts the record retrieval","message":"No Record found"},"status":"failure"}

If my understanding is correct the sys_id is the sys_id of the record. And I know how to get the sys_id of the incident
by right clicking the record and then copy the sys_id so I'm sure that the id is correct and I'm also sure there is an attachment in the record.
What I'm not sure about is if this concers the ACL restriction. Anyone can help? Thanks in advance!
1 ACCEPTED SOLUTION

Syvo
Mega Guru

Hi,

Actually the expected sys_id is the one of the file itself (see sys_attachment records).

You can pass a query to the /now/attachment API though: sysparm_query=table_sys_id={your_record_sys_id}

 

View solution in original post

3 REPLIES 3

harishdasari
Tera Guru

Hi,

Copy the correct attachment sys_id and give it in the path parameters.

The it will return the Attachment content

find_real_file.png

Syvo
Mega Guru

Hi,

Actually the expected sys_id is the one of the file itself (see sys_attachment records).

You can pass a query to the /now/attachment API though: sysparm_query=table_sys_id={your_record_sys_id}

 

Oh ok. It's clearer now to me. I'm able to query the attachment that I've made. Thanks!