Search code examples
restcurlpostmanrestful-url

415 Unsupported Media Type in PostMan but not in curl


I call this Rest method through curl and its working fine:

curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{ "email": "[email protected]" }' "http://129.162.231.137:1133/calzada/api/v1/users/pwd"

But when I call the same method using PostMan I got a 415 error:

enter image description here


Solution

  • I can see two main problems:

    1. In body request you are sending an invalid Json, because you add -d before and simple quote at the end (eliminate both).
    2. You don't set header/content type right. To achieve it click in Text (on the right binary button) and set in JSON (aplication/json), with that postman add header for request.

    Example:

    Postman Example

    PD: I tried make your request, but I never receive an 200 status code, most requests were timeout (I don't know if you run that server locally or have a special proxy configuration).