- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2016 12:55 AM
Hello,
I am trying to build an application that collect a report from another application,create an incident and attach to it. I wrote this application in Python. When ever i tried to to attach a file using ecc_queue i am getting an error as below.
Response Status Code: 200
Response JSON Content: {u'reason': None, u'error': u'Insufficient rights to insert records from the table: ecc_queue'}
when i contacted the servicenow administrator he said that ecc_queue is not secure plus he wants me to provide the exact acl in the ecc_queue,we are using geneva implementation. Later he told me to try Attachment API - POST /now/attachment/file.
I have tried this as per the documentation and i get below error.
Response Status Code: 400
Response JSON Content: {u'status': u'failure', u'error': {u'message': u'Attachment is empty', u'detail': None}}
I also tried Attachment API - GET /now/attachment/{sys_id}/file to check if i can retrive an exsisting attachment ,but i dint work as well. i get below error message.
Response Status Code: 404
Response JSON Content: {u'status': u'failure', u'error': {u'message': u'No Record found', u'detail': u"Record doesn't exist or ACL restricts the record retrieval"}}
Please help me.
Thanks
Sree
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2016 05:13 AM
Hi Sreejith,
Below code works perfectly fine in Fuji and Geneva, but there is a whole new Attachment API in Geneva as you mentioned,
POST Body
{
"agent":"AttachmentCreator",
"topic":"AttachmentCreator",
"name": "Issue_screenshot.jpg:application/jpg",
"source":"incident:Sys_ID",
"payload":"Base64_string_of_the_attachment"
}
I am currently exploring the Geneva API's
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2016 05:13 AM
Hi Sreejith,
Below code works perfectly fine in Fuji and Geneva, but there is a whole new Attachment API in Geneva as you mentioned,
POST Body
{
"agent":"AttachmentCreator",
"topic":"AttachmentCreator",
"name": "Issue_screenshot.jpg:application/jpg",
"source":"incident:Sys_ID",
"payload":"Base64_string_of_the_attachment"
}
I am currently exploring the Geneva API's
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2016 05:28 AM
Hello Santosh Gatlewar ,
As i said i could do attach the file in incident using ecc_queue by encoding the file using a base64 encoder but on the development environnement, in development environment i have the full permission as i am part of "dicovery_admin" mode, but in production we cant use that as it will give me entire access, thats why i tried the api attachment in geneva but unfortunately it did not work .
Could you please tell what permison have you provide to the particular user in order to attach the file using ecc_queue as mentioned above?
Thanks
Sree
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2016 05:35 AM
Please find my debug result ( i have replaced some confidential info with some junk value)
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): dev-servicedesk.test.net
send: 'POST /api/now/attachment/file?table_name=incident&table_sys_id=f877829b63f35240f0917d7ad6ba9472&file_name=Issue_screenshot HTTP/1.1\r\nHost: dev-servicedesk.test.net\r\nConnection: keep-alive\r\nAccept-Encoding: gzip, deflate\r\nAccept: application/json;charset=utf-8\r\nUser-Agent: python-requests/2.10.0\r\nContent-Type: image/jpeg\r\nContent-Length: 0\r\nAuthorization: Basic c2Nxuoahphiehihiehaiahqqhd0=\r\n\r\n'
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: Set-Cookie: JSESSIONID=aahhehehiihiaehaihaeiaehiahaaiaeia; Path=/; HttpOnly
header: Set-Cookie: glide_user=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
header: Set-Cookie: glide_user_session=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
header: Set-Cookie: glide_user_route=glide.hahahehheieaiehihaeihaeaeihaeih; Expires=Wed, 28-Jun-2084 12:56:40 GMT; Path=/; HttpOnly
header: Set-Cookie: glide_session_store=aiahhhihheihaihiahihiehaiaehehaiehieh; Expires=Fri, 10-Jun-2016 12:42:33 GMT; Path=/; HttpOnly
header: Pragma: no-store,no-cache
header: Cache-control: no-cache,no-store,must-revalidate,max-age=-1
header: Expires: 0
header: Content-Type: application/json;charset=UTF-8
header: Date: Fri, 10 Jun 2016 09:42:33 GMT
header: X-Cnection: close
header: Server: ServiceNow
header: Set-Cookie: tthakkadhahakhakhakkhe-DEV=3439576074.32830.0000; path=/
header: Transfer-Encoding: chunked
DEBUG:requests.packages.urllib3.connectionpool:"POST /api/now/attachment/file?table_name=incident&table_sys_id=f877829b63f35240f0917d7ad6ba9472&file_name=Issue_screenshot HTTP/1.1" 400 None
Response Status Code: 400
Response JSON Content: {u'status': u'failure', u'error': {u'message': u'Attachment is empty', u'detail': None}}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2016 06:11 AM
Hi Sree,
Try giving the file name with extension,
for example,
/api/now/attachment/file?table_name=incident&table_sys_id=f877829b63f35240f0917d7ad6ba9472&file_name=Issue_screenshot.jpeg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2016 06:14 AM
I tried, but no luck
did that work for you?