Send attachment data to external system using Rest API in JSON format.

Bandaru Sree Le
Kilo Contributor

Hi Team,

I need to send attachment data to external system in JSON format. How can I do it?

Should I also encode data to base64 in this case?

Please help me!

 

Thank You

11 REPLIES 11

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

yes in most integrations the file attachment content is passed as base64Encoded data so that 3rd party can decode it at their side.

check these links for example

Business rule to send attachment to 3rd Party Tool via REST

Unable to send attachment via REST

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thanks for your reply @Ankur Bawiskar.

So, can't we send data in JSON format?

yes inside the JSON request only you have to include the base64Encoded data

Example:

{

"file_name":"Resume.docx",

"content-type":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",

"base64Data":"base64EncodedData"

}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

As per the new requirement, I want to send excel data in JSON format without encoding.

Thank You