What is http status 415?
What is http status 415?
The HTTP 415 Unsupported Media Type client error response code indicates that the server refuses to accept the request because the payload format is in an unsupported format. The format problem might be due to the request’s indicated Content-Type or Content-Encoding , or as a result of inspecting the data directly.
How to fix 415 unsupported media type in spring boot?
Resolution There are two options in front of us to resolve the issue. The first option is to change the request payload format according to what the server expects. The second option is to update the API request so that it starts supporting JSON format.

How to debug 415 unsupported media type?
Fixing 415 Unsupported Media Type errors
- Ensure that you are sending the proper Content-Type header value.
- Verify that your server is able to process the value defined in the Content-Type header.
- Check the Accept header to verify what the server is actually willing to process.
What is difference between @RequestBody and @ModelAttribute?
@ModelAttribute is used for binding data from request param (in key value pairs), but @RequestBody is used for binding data from whole body of the request like POST,PUT.. request types which contains other format like json, xml.

How do you use RequestBody?
Simply put, the @RequestBody annotation maps the HttpRequest body to a transfer or domain object, enabling automatic deserialization of the inbound HttpRequest body onto a Java object. Spring automatically deserializes the JSON into a Java type, assuming an appropriate one is specified.
What should be changed to fix the 415 error?
I simply changed “contenttype” to “contentType” and it worked.
How do I give JSON data to postman?
In Postman, change the method next to the URL to ‘POST’, and under the ‘Body’ tab choose the ‘raw’ radio button and then ‘JSON (application/json)’ from the drop down. You can now type in the JSON you want to send along with the POST request. If this is successful, you should see the new data in your ‘db.