Bug 18731: OpenAPI definitions
[koha.git] / api / v1 / swagger / paths / acquisitions_orders.json
1 {
2     "/acquisitions/orders": {
3         "get": {
4             "x-mojo-to": "Acquisitions::Orders#list",
5             "operationId": "listOrders",
6             "tags": [
7                 "acquisitions",
8                 "orders"
9             ],
10             "produces": [
11                 "application/json"
12             ],
13             "parameters": [
14                 {
15                     "name": "biblio_id",
16                     "in": "query",
17                     "description": "Identifier for a linked bibliographic record",
18                     "required": false,
19                     "type": "integer"
20                 },
21                 {
22                     "name": "basket_id",
23                     "in": "query",
24                     "description": "Identifier for a linked acquisition basket",
25                     "required": false,
26                     "type": "integer"
27                 },
28                 {
29                     "name": "budget_id",
30                     "in": "query",
31                     "description": "Identifier for the budget the order goes against",
32                     "required": false,
33                     "type": "integer"
34                 },
35                 {
36                     "name": "status",
37                     "in": "query",
38                     "description": "Current status for the order. Can be 'new', 'ordered', 'partial', 'complete' or 'cancelled'",
39                     "required": false,
40                     "type": "string"
41                 },
42                 {
43                     "$ref": "../parameters.json#/match"
44                 },
45                 {
46                     "$ref": "../parameters.json#/order_by"
47                 },
48                 {
49                     "$ref": "../parameters.json#/page"
50                 },
51                 {
52                     "$ref": "../parameters.json#/per_page"
53                 }
54             ],
55             "responses": {
56                 "200": {
57                     "description": "A list of orders",
58                     "schema": {
59                         "type": "array",
60                         "items": {
61                             "$ref": "../definitions.json#/order"
62                         }
63                     }
64                 },
65                 "401": {
66                     "description": "Authentication required",
67                     "schema": {
68                         "$ref": "../definitions.json#/error"
69                     }
70                 },
71                 "403": {
72                     "description": "Access forbidden",
73                     "schema": {
74                         "$ref": "../definitions.json#/error"
75                     }
76                 },
77                 "404": {
78                     "description": "Order not found",
79                     "schema": {
80                         "$ref": "../definitions.json#/error"
81                     }
82                 },
83                 "500": {
84                     "description": "Internal server error",
85                     "schema": {
86                         "$ref": "../definitions.json#/error"
87                     }
88                 },
89                 "503": {
90                     "description": "Under maintenance",
91                     "schema": {
92                         "$ref": "../definitions.json#/error"
93                     }
94                 }
95             },
96             "x-koha-authorization": {
97                 "permissions": {
98                     "acquisition": [ "order_manage", "order_manage_all" ]
99                 }
100             },
101             "x-koha-embed": [
102                 "basket",
103                 "fund",
104                 "invoice",
105                 "subscription",
106                 "items",
107                 "biblio"
108             ]
109         },
110         "post": {
111             "x-mojo-to": "Acquisitions::Orders#add",
112             "operationId": "addOrder",
113             "tags": [
114                 "acquisitions",
115                 "orders"
116             ],
117             "parameters": [
118                 {
119                     "name": "body",
120                     "in": "body",
121                     "description": "A JSON object representing an order",
122                     "required": true,
123                     "schema": {
124                         "$ref": "../definitions.json#/order"
125                     }
126                 }
127             ],
128             "produces": [
129                 "application/json"
130             ],
131             "responses": {
132                 "201": {
133                     "description": "Order added",
134                     "schema": {
135                         "$ref": "../definitions.json#/order"
136                     }
137                 },
138                 "400": {
139                     "description": "Bad request",
140                     "schema": {
141                         "$ref": "../definitions.json#/error"
142                     }
143                 },
144                 "401": {
145                     "description": "Authentication required",
146                     "schema": {
147                         "$ref": "../definitions.json#/error"
148                     }
149                 },
150                 "403": {
151                     "description": "Access forbidden",
152                     "schema": {
153                         "$ref": "../definitions.json#/error"
154                     }
155                 },
156                 "409": {
157                     "description": "Conflict in creating the resource",
158                     "schema": {
159                         "$ref": "../definitions.json#/error"
160                     }
161                 },
162                 "500": {
163                     "description": "Internal server error",
164                     "schema": {
165                         "$ref": "../definitions.json#/error"
166                     }
167                 },
168                 "503": {
169                     "description": "Under maintenance",
170                     "schema": {
171                         "$ref": "../definitions.json#/error"
172                     }
173                 }
174             },
175             "x-koha-authorization": {
176                 "permissions": {
177                     "acquisition": "order_manage"
178                 }
179             }
180         }
181     },
182     "/acquisitions/orders/{order_id}": {
183         "get": {
184             "x-mojo-to": "Acquisitions::Orders#get",
185             "operationId": "getOrder",
186             "tags": [
187                 "acquisitions",
188                 "orders"
189             ],
190             "parameters": [
191                 {
192                     "$ref": "../parameters.json#/order_id_pp"
193                 }
194             ],
195             "produces": [
196                 "application/json"
197             ],
198             "responses": {
199                 "200": {
200                     "description": "An order",
201                     "schema": {
202                         "$ref": "../definitions.json#/order"
203                     }
204                 },
205                 "401": {
206                     "description": "Authentication required",
207                     "schema": {
208                         "$ref": "../definitions.json#/error"
209                     }
210                 },
211                 "403": {
212                     "description": "Access forbidden",
213                     "schema": {
214                         "$ref": "../definitions.json#/error"
215                     }
216                 },
217                 "404": {
218                     "description": "Order not found",
219                     "schema": {
220                         "$ref": "../definitions.json#/error"
221                     }
222                 },
223                 "500": {
224                     "description": "Internal server error",
225                     "schema": {
226                         "$ref": "../definitions.json#/error"
227                     }
228                 },
229                 "503": {
230                     "description": "Under maintenance",
231                     "schema": {
232                         "$ref": "../definitions.json#/error"
233                     }
234                 }
235             },
236             "x-koha-authorization": {
237                 "permissions": {
238                     "acquisition": "order_manage"
239                 }
240             },
241             "x-koha-embed": [
242                 "basket",
243                 "fund",
244                 "invoice",
245                 "subscription",
246                 "items",
247                 "biblio"
248             ]
249         },
250         "put": {
251             "x-mojo-to": "Acquisitions::Orders#update",
252             "operationId": "updateOrder",
253             "tags": [
254                 "acquisitions",
255                 "orders"
256             ],
257             "parameters": [
258                 {
259                     "$ref": "../parameters.json#/order_id_pp"
260                 },
261                 {
262                     "name": "body",
263                     "in": "body",
264                     "description": "A JSON object representing an order",
265                     "required": true,
266                     "schema": {
267                         "$ref": "../definitions.json#/order"
268                     }
269                 }
270             ],
271             "produces": [
272                 "application/json"
273             ],
274             "responses": {
275                 "200": {
276                     "description": "An order",
277                     "schema": {
278                         "$ref": "../definitions.json#/order"
279                     }
280                 },
281                 "401": {
282                     "description": "Authentication required",
283                     "schema": {
284                         "$ref": "../definitions.json#/error"
285                     }
286                 },
287                 "403": {
288                     "description": "Access forbidden",
289                     "schema": {
290                         "$ref": "../definitions.json#/error"
291                     }
292                 },
293                 "404": {
294                     "description": "Order not found",
295                     "schema": {
296                         "$ref": "../definitions.json#/error"
297                     }
298                 },
299                 "500": {
300                     "description": "Internal server error",
301                     "schema": {
302                         "$ref": "../definitions.json#/error"
303                     }
304                 },
305                 "503": {
306                     "description": "Under maintenance",
307                     "schema": {
308                         "$ref": "../definitions.json#/error"
309                     }
310                 }
311             },
312             "x-koha-authorization": {
313                 "permissions": {
314                     "acquisition": "order_manage"
315                 }
316             }
317         },
318         "delete": {
319             "x-mojo-to": "Acquisitions::Orders#delete",
320             "operationId": "deleteOrder",
321             "tags": [
322                 "acquisitions",
323                 "orders"
324             ],
325             "parameters": [
326                 {
327                     "$ref": "../parameters.json#/order_id_pp"
328                 }
329             ],
330             "produces": [
331                 "application/json"
332             ],
333             "responses": {
334                 "204": {
335                     "description": "Order deleted",
336                     "schema": {
337                         "type": "string"
338                     }
339                 },
340                 "401": {
341                     "description": "Authentication required",
342                     "schema": {
343                         "$ref": "../definitions.json#/error"
344                     }
345                 },
346                 "403": {
347                     "description": "Access forbidden",
348                     "schema": {
349                         "$ref": "../definitions.json#/error"
350                     }
351                 },
352                 "404": {
353                     "description": "Order not found",
354                     "schema": {
355                         "$ref": "../definitions.json#/error"
356                     }
357                 },
358                 "500": {
359                     "description": "Internal server error",
360                     "schema": {
361                         "$ref": "../definitions.json#/error"
362                     }
363                 },
364                 "503": {
365                     "description": "Under maintenance",
366                     "schema": {
367                         "$ref": "../definitions.json#/error"
368                     }
369                 }
370             },
371             "x-koha-authorization": {
372                 "permissions": {
373                     "acquisition": "order_manage"
374                 }
375             }
376         }
377     }
378 }