How to get the attachment files from REST API

Santosh Kumar2
Mega Contributor

I have set up the REST message for testing purpose between ServiceNow and SharePoint connected successfully. I am getting records from SharePoint, using REST API Get Method and receiving response in json format. In receiving records, there is a image file in every record, I am receiving image URL in every record but I require image file in json format instead of Image URL. How to get records along with image file as in json format.

Please note: If I open record in SharePoint I'm able to see Image file in each record.

Thank you.

Regards,

Santosh

4 REPLIES 4

sachin_namjoshi
Kilo Patron
Kilo Patron

This depends on on sharepoint REST API.

Sharepoint REST API should provide attachment as base64 in the response.

 

Regards,

Sachin

Hi @sachin.namjoshi 

 

If we get image file as base64 response from SharePoint, in Servicenow how we revert back as image. Please let me know.

 

Thank You.

 

Regards,

Santosh

You can useGlideSysAttachment.write API method to decode base64 into image attachment record.

Check below for complete solution

 

https://community.servicenow.com/community?id=community_question&sys_id=cd48f944dbd327801089e15b8a9619d8

 

Regards,

Sachin

Hi @sachin.namjoshi 

 

Can you please provide base64 end point for reference purpose, we can replace with our example.

 

Regards,

Santosh