Can AWS API Gateway support `application/x-www-form-urlencoded` with body and query string parameters?


Numerous services can accept query string parameters in the URL when a POST request is made with Content-Type: application/x-www-form-urlencoded and other parameters in the body, but it seems AWS API Gateway cannot while also accepting query string parameters.

When I call the AWS API Gateway with a POST Mapping Template for application/x-www-form-urlencoded and query string URL parameters (with a Lambda function), I get the following error:

Here is an example cURL:

The specific goal is to get a Wootric webhook event posted to a Lambda function using a URL with query string parameters.

You can get the code here:

The Wootric event body file is here:

The GitHub issue is here:

The error message seems pretty definitive but I wanted to ask:

  1. Is there a workaround to configure an API Gateway to support both?
  2. Is there a standards-based reason why AWS would not support this or is this just a design decision / limitation?

If there’s no solution to this, is there a good lightweight solution other than deploying a hosted server solution like Heroku. Also, do other cloud services support this with their API gateway + cloud functions, like Google?

Some examples showing support for both:


Yes,there is a workaround and the key issue is to set the mapping template that will convert string into json . Very detailed example shown in
API Gateway any content type.

Leave a Reply