Responses¶
After processing API is always providing response, reporting either success or failure.
Status Codes¶
In all cases, the API should return an HTTP Status Code that indicates the nature of the failure (below), with a response body in JSON format containing additional information.
- 200
- Success. If data was requested, it will be available in the data field at the top level of the response body.
- 201
- 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.
- 400
- Invalid request. This usually occurs because of a missing or malformed parameter. Check the documentation and the syntax of your request and try again.
- 401
- No authorization. A valid API key was not provided with the request, so the API could not associate a user with the request.
- 403
- Forbidden. The API key and request syntax was valid but the server is refusing to complete the request. This can happen if you try to read or write to objects or properties that the party does not have access to.
- 404
- 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.
- 429
- Rate Limit Enforced.
- 500
- Server error. There was a problem on OpenProcurement’s end.
Success Response¶
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 results of processing (like new object IDs, of 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 Succes Response¶
Here is response describing tender
HTTP/1.1 200 OK
{
"data":{
"id": "64e93250be76435397e8c992ed4214d1",
"tenderID": "UA-2014-DUS-156",
"dateModified": "2014-10-27T08:06:58.158Z",
"procuringEntity": {
"name": "ДУС"б
"identifier": {
"name": "Державне управління справами",
"scheme": "UA-EDR",
"uid": "00037256"
},
"address": {
"countryName": "Україна",
"postalCode": "01220",
"region": "м. Київ",
"locality": "м. Київ",
"streetAddress": "вул. Банкова, 11, корпус 1"
}
},
"value": {
"amount": 500,
"currency": "UAH",
"valueAddedTaxIncluded": true
},
"items": [
{
"description": "футляри до державних нагород",
"classification": {
"scheme": "CPV",
"id": "44617100-9",
"description": "Cartons"
},
"additionalClassifications": [
{
"scheme": "ДКПП",
"id": "17.21.1",
"description": "папір і картон гофровані, паперова й картонна тара"
}
],
"quantity": 5,
"unit": {
"name": "item"
},
"deliveryDate": {
"endDate": "2014-11-20T00:00:00"
}
}
],
"clarificationPeriod": {
"endDate": "2014-10-31T00:00:00"
},
"tenderPeriod": {
"startDate": "2014-11-03T00:00:00",
"endDate": "2014-11-06T10:00:00"
},
"minimalStep": {
"amount": 35,
"currency", "UAH",
"valueAddedTaxIncluded": true
}
}
}
Error Response¶
In the event of an error, the response body will contain an errors field at the top level. This contains an array of at least one error object, described below:
location: | Part of the request causing the error. Possible values are header and body. |
---|---|
name: |
|
description: | Verbose (human readable) description of error. |
Example Error Response¶
Sample below indicate incomplete request.
HTTP/1.1 400 Missing input
{
"status": "error",
"errors": [
{
"location": "body",
"name": "data",
"description": "No JSON object could be decoded"
}
]
}