January 2018
Intermediate to advanced
414 pages
10h 29m
English
When we send a JSON object, only the value of the properties that could be set will be handled; if the JSON object has additional data, it will be ignored. And without specifying more, even if we don't send a value that actually is needed in our request, the object will be deserialized somehow.
For example, let's send this request to our API:
curl -X POST \ http://localhost:8080/customer/ \ -H 'content-type: application/json' \ -d '{ "id": 4, "customerName": "New Customer"}'
We will get a 400 BAD REQUEST error in our API. This will happen as well if we send a JSON that could not be handled and will not create an object. For example, with this request, that has a missing bracket:
curl -X POST \ http://localhost:8080/customer/ ...
Read now
Unlock full access