Inbound Multipart/form-data via the Scripted REST API (in a scoped application)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2019 02:31 PM
Is it possible to accept multipart/form data via the Scripted REST API (in a scoped application)? A vendor can only send their data and associated attachments using multipart/form-data and they also are unable to utilize any ServiceNow information (like a sys_id) when sending the submission. Any time I try to POST to the Scripted REST API with a multipart/form-data Content-Type, I am currently receiving an error message stating "com.glide.rest.domain.ServiceException: Service error: attempt to access request body is not allowed when request method is GET or DELETE".
Has anyone successfully parsed an inbound multipart/form data via the Scripted REST API (in a scoped application)?
===============
UPDATE:
Let me add some additional details as it appears the (much appreciated) responses are getting off track.
- Both the Scripted REST Service and the associated Scripted REST Resource have 'multipart/form-data' added as a value added under the 'Default supported request formats' (with 'Override default supported request formats' checked as TRUE).
- The Scripted REST Resource has the 'HTTP Method' set as 'POST'
The multipart/form-data contains multiple parts (which are separated by the boundary which is defined in the header), including base64 encoded attachments, binary attachments, and application/json data to be processed. I will need to use data from the application/json part of the payload to determine if this will be creating a new target record or updating an existing record (a coalesce value is within the JSON). The remaining parts of the payload will be attachments on the target record (and I know how to create the base64 encoded data as an attachment and have a plan on how to create the attachments from the binary data). However, I can't even get to start parsing any of the payload if the system won't even allow me to access the request body (based on the error message).
Essentially, the system seems to be providing an invalid error when I am attempting to process a POST request with a multipart/form-data Content-Type, somehow interpreting the submission instead as a GET or DELETE method rather than a POST.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 06:41 AM
Dead link. page not found.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 06:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2020 09:39 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2020 11:03 AM
Hi Sashi. I was not the one facing this issue. We have several Scripted REST API endpoints configured but unfortunately we have never encountered this particular error / scenario.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2022 06:58 PM
Hi, I'm also dealing with a Scripted REST API webhook using multipart/form-data content-type (multipart/form-data; boundary=------------------------56507e6827f8e3b7)
Did you ever get this to work Shane?