How to upload a file as an attachment using REST API

ddd5
Kilo Explorer

Found the following example on how to send a request to upload a file, however when I try to send the same request (with appropriate auth credentials and file) I get the following error:

{"error":{"message":"Requested URI does not represent any resource","detail":"Requested URI does not represent any resource Check logs for error trace or enable glide.rest.debug property to verify REST request processing"},"status":"failure"}

with no further info.

Does anyone managed to upload a file with the above requests?

2 REPLIES 2

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Rony,



What method are you using to upload the file. The following is a pretty good method to do that pre-Geneva.



Generate Attachments in ServiceNow via REST-John Andersen


Thx!



Worked when I used /ecc_queue.do?JSONv2&sysparm_action=insert.


However, the sys_id I get is different from the one that exists in 'sys_attachment' table - any idea on how to get the sys_id in 'sys_attachment' (so I'll be able to edit/delete the record when needed)?