On the last example, I believe a PUT call should respond with an error status for missing fields, and for partial changes we should use PATCH instead. But considering your point to be intuitive, I would say we should send an optional suggestion field in the PUT case but still cause it to error out. e.g.:
{
// Some internal error code for tracking
"code": "MISSING_REQUIRED_FIELDS", // or: -1
// can be used for showing error message in UI.
"message": "Required fields: 'name', 'email'.",
// can be hidden from UI but REST API users can see the help text.
"suggestion": "Use PATCH for partial updates."
}
Intuition should not break conventions.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
On the last example, I believe a PUT call should respond with an error status for missing fields, and for partial changes we should use PATCH instead. But considering your point to be intuitive, I would say we should send an optional suggestion field in the PUT case but still cause it to error out. e.g.:
Intuition should not break conventions.