As asked
A developer asks you to clarify in the documentation whether to use PUT or PATCH for updating a resource. Explain the distinction and when each is correct.
Sample answer outline
Strong answers explain that PUT replaces the entire resource (the client must send all fields), while PATCH applies a partial update (only the fields being changed). They note that PUT is idempotent by spec while PATCH may or may not be depending on the implementation, and that documenting which fields are optional in a PATCH body is especially important because the behavior when omitting a previously set field varies between implementations.
Expect these follow-ups
- How do you document the behavior when a PATCH request omits a required field?