API Gateway "Unsupported Media Type" Error when sending application/x-www-form-urlencoded data

1

Hello Team

I am creating a REST API that accepts data with Content-Type of application/x-www-form-urlencoded. I test the api in aws but receive 415 error, Unsupported Media Type.

I have tried setting up the API based on the questions and answers here and here but have not been able to resolve the error. The settings are shown below. Please help me with this.

Thanks.

API Result

  • Headers
    • Content-Type:application/x-www-form-urlencoded
  • Request Body
    • a=1

ここに画像の説明を入力してください

Method Request

  • All default settings.

ここに画像の説明を入力してください

Integration Request

  • Request body passthrough
    • When there are no templates defined (recommended)
  • Mapping Template
    • application/x-www-form-urlencoded

ここに画像の説明を入力してください

Integration Response

  • Mapping Template
    • application/json
    • application/x-www-form-urlencoded
      • Both specify the same Json template.

ここに画像の説明を入力してください

Method Response

  • All default settings.

ここに画像の説明を入力してください

Settings

  • Binary Media Types
    • application/x-www-form-urlencoded

ここに画像の説明を入力してください

Kenryo
asked a year ago2509 views
1 Answer
1

Hi, you should read in detail: https://blog.summercat.com/using-aws-lambda-and-api-gateway-as-html-form-endpoint.html

Its section Configuring API Gateway provides a way to use Integations to handle type application/x-www-form-urlencoded

profile pictureAWS
EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions