Getting 415 - Unsupported Media Type in Postman post method
I was having a similar experience using postman and aws. I could get the appropriate response testing within AWS but when I tested within postman I'd get "Unsupported Media Type" I solved it in postman by selecting the Body tab, then selecting the raw radio button, then selecting JSON(application/json) in the dropdown. Finally I filled in the raw data similar to what my test data in AWS looked like. It looked something like this:
I hope that helps, good luck!
Rahul Gaikwad
I am a software engineer ,I like building things to solve problems. This is what engineers do. So it was a natural fit for me to become an engineer.My passion outside of work is listening music.
Updated on June 05, 2022Comments
-
Rahul Gaikwad almost 2 years
I have using postman (https://www.getpostman.com/) for testing my APIs APIs are in AWS ApiGateway and Lambda function (NodeJS)
(1) When first time I am sending post method request to server, it's giving proper response, I am not sending any post params for now.
Here is request header-
Connection →keep-alive Content-Length →61 Content-Type →application/json Date →Fri, 24 Mar 2017 09:09:13 GMT Via →1.1 440f7503597ca64245c4258c03b08e0c.cloudfront.net (CloudFront) X-Amz-Cf-Id →t50_SeWgC3Qb2ZFtf4fksUTdi5viINCaAEj8MPTvhRbtMHu-LK1mwA== X-Amzn-Trace-Id →Root=1-58d4e239-76404c1ab9912d010fac33a2 X-Cache →Miss from cloudfront x-amzn-RequestId →8c8f9bd2-1071-11e7-9490-79b68cde95e0
Here is response
{ "response": "false", "message": "Please enter a valid email !" }
Its working fine when no post params send to request.
(2) And now when I am sending some params to request , The request header changed and its removed one header prama X-Amzn-Trace-Id
Here is request header-
Connection →keep-alive Content-Length →37 Content-Type →application/json Date →Fri, 24 Mar 2017 09:02:52 GMT Via →1.1 d6cd0a105a9b074288944d270dfa7321.cloudfront.net (CloudFront) X-Amz-Cf-Id →UZLUL1lYwAIrnwaa7kPVrPBx462sa7sV0x0WFQFGJ2OXVbrp9gaNYg== X-Cache →Error from cloudfront x-amzn-RequestId →a9c4116a-1070-11e7-b08c-c3cf73411cde
Here is request body
{ "userEmail":"[email protected]", "userPasswod":"123456", "userName":"rahul" }
Here is response
{ "message": "Unsupported Media Type" }
After lot of R&D I have also added
content/Type- application/json
in header but still getting same response.Please somebody help me to figure out this issue with postman.