I'm interfacing with a REST api right now that has an endpoint that processes 2 "different" sets of input.
For example:
Code
{
data: {},
timing: 123.45
}
is valid to send but so is:
Code
{
error: {some error},
}
When you pass in the first example you get a "200" back for "successful" calls. For the second example you get a "4xx" status code back which is a "success".
Does this seem weird to you? Is it acceptable to return a 4xx status code for something that you consider "successful"? I would be expecting a 204 (no content) back on successful processing of this error. Should this even be one endpoint when you're essentially processing 2 different models?!