Bug 29620: Move the OpenAPI spec to YAML format
[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: Internal server error
66         schema:
67           $ref: ../definitions.yaml#/error
68       "503":
69         description: Under maintenance
70         schema:
71           $ref: ../definitions.yaml#/error
72     x-koha-authorization:
73       permissions:
74         acquisition:
75           - order_manage
76           - order_manage_all
77     x-koha-embed:
78       - basket
79       - basket.basket_group
80       - basket.creator
81       - biblio
82       - biblio.active_orders+count
83       - biblio.holds+count
84       - biblio.items+count
85       - biblio.suggestions.suggester
86       - fund
87       - current_item_level_holds+count
88       - invoice
89       - items
90       - subscription
91   post:
92     x-mojo-to: Acquisitions::Orders#add
93     operationId: addOrder
94     tags:
95       - orders
96     summary: Add order
97     parameters:
98       - name: body
99         in: body
100         description: A JSON object representing an order
101         required: true
102         schema:
103           $ref: ../definitions.yaml#/order
104     produces:
105       - application/json
106     responses:
107       "201":
108         description: Order added
109         schema:
110           $ref: ../definitions.yaml#/order
111       "400":
112         description: Bad request
113         schema:
114           $ref: ../definitions.yaml#/error
115       "401":
116         description: Authentication required
117         schema:
118           $ref: ../definitions.yaml#/error
119       "403":
120         description: Access forbidden
121         schema:
122           $ref: ../definitions.yaml#/error
123       "409":
124         description: Conflict in creating the resource
125         schema:
126           $ref: ../definitions.yaml#/error
127       "500":
128         description: Internal server error
129         schema:
130           $ref: ../definitions.yaml#/error
131       "503":
132         description: Under maintenance
133         schema:
134           $ref: ../definitions.yaml#/error
135     x-koha-authorization:
136       permissions:
137         acquisition: order_manage
138 "/acquisitions/orders/{order_id}":
139   get:
140     x-mojo-to: Acquisitions::Orders#get
141     operationId: getOrder
142     tags:
143       - orders
144     summary: Get order
145     parameters:
146       - $ref: ../parameters.yaml#/order_id_pp
147     produces:
148       - application/json
149     responses:
150       "200":
151         description: An order
152         schema:
153           $ref: ../definitions.yaml#/order
154       "401":
155         description: Authentication required
156         schema:
157           $ref: ../definitions.yaml#/error
158       "403":
159         description: Access forbidden
160         schema:
161           $ref: ../definitions.yaml#/error
162       "404":
163         description: Order not found
164         schema:
165           $ref: ../definitions.yaml#/error
166       "500":
167         description: Internal server error
168         schema:
169           $ref: ../definitions.yaml#/error
170       "503":
171         description: Under maintenance
172         schema:
173           $ref: ../definitions.yaml#/error
174     x-koha-authorization:
175       permissions:
176         acquisition: order_manage
177     x-koha-embed:
178       - basket
179       - basket.basket_group
180       - basket.creator
181       - biblio
182       - biblio.active_orders+count
183       - biblio.holds+count
184       - biblio.items+count
185       - biblio.suggestions.suggester
186       - fund
187       - current_item_level_holds+count
188       - invoice
189       - items
190       - subscription
191   put:
192     x-mojo-to: Acquisitions::Orders#update
193     operationId: updateOrder
194     tags:
195       - orders
196     summary: Update order
197     parameters:
198       - $ref: ../parameters.yaml#/order_id_pp
199       - name: body
200         in: body
201         description: A JSON object representing an order
202         required: true
203         schema:
204           $ref: ../definitions.yaml#/order
205     produces:
206       - application/json
207     responses:
208       "200":
209         description: An order
210         schema:
211           $ref: ../definitions.yaml#/order
212       "401":
213         description: Authentication required
214         schema:
215           $ref: ../definitions.yaml#/error
216       "403":
217         description: Access forbidden
218         schema:
219           $ref: ../definitions.yaml#/error
220       "404":
221         description: Order not found
222         schema:
223           $ref: ../definitions.yaml#/error
224       "500":
225         description: Internal server error
226         schema:
227           $ref: ../definitions.yaml#/error
228       "503":
229         description: Under maintenance
230         schema:
231           $ref: ../definitions.yaml#/error
232     x-koha-authorization:
233       permissions:
234         acquisition: order_manage
235   delete:
236     x-mojo-to: Acquisitions::Orders#delete
237     operationId: deleteOrder
238     tags:
239       - orders
240     summary: Delete order
241     parameters:
242       - $ref: ../parameters.yaml#/order_id_pp
243     produces:
244       - application/json
245     responses:
246       "204":
247         description: Order deleted
248       "401":
249         description: Authentication required
250         schema:
251           $ref: ../definitions.yaml#/error
252       "403":
253         description: Access forbidden
254         schema:
255           $ref: ../definitions.yaml#/error
256       "404":
257         description: Order not found
258         schema:
259           $ref: ../definitions.yaml#/error
260       "500":
261         description: Internal server error
262         schema:
263           $ref: ../definitions.yaml#/error
264       "503":
265         description: Under maintenance
266         schema:
267           $ref: ../definitions.yaml#/error
268     x-koha-authorization:
269       permissions:
270         acquisition: order_manage