CURL --output command in Servicenow

ark6
Mega Guru

Hi,

I am using below CURL command to download a file from third-party which is working fine using CURL.

curl -X GET --user "apikey:{api-key}" \--output "test.docx" \

"https://api.us-south.language-translator.watson.cloud.ibm.com/instances/{instance-name}/v3/documents/{document_id}/translated_document?version=2018-05-01"

However, I am not finding an option of how to write the --output command in ServiceNow to download the file or at-least convert it to B64 & save as attachment.

Please help.

@Chuck Tomasi @Göran Lundqvist Please let me know if you have some idea

5 REPLIES 5

Hitoshi Ozawa
Giga Sage
Giga Sage

A script with a curl command may be saved on a mid server and executed using ecc queue.

Following page contains info on executing script using ecc queue.

https://docs.servicenow.com/bundle/madrid-servicenow-platform/page/product/mid-server/task/manage-ec...

Hitoshi Ozawa
Giga Sage
Giga Sage

If it's required to save the file as an attachment, curl command can not be used.

Instead, create a server-side script to call a REST API with a get to fetch the content.

Hi Ozawa, Thanks for your response. However, i am not sure if the attachment api would work as attachment api is internal to servicenow. I need a server script to possibly download the file from 3rd party IBM api

Attachment API can be used to POST to ServiceNow to attach a file. Would require a MID server. If the 3rd party IBM api is not connected via company vpn but is an external Internet URI, would require to use REST Message to GET the file.

https://developer.servicenow.com/dev.do#!/reference/api/paris/rest/c_AttachmentAPI#attachment-POST-f...