- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2020 07:02 PM
I'm trying to send an attachment to a third party service (DocParser) in order to extract the text via OCR and return back structured data.
The api documentation for DocParser says to use form-data in the body with file_content as they key and the file content in base64 encoding as the value. How can I achieve this with the RESTMessageV2 ? I can get the base64 encoding (GlideSysAttachment.getContentBase64()), but I can't figure out how to put this into the body using form-data. setRequestBody seems to be for strings and setRequestBodyFromAttachment changes the whole body to binary. Thanks in advance!
Solved! Go to Solution.
- Labels:
-
IntegrationHub
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2020 09:17 PM
you can send multi-part form data via Rest Message
refer below links
Multipart/form-data attachment pusg using Rest API from Snow->Jira
Outbound REST - Multipart/form-data
Outbound REST - Multipart/form-data
REST API attachments Transfer to JIRA
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2020 08:25 PM
Hi Michael
You can pass that as String only. For e.g
var json = {};
json['file_content'] = "<base64_data>";
var restMessage = new sn_ws.RESTMessageV2();
restMessage.setRequestBody(JSON.stringify(json));
Try this and let us know.
Regards
Deepen shah
aavenir.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2020 09:17 PM
you can send multi-part form data via Rest Message
refer below links
Multipart/form-data attachment pusg using Rest API from Snow->Jira
Outbound REST - Multipart/form-data
Outbound REST - Multipart/form-data
REST API attachments Transfer to JIRA
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader