Hi everyone, I am very new to using Postman for software testing, so please bear with me! I am trying to send a POST request to an API endpoint, however I am receiving a 422 Unprocessable content error. I checked the console, and it is showing:
I’ve already tried running through the documentation regarding this in the support centre, but unfortunately that didn’t help
Can you please include screenshots or details of your request (including the header) redacted as appropriate.
Its probably an issue with the body\content type.
You have application\json in the header.
Therefore, shouldn’t the body, be raw which will then allow you to select JSON.
The drop down for JSON\XML, etc won’t appear unless you have raw selected.
Example from the Learning Center.
The content type and the body must match, and the API must support it, so its usually a case of finding out what the API will accept in the first instance.
Thank you for the advice. I’ve changed the body to raw and entered the JSON, however it’s still returning the same error.
I think I need to do more digging and check with the developers what the API will accept
If you don’t have access to the developer, another option if you have access to the front end UI is to use the “Capture Requests” feature in Postman.
You turn on the feature, perform the action you want to record in the browser, and then stop the recording.
This should generate a list of request\responses that you can review. This should show you the headers, and content type required.
This is useful if you don’t have a documented API or access to a DEV.
This is achieved by a Chrome plugin and the Postman desktop app. You need to run the desktop app as an admin otherwise it won’t automatically install the bridge between the desktop app and the Chrome plugin. (It’s not enough for you to be an admin on the machine, you need to run Postman as admin). This is for Windows.
This is another option.