Upload an attachment into ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2018 06:03 PM
I am writing an integration and receiving JSON in a scripted REST API.
Part of the inbound JSON has an attachment url, a long string starting with https://.......
When I click the url the file downloads to my local system properly, How do I take that url and add the attachment to the sys_attachment table in ServiceNow.
I will know the SN table and sys_id, the JSON also has the content type, I am not sure how to get the attachment into ServiceNow.
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2018 06:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2018 06:54 AM
Thats what I thought, but I keep getting a bad content type.
But when I take the file url and place it in a browser the file downloads properly.
{
"error": {
"message": "Invalid file type: application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"detail": null
},
"status": "failure"
}
These are the parameters for the url that is passed to me in the JSON
?X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=ASIAU2ZWJDBAA6YVVMK3%2F20181013%2Fus-east-1%2Fs3%2Faws4_request
&X-Amz-Date=20181013T134429Z
&X-Amz-Expires=86400
&X-Amz-Security-Token=FQoGZXIvYXdzEPH%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDN60ChXrDXPpTsn0HCK3A5WxDBWg9%2BI2IMBsNQN0ljNftDoWnLn6%2Fnax29LOJ7%2BF8woB8BBoEOXkMabdKFXJTvPuE8S797FcyYZVFJBTZ%2FhzM4Z0%2Bkypuew8gEPUW47Y7UBkRvHZkNa92iSJ7Gi8GFkhSEjOs%2Fk10zmAZmk8odd1nlDMx23KIJl25wSa8mwqItX1llheD7j7J%2FX1h99r9X7GGdK6gVHnprXPLtqZ%2Fk%2Fgk6WNg5BEMRs2L6NrLx6t%2FxoiWSv6AjqJxM5ULNT76bVJ7yIZCdEQg3HFI9bZg15dhJiYuDq9qHh7Ght71lN%2F8ST9KAwcOXyX1ZvK%2BUW6ym8vwEXl%2B1SZF0hgaXRS4rQUAv7cpZSKx8T4Q9UnGE7l1ZiV8D6A29r0hjFjsBA6lKncITtyF7Rv34J0BfmsvUq4yVT603dHfTtz4MhXyMq4iPMmsqQnTi%2FrRt2Z2ZHB%2BXn9JPJo45C7ayRAlYByyTjsprKXxwYNmU0pnw%2F6%2FNkisz3ykQFjcPLLD%2BaCmDZaXK12%2Bh7P1IxjXySmhD%2BVWfUq36zothg9hTpL2PVgixrSBlC5zI%2Fdav%2BpK3JFPHrNVyIgcKueT%2BQoz8yG3gU%3D
&X-Amz-Signature=479bd05b1b2f18ea0fc7baef425f0676f3f6d5587dd68892728c7583dadc6c8f
&X-Amz-SignedHeaders=Host
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2018 08:12 AM
I added a Request Body paramater of Location (the value is the full https URL). When I did that I received a 200 status and a file was attached to the incident record. However, the file is corrupt. It is a docx file and I am using a content-type of application/vnd.openxmlformats-officedocument.wordprocessingml.document.
Any ideas??