How to set Form-data in Rest Message ( attaching a file )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2016 10:39 AM
Hey guys,
I have everything set up and running the only issue is how to set the request of the rest message to ( -F ) form-data
My curl look like this.
curl https:/<endpoint url>/content \
-H "Authorization: Bearer ACCESS_TOKEN" -X POST \
-F attributes='{"name":"tigers.jpeg", "parent":{"id":"11446498"}}' \
-F file=@myfile.jpg
this is what causing the problem !!! the body of the request must be set to -F ( form data )
-F attributes='{"name":"tigers.jpeg", "parent":{"id":"11446498"}}' \
-F file=@myfile.jpg
setContent() did not work
.
Any help is appreciated!!
regards
Nagendra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2017 02:21 PM
Here's my fix. I see it would solve several of the questions in this thread.
Convert your key: value pair to a raw data format of key=value with an & inbetween value and the next key:
key=value&nextkey=nextvalue&thirdkey=thirdvalue
Then place this into the Content portion of your message
ALSO set a HTTP Header of:
Content-Type: application/x-www-form-urlencoded

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2018 02:56 AM
Hi Nagendra,
Its been confirmed by ServiceNow that they do not support content-type as "multipart/form-data" .The only solution is either use Mid server or create own proxy server where you can send as Binary Stream .
There are others content-type as "Application/Json" which you can use.
Just to keep in mid that ServiceNow sends Text data out of ServiceNow.
reference:
https://community.servicenow.com/community?id=community_question&sys_id=a8df36addb58dbc01dcaf3231f9619fb
https://community.servicenow.com/community?id=community_question&sys_id=c78487a9dbd8dbc01dcaf3231f96191d
Please hit like if this helped you.
regards
Sandeep

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2019 07:11 AM
Hi,
Multipart/form-data requests are now supported via the REST action step in the IntegrationHub which comes as part of the ServiceNow IntegrationHub Installer plugin available for a fee in the Madrid release.
The procedure to set this up is explained in the below knowledge article.
How to send Outbound REST request with multipart/form-data
Regards,
Prabhat