7.5 Read Error Handling
In response to a read request, the SData provider MUST return one of the following HTTP status codes:
|200 OK||Read was successful. Response contains a valid <entry>.|
|304 Not Modified||Read 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 resource.|
|404 Not Found||The resource does not exist. See note below.|
|500 Internal Server Error||Serious provider error. Client SHOULD NOT retry the request.|
|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.|
Query and read operations handle the 404 case differently. For a read operation, a 404 status MUST be returned if the resource doesn't exist. For a query, a 200 status MUST be returned with an empty feed when the query doesn't select any resource. See Query Error Handling section.
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, the entry MAY include one or more <sdata:diagnosis> elements. In this case, the diagnosis elements MUST only be warnings or information.
SData providers MUST return errors as described above.