After processing API always provides response, reporting either success or failure.
In all cases, the API should return an HTTP Status Code that indicates the nature of the failure (see below), with a response body in JSON format containing additional information.
- Success. If data was requested, it will be available in the data field at the top level of the response body.
- Success (for object creation). Its information is available in the data field at the top level of the response body. The API URL where the object can be retrieved is also returned in the Location header of the response.
- Invalid request. This usually occurs because of a missing or malformed parameter. Check the documentation and the syntax of your request and try again.
- No authorization. A valid API key was not provided with the request, so the API could not associate a user with the request.
- Forbidden. The API key and request syntax was valid but the server is refusing to complete the request. This can happen if you are trying to read or write to objects or properties that you do not have access to.
- Not found. Either the request method and path supplied do not specify a known action in the API, or the object specified by the request does not exist.
- Precondition Failed. See :ref:`API in cluster mode <cluster>`.
- Rate Limit Enforced. See :ref:`Rate control <performance>`.
- Server error. There was a problem on OpenProcurement's end.
Every successful get, create, update, replace request results in response that contains data attribute. That data attribute contains full JSON object representation after the operation. If some data were generated in the result of processing (like new object IDs, or modified date) they are present in the respose.
The listing requests result in similar responses, but instead of single object in data attribute, the JSON response contains collection of objects.
Example Success Response
Here is a response that describes lot
In the event of an error, the response body will contain an errors field at the top level. It contains an array of at least one error object, described below:
Part of the request causing the error. Possible values are header and body.
Verbose (human readable) description of the error.
Example Error Response
Sample below indicates incomplete request.