Attach a file using rest api

sanjeev22
Kilo Explorer

Hi

I am trying to attach a file to service now request.

I followed below method to attach the file

Method   : https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/integrate/inbound_rest/reference/...

URL :  

https://dev24647.service-now.com/api/now/attachment/file?table_name=incident&table_sys_id=e837e7b24f...

but getting below error , there must be something wrong how I specify the file name to attach Has any one encountered similar error or attached a file successfully.

i am getting below error

Curl output

===========

{"error":{"message":"Requested URI does not represent any resource","detail":"Requested URI does not represent any resou

rce Check logs for error trace or enable glide.rest.debug property to verify REST request processing"},"status":"failure

"}

Python script output

=================

('Status:', 400, 'Headers:', {'X-Cnection': 'close', 'Content-Encoding': 'gzip', 'Transfer-Encoding': 'chunked', 'Set-Cookie': 'JSESSIONID=B9AB8B6B0745ECDE3F736FB47CBAFCE5;Secure; Path=/; HttpOnly, BIGipServerpool_dev24647=3816850442.32576.0000; path=/', 'Strict-Transport-Security': 'max-age=15768000; includeSubDomains;', 'Server': 'ServiceNow', 'Date': 'Mon, 20 Jun 2016 18:26:24 GMT', 'Content-Type': 'application/json'}, 'Error Response:', {u'status': u'failure', u'error': {u'message': u'Requested URI does not represent any resource', u'detail': u'Requested URI does not represent any resource Check logs for error trace or enable glide.rest.debug property to verify REST request processing'}})

5 REPLIES 5

Hi Dharshini,



I am using the function setRequestBodyFromAttachment('sys_attchment record sys_id') but it is notworking.


I am getting error in ECC Queue that attachment does not exists.


Please help to fix the issue.