24-01-20 02:39 PM
Hi All,
im trying to upload attachment to the ServiceNOW record.
I was able to use cURL for downloading (GET) the attachemnts based on the File Meta-data i can get from HTTP GET request. So based on Attachemnt Sys ID.
I wanted to use again cURL for POST an attacment back to the SNOW, but i have troubles to make it work
For downloding i have this:
"curl "&[URL]&"/api/now/v1/attachment/"&[ServiceNow Attachment Sys ID]&"/file --request GET --header ""Accept:*/*"" --user "&[Username]&":"&[Password]&" -o """&[Destination File FullPath]&""""
For Upload i tried this in dozens of variations based on the google results..
"curl "&[URL]&"/api/now/v1/attachment/file?table_name="&[ServiceNow Table name]&"&table_sys_id="&[ServiceNow Ticket Sys ID]&"&file_name="&[FileName]&" --request POST --header ""Accept:application/json"" --user "&[Username]&":"&[Password]&" --header ""Content-Type:application/pdf"" --data-binary """&[Source File FullPath]&""""
but it returns
{"error":{"message":"Method not Supported","detail":"GET method not supported for API"},"status":"failure"}'table_sys_id' is not recognized as an internal or external command,
operable program or batch file.
'file_name' is not recognized as an internal or external command,
operable program or batch file.
With this solution:
curl https://instance.service-now.com/api/now/v1/attachment/file --request POST --header "Accept:application/json" --user XXX:XXX --header "Content-Type:multipart/form-data" -F 'table_name=ABC_case' -F 'table_sys_id=8928dfbd1b164c903ca37669cd4bcb95' -F 'uploadFile=@C:/Temp/test.pdf'
i get: (26) couldn't open file "C:/Temp/test.pdf'"
Any help how to solve it or different ideas how to do it?
Im no programme. Have only some basic VB.NET skills. Noob in using Webservices 🙂
24-03-20 07:01 AM
27-03-20 11:43 AM
Hi Ishan,
unfortunatelly i did not manage it, still i have it on my list, but currently busy with other stuff 😞
27-03-20 11:56 AM
27-03-20 02:01 PM