- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2017 07:05 AM
Hi
I am in middle of posting an attachment( lets says an image of jpeg format) with Rest Attachment API. I am confused about the raw data to be used in the request,
I have been trying it with Rest API Explorer and unable to find what is supposed to be added in raw data.
I don't want to upload a file directly through Binary data option as I am getting the data in base64 format from a 3rd party.
PS: I also don't want to use ECC-queue function to add an attachment.
Any light on it is highly appreciated.
Thanks
Gaurav
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2017 02:42 AM
Hi Andrew
I got it working as I was calling the table API and not attachment API here.
Took reference from the below link.
https://community.servicenow.com/thread/266337#1153136
Thanks for your time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2017 07:11 AM
Hello gauravbajaj2007
In the Request Body section, define the body content of the request. This section appears for methods that insert or update data, such as PUT. The Request Formatthat you select in the Request Headers section determines the format you must use in the request body, such as JSON or XML.
You can build the request body by selecting fields, by manually writing the request body, or by uploading a binary file.
Use the Builder tab to build the request body using instance fields. Click Add a field, then select a field and specify a value. Available fields depend on the table you are adding data to.
Use the Raw tab to manually enter a request body.
Use the Binary tab to upload a binary file. This tab appears only for APIs that support binary file data, such as the Attachment API.
Reference:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2017 07:21 AM
Thanks for your reply Dravvy, but i have already gone through these solution and my concern is to add raw data for an image which can be base64 encoded.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2017 07:25 AM
Maybe the post in this article can help you:
How to fetch encoded attachment for an incident via REST API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2017 07:13 AM
Hi Gaurav,
There are a couple of examples on the docs site on how to post a binary file to the Attachment API:
Attachment API - POST /now/attachment/file
These cover curl and python examples.
What technology is your source system based on?
Andy