bulk upload of attachments using powershell REST API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2018 08:51 PM
Hi All,
I am using a power shell script for bulk uploading attachments from below community thread.
https://community.servicenow.com/community?id=community_article&sys_id=df3caa61dbd0dbc01dcaf3231f9619aa
However, I see that the Power Shell is using a SOAP based call and therefore, we are not able to upload attachments more than 4 MB. This is the SOAP limitation.
I would like to convert the SOAP based call to REST based call. Can someone share the code for the REST API call please?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2018 05:02 AM
Hi manukundur,
THe platform can help you create part of the Powershell script, as follows:
On your instance navigate to "REST API Explorer" on the left hand side.
The explorer will open and you can select the following:
Namespace: now
API Name: Attachment API
API Version: latest
Then select from the list: "Upload an attachment from a binary request (POST)"
This will load the API for uploading attachments into the window.
You can then configure the following query parameters:
table_name: incident
table_sys_id: <sys_id of an example incident>
file_name: <example file name>
Then if you scroll all the way to the bottom of the page in the bottom right hand corner you should see a link named: [Powershell]
This will generate a sample Powershell script for integrating with the REST API on your instance.
You can then integrate this script into your code without the 4mb restriction.