Robustness Principle
Postel’s Law is a useful to consider when designing APIs. Sometimes also referred to as the Robustness Principle it states…
“Be conservative in what you send, be liberal in what you accept”
Be conservative in what you send
As much as possible stick to the specification that has been published for the API.
Be liberal in what you accept
We want to be liberal to allow for easy extension to the interface. We don’t want every change to break clients.
For example, when an REST resource accepts a JSON entity, we demand that it is at least correctly formatted JSON. But the exact structure of the JSON liberally applied. If a client sent useless information the call should not fail, but ignore the information. If the interface optionally required fields, then if they are absent the call should also not fail.