Return 422 when the input data is not valid

API User : 422 should be used when the data is syntactically correct but semantically incorrect.

API builder : You sure love fancy words.

API builder : Last time you talked about data being syntactically correct.

API builder : And now you are talking about semantically incorrect. Why can’t you speak simple english.

API User : “Semantically” simpley means business wise.

API User : It’s possible that the payload sent by the client is valid JSON but it is not complying with the business rules.

API User : For example in order to create a user you need name. If the payload does not provide name then it is an example of data being valid JSON data but “business-wise” it is not valid.

API User : So in other words the payload is “syntacticaly correct” but “semantically incorrect”.

API builder : That’s good to know. I will fix the code.