I apologise if there is an answer for this already. I found related questions (e.g. HTTP status code for a partial successful request) but not exactly the same.
I'm building an API that returns data that is aggregated from multiple sources. Sometimes, some critical part of the data is unavailable and the client has to be made aware and error data is included in the response.
Other than the severity of the missing field(s), the rest of the resource is valid and useful and could be regarded as a partial update (e.g. if you only had permissions to see part of a resource).
So far, the options are
- return 200, consider it a partial resource, handle the error data fields in the application as you would with any other data
- return 207 to emphasise it's not fully successfully, but 207 is not strictly HTTP.
- return 500 and handle the successfully returned data in the application as you would on a 200
I'm partial to option 1 but I'm not fully convinced. Is there a clear way of handling this? Perhaps defining a specific content-type
?