Help Needed: Accessing application/x-www-form-urlencoded Data in webMethods API Gateway

Hi everyone,

I’m currently working with webMethods API Gateway and running into an issue with accessing data from a application/x-www-form-urlencoded request.

Here’s the setup:

  • Request Type: POST
  • Content-Type: application/x-www-form-urlencoded
  • Request Example:
POST /submitSMT HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Authorization: abc123

jobId=1234&status=complete&priority=high
  • Goal: I need to extract the form data parameters (jobId, status, and priority) from the request body.

What I’ve Tried So Far:

In my API Gateway policy, I’ve tried using the following expressions to access the form data:

token=${request.headers.Authorization}
jobId=${request.body.get('jobId')}
status=${request.body.get('status')}
priority=${request.body.get('priority')}

However, the response I get looks like this:

token=abc123
jobId=${request.body.get('jobId')}
status=${request.body.get('status')}
priority=${request.body.get('priority')}

It seems like the form data isn’t being parsed or accessed properly.

I also tried accessing the data via request.payload but didn’t have any success there either.

Questions:

  1. How should I correctly access form data from the request body in webMethods API Gateway?
  2. Are there any specific methods or syntax for handling application/x-www-form-urlencoded data?

Any help or guidance would be greatly appreciated!

Thanks in advance!

need support pls

If you need urgent support, I recommend creating a ticket and marking it as critical. Unfortunately my API gateway knowledge is pretty limited, I would have helped you if I could.

Your syntax is incorrect as there is no “${request.body}” in the variable framework. To access variables from the query string, try using this syntax:
${request.query.jobId}

Variable Framework (webmethods.io)

HTH,
Theo

1 Like