upload pdf from servicenow to Third party application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I'm having trouble sending an attachment. Despite setting the attachment format to multipart/form-data, I still can't get it to work. Could you please briefly guide me on this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
check below links
Multipart/form-data attachment pusg using Rest API from Snow->Jira
Outbound REST - Multipart/form-data
REST API attachments Transfer to JIRA
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
The reason that body never works is that RESTMessageV2 doesn't support multipart at all. ServiceNow's own docs list "Multipart with attachments" under what the scripted API can't do, and point you at the REST Step in IntegrationHub instead.
https://www.servicenow.com/docs/r/eJIqiaxRKVcMaR8XQU6_oA/XoVTqjPElFt41649_Vslfw
Also, the < example.pdf line in your body is curl syntax. It gets sent as those literal characters, so the PDF never goes anywhere.
If the endpoint accepts a plain binary POST, setRequestBodyFromAttachment(attachmentSysId) does the job with the content type set from the attachment. If it insists on multipart, use the REST Step, or build the body yourself with GlideSysAttachmentInputStream and a ByteArrayOutputStream.
Thanks
