When making a POST, PUT, PATCH request with badly formed body (e.g. wrong types, missing required fields) to an unknown endpoint, should that return 404 or 400?
Example:
- There exists an endpoint
/resource/:resourceId. - There exists a resource with
resourcedId: 1. - Endpoint requires
2fields forPUTrequest.enable: booleanandcount: number. - Client makes the following request
PUT /resource/2with body{ enable: 7 }.
Should the server return 404 (because resource with resourceId: 2 does not exist) or 400 (because body is in invalid format)?