API Design · Junior · Question 71 of 75
When is it fine to create a resource with PUT?
- 1Never; PUT can only update
- ✓Correct answer: When the client chooses the resource's identifier, e.g.
PUT /users/42/avatarorPUT /settings/theme - 3Only when the server assigns the ID
Explanation
Because PUT is idempotent, repeating it with the same body is safe: the resource ends up in the same state.