Send a CSV export to a third party file path using REST API

ajay konduru
Tera Contributor

I have a requirement wherein i need to extract csv of location and send it to a third party endpoint available through REST message POST request upload.

I suggested Export Sets but they require only though REST message. Could you please help me.

I have created a script include which parses location table data to csv but on the uploading part im not sure how to do.

5 REPLIES 5

Appli
Mega Sage
Mega Sage

Hi Ajay

Please look to docs page - it shows how to build REST message that downloads the attachment into a request body before sending it out to the remote endpoint.

Hope it helps.

Hope it helps

Ankur Bawiskar
Tera Patron
Tera Patron

@ajay konduru 

You can generated CSV file and store in on that table record and then get the CSV file content and push it over to their endpoint.

For checking on how to upload you need to check with their team on how they are expecting the data of csv i.e. they require base64Encoced data of file or plain text in some json key

Regards
Ankur

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

Hi Ankur,

Thanks for your inputs.

Since the file is an extract on table , not sure if it is good placing the extract on any single record on the table.

Is there any alternative where can i place and send the file though POST method.

Thank You!

@ajay konduru 

Since csv file is plain text you can get the table record data and form string and send it over.

no need to store it on some record

Please check the sample json request format which is shared by 3rd party client

Regards
Ankur

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