Bug 28020: (follow-up) Add docs about error_code on the API
[koha.git] / api / v1 / swagger / paths / acquisitions_orders.yaml
1 ---
2 /acquisitions/orders:
3   get:
4     x-mojo-to: Acquisitions::Orders#list
5     operationId: listOrders
6     tags:
7       - orders
8     summary: List orders
9     produces:
10       - application/json
11     parameters:
12       - name: biblio_id
13         in: query
14         description: Identifier for a linked bibliographic record
15         required: false
16         type: integer
17       - name: basket_id
18         in: query
19         description: Identifier for a linked acquisition basket
20         required: false
21         type: integer
22       - name: fund_id
23         in: query
24         description: Identifier for the fund the order goes against
25         required: false
26         type: integer
27       - name: status
28         in: query
29         description: Current status for the order. Can be 'new', 'ordered', 'partial',
30           'complete' or 'cancelled'
31         required: false
32         type: string
33       - name: only_active
34         in: query
35         description: If only active orders should be listed
36         required: false
37         type: boolean
38       - $ref: ../parameters.yaml#/match
39       - $ref: ../parameters.yaml#/order_by
40       - $ref: ../parameters.yaml#/page
41       - $ref: ../parameters.yaml#/per_page
42       - $ref: ../parameters.yaml#/q_param
43       - $ref: ../parameters.yaml#/q_body
44       - $ref: ../parameters.yaml#/q_header
45     responses:
46       "200":
47         description: A list of orders
48         schema:
49           type: array
50           items:
51             $ref: ../definitions.yaml#/order
52       "401":
53         description: Authentication required
54         schema:
55           $ref: ../definitions.yaml#/error
56       "403":
57         description: Access forbidden
58         schema:
59           $ref: ../definitions.yaml#/error
60       "404":
61         description: Order not found
62         schema:
63           $ref: ../definitions.yaml#/error
64       "500":
65         description: |
66           Internal server error. Possible `error_code` attribute values:
67
68           * `internal_server_error`
69         schema:
70           $ref: ../definitions.yaml#/error
71       "503":
72         description: Under maintenance
73         schema:
74           $ref: ../definitions.yaml#/error
75     x-koha-authorization:
76       permissions:
77         acquisition:
78           - order_manage
79           - order_manage_all
80     x-koha-embed:
81       - basket
82       - basket.basket_group
83       - basket.creator
84       - biblio
85       - biblio.active_orders+count
86       - biblio.holds+count
87       - biblio.items+count
88       - biblio.suggestions.suggester
89       - fund
90       - current_item_level_holds+count
91       - invoice
92       - items
93       - subscription
94   post:
95     x-mojo-to: Acquisitions::Orders#add
96     operationId: addOrder
97     tags:
98       - orders
99     summary: Add order
100     parameters:
101       - name: body
102         in: body
103         description: A JSON object representing an order
104         required: true
105         schema:
106           $ref: ../definitions.yaml#/order
107     produces:
108       - application/json
109     responses:
110       "201":
111         description: Order added
112         schema:
113           $ref: ../definitions.yaml#/order
114       "400":
115         description: Bad request
116         schema:
117           $ref: ../definitions.yaml#/error
118       "401":
119         description: Authentication required
120         schema:
121           $ref: ../definitions.yaml#/error
122       "403":
123         description: Access forbidden
124         schema:
125           $ref: ../definitions.yaml#/error
126       "409":
127         description: Conflict in creating the resource
128         schema:
129           $ref: ../definitions.yaml#/error
130       "500":
131         description: |
132           Internal server error. Possible `error_code` attribute values:
133
134           * `internal_server_error`
135         schema:
136           $ref: ../definitions.yaml#/error
137       "503":
138         description: Under maintenance
139         schema:
140           $ref: ../definitions.yaml#/error
141     x-koha-authorization:
142       permissions:
143         acquisition: order_manage
144 "/acquisitions/orders/{order_id}":
145   get:
146     x-mojo-to: Acquisitions::Orders#get
147     operationId: getOrder
148     tags:
149       - orders
150     summary: Get order
151     parameters:
152       - $ref: ../parameters.yaml#/order_id_pp
153     produces:
154       - application/json
155     responses:
156       "200":
157         description: An order
158         schema:
159           $ref: ../definitions.yaml#/order
160       "401":
161         description: Authentication required
162         schema:
163           $ref: ../definitions.yaml#/error
164       "403":
165         description: Access forbidden
166         schema:
167           $ref: ../definitions.yaml#/error
168       "404":
169         description: Order not found
170         schema:
171           $ref: ../definitions.yaml#/error
172       "500":
173         description: |
174           Internal server error. Possible `error_code` attribute values:
175
176           * `internal_server_error`
177         schema:
178           $ref: ../definitions.yaml#/error
179       "503":
180         description: Under maintenance
181         schema:
182           $ref: ../definitions.yaml#/error
183     x-koha-authorization:
184       permissions:
185         acquisition: order_manage
186     x-koha-embed:
187       - basket
188       - basket.basket_group
189       - basket.creator
190       - biblio
191       - biblio.active_orders+count
192       - biblio.holds+count
193       - biblio.items+count
194       - biblio.suggestions.suggester
195       - fund
196       - current_item_level_holds+count
197       - invoice
198       - items
199       - subscription
200   put:
201     x-mojo-to: Acquisitions::Orders#update
202     operationId: updateOrder
203     tags:
204       - orders
205     summary: Update order
206     parameters:
207       - $ref: ../parameters.yaml#/order_id_pp
208       - name: body
209         in: body
210         description: A JSON object representing an order
211         required: true
212         schema:
213           $ref: ../definitions.yaml#/order
214     produces:
215       - application/json
216     responses:
217       "200":
218         description: An order
219         schema:
220           $ref: ../definitions.yaml#/order
221       "401":
222         description: Authentication required
223         schema:
224           $ref: ../definitions.yaml#/error
225       "403":
226         description: Access forbidden
227         schema:
228           $ref: ../definitions.yaml#/error
229       "404":
230         description: Order not found
231         schema:
232           $ref: ../definitions.yaml#/error
233       "500":
234         description: |
235           Internal server error. Possible `error_code` attribute values:
236
237           * `internal_server_error`
238         schema:
239           $ref: ../definitions.yaml#/error
240       "503":
241         description: Under maintenance
242         schema:
243           $ref: ../definitions.yaml#/error
244     x-koha-authorization:
245       permissions:
246         acquisition: order_manage
247   delete:
248     x-mojo-to: Acquisitions::Orders#delete
249     operationId: deleteOrder
250     tags:
251       - orders
252     summary: Delete order
253     parameters:
254       - $ref: ../parameters.yaml#/order_id_pp
255     produces:
256       - application/json
257     responses:
258       "204":
259         description: Order deleted
260       "401":
261         description: Authentication required
262         schema:
263           $ref: ../definitions.yaml#/error
264       "403":
265         description: Access forbidden
266         schema:
267           $ref: ../definitions.yaml#/error
268       "404":
269         description: Order not found
270         schema:
271           $ref: ../definitions.yaml#/error
272       "500":
273         description: |
274           Internal server error. Possible `error_code` attribute values:
275
276           * `internal_server_error`
277         schema:
278           $ref: ../definitions.yaml#/error
279       "503":
280         description: Under maintenance
281         schema:
282           $ref: ../definitions.yaml#/error
283     x-koha-authorization:
284       permissions:
285         acquisition: order_manage