How to get URL of all attachments from change request record through REST API

JC S_
Mega Guru

We are developing a custom application. On this application, it will display details of change request.

We plan to get them via the TABLE Api using GET method. Now we also need to show the links for the attachments on that change request record. We need help on doing this part via REST APIs.

3 REPLIES 3

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,


I am confused. Sorry for that!!!!

 

Where you have to show this Links? On the change form or anywhere else.

 

Can you explain business case on this.

 

Thanks,

Ashutosh

I updated the question and details to be more clear.

We need to show the links of the attachments on our custom application - this custom application summarizes all the different approvals from our different systems (ServiceNow is just one of them) as such we need this from ServiceNow.

I hope this is more clear.

JC S_
Mega Guru

We were able to figure this out:

Using the Attachment API of ServiceNow issue the below command:

GET https://instance.service-now.com/api/now/attachment?sysparm_query=table_name%3Dsourcetablehere%5E table_sys_id%3Dsysidhere

 

So to get all attachments from a change request record:

GET https://instance.service-now.com/api/now/attachment?sysparm_query=table_name%3Dchange_request%5E table_sys_id%3Dxxxxxxxxxxxxxxxxxxxxxx