If you are trying to perform a POST/DELETE API call using Spring Boot REST (@RestController) and you get HTTP 415 error, well that's because you need to provide the header type as,
If you do not provide a Content-Type header, by default the Request will be considered as plain text and you would also see a warning in your application logs.
Fix:
cURL Example:
curl --location 'http://localhost:8080/update-user' \
--header 'Content-Type: application/json' \
--data '{
"userId":10,
"userName":"Ron"
}'
If you are using Postman, make sure to pass in Content-Type as application/json under the Headers tab.

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!