ServiceNow Unable to Process the Request Body with a Content-Type 'application/x-www-form-urlencoded' while using Scripted REST Web Service

surendarm
Kilo Expert

Hello All,

Scenario:

We trying to connect with a third party application where they can consume our API and send us the request to be processed and update the incident record.

Issue:

The Content-Type of the request body is 'application/x-www-form-urlencoded' and ServiceNow is unable to process the request.

  • Based on the link, we can override the 'Content-Type' to application/x-www-form-urlencoded
  • But, we aren't able to receive the body using 'datastream'. We have used this same script by referring the link
  • When we print the body, it shows 'com.glide.communications.GlideScriptableInputStream' in the logs

Kindly let me know if anyone has worked on processing the request body with the Content-Type as 'application/x-www-form-urlencoded'.

Thanks in advance.

Regards,

Surendar M

17 REPLIES 17

Matt Hernandez
Tera Guru

As of London release, Servicenow claims that content type application/x-www-form-urlencoded is now fully supported in Scripted REST API. I have not tested it, but below I included the link from Release notes where it claims that request.queryParams behavior has been enhanced.

https://docs.servicenow.com/bundle/london-application-development/page/integrate/custom-web-services...

Still a no-go (as of Madrid) if you're trying to compute the hash signature for incoming Slash commands. You'll still need to use a processor for an endpoint to get the right signature.

Confirmed... In Madrid I too am unable to get GlideTextReader() and readLine() to work at all with request.body.dataStream with an 'application/x-www-form-urlencoded' POST from Slack.

Looks like I'm facing re-architecting to a Processor.