6.10 Query Error Handling
In response to a query request, the SData provider MUST return one of the following HTTP status codes:
|200 OK||Query was successful. Response contains a valid <feed>|
|304 Not Modified||Query was successful. Response is identical to what the consumer has in its cache. Response payload is empty.|
|400 Bad Request||Generic status for consumer side error. Client MUST modify the request before resubmitting.|
|401 Unauthorized||Request requires user authentication. See Authentication section for details.|
|403 Forbidden||Consumer is not authorized to read the requested feed.|
|404 Not Found||One of the elements specified in the URL does not exist. For example, application name, contract name or resource kind. See note below.|
|500 Internal Server Error||Serious provider error. Client SHOULD NOT retry the request.|
|501 Not Implemented||URL is valid but provider does not implement it. See Query on Intermediate URL section.|
|503 Service Unavailable||Transient provider error. Client MAY retry the request. The provider SHOULD include a Retry-After header in its response to indicate when the consumer MAY retry the request.|
If the query executes successfully but does not select any resources, it MUST return a success code: 200 with an empty feed (or 304 if caching applies). This is not an error and it would be incorrect to return a 404 status in this case.
When the service returns a 4xx or a 5xx status code, it SHOULD include an <sdata:diagnoses> payload with details about the error in its response. See Error Payload section for details.
When the service returns a 200 status code, it MAY include one or more <sdata:diagnosis> in the feed or in individual entries. In this case, the diagnosis elements MUST only be warnings or information, not errors.
SData providers MUST return errors as described above.