Skip to content

Commit 4c7c8a0

Browse files
committed
Added typical successfult response description and example
1 parent 9d8568c commit 4c7c8a0

1 file changed

Lines changed: 83 additions & 6 deletions

File tree

docs/source/errors.rst

Lines changed: 83 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Responses
66
After processing API is always providing response, reporting either success
77
or failure.
88

9-
Codes
10-
-----
9+
Status Codes
10+
------------
1111
In all cases, the API should return an `HTTP Status Code
1212
<http://en.wikipedia.org/wiki/List_of_HTTP_status_codes>`_ that indicates
1313
the nature of the failure (below), with a response body in JSON format
@@ -48,8 +48,85 @@ containing additional information.
4848
500
4949
Server error. There was a problem on OpenProcurement's end.
5050

51-
Contents
52-
--------
51+
Success Response
52+
----------------
53+
Every successful get, create, update, replace request results in response
54+
that contains `data` attribute. That `data` attribute contains full JSON
55+
object representation after the operation. If some data were generated in
56+
the results of processing (like new object IDs, of `modified` date) they are
57+
present in the respose.
58+
59+
The listing requests result in similar responses, but instead of single
60+
object in `data` attribute, the JSON response contains collection of
61+
objects.
62+
63+
Example Succes Response
64+
~~~~~~~~~~~~~~~~~~~~~~~
65+
Here is response describing tender
66+
67+
.. sourcecode:: http
68+
69+
HTTP/1.1 200 OK
70+
71+
{
72+
"data":{
73+
"id": "64e93250be76435397e8c992ed4214d1",
74+
"tenderID": "UA-2014-DUS-156",
75+
"modified": "2014-10-27T08:06:58.158Z",
76+
"procuringEntity": {
77+
"id": {
78+
"name": "Державне управління справами",
79+
"scheme": "https://ns.openprocurement.org/ua/edrpou",
80+
"uid": "00037256",
81+
"uri": "http://www.dus.gov.ua/"
82+
},
83+
"address": {
84+
"countryName": "Україна",
85+
"postalCode": "01220",
86+
"region": "м. Київ",
87+
"locality": "м. Київ",
88+
"streetAddress": "вул. Банкова, 11, корпус 1"
89+
}
90+
},
91+
"totalValue": {
92+
"amount": 500,
93+
"currency": "UAH",
94+
"valueAddedTaxIncluded": true
95+
},
96+
"itemsToBeProcured": [
97+
{
98+
"description": "футляри до державних нагород",
99+
"primaryClassification": {
100+
"scheme": "CPV",
101+
"id": "44617100-9",
102+
"description": "Cartons"
103+
},
104+
"additionalClassification": [
105+
{
106+
"scheme": "ДКПП",
107+
"id": "17.21.1",
108+
"description": "папір і картон гофровані, паперова й картонна тара"
109+
}
110+
],
111+
"unitOfMeasure": "item",
112+
"quantity": 5
113+
}
114+
],
115+
"clarificationPeriod": {
116+
"endDate": "2014-10-31T00:00:00"
117+
},
118+
"tenderPeriod": {
119+
"endDate": "2014-11-06T10:00:00"
120+
},
121+
"awardPeriod": {
122+
"endDate": "2014-11-13T00:00:00"
123+
}
124+
}
125+
}
126+
127+
128+
Error Response
129+
--------------
53130
In the event of an error, the response body will contain an `errors` field
54131
at the top level. This contains an array of at least one error object,
55132
described below:
@@ -66,8 +143,8 @@ messageUID
66143
Unique correlation identifier of the error response for audit and issue
67144
reporting purposes.
68145

69-
Example Response
70-
~~~~~~~~~~~~~~~~
146+
Example Error Response
147+
~~~~~~~~~~~~~~~~~~~~~~
71148
Sample below indicate incomplete request.
72149

73150
.. sourcecode:: http

0 commit comments

Comments
 (0)