Bug 36482: Allow embedding desks and cash_registers on libraries endpoints
[koha.git] / api / v1 / swagger / paths / libraries.yaml
1 ---
2 /libraries:
3   get:
4     x-mojo-to: Libraries#list
5     operationId: listLibraries
6     tags:
7       - libraries
8     summary: List libraries
9     parameters:
10       - name: name
11         in: query
12         description: Case insensitive 'starts-with' search on name
13         required: false
14         type: string
15       - name: address1
16         in: query
17         description: Case insensitive 'starts-with' search on address1
18         required: false
19         type: string
20       - name: address2
21         in: query
22         description: Case insensitive 'starts-with' search on address2
23         required: false
24         type: string
25       - name: address3
26         in: query
27         description: Case insensitive 'starts-with' search on address3
28         required: false
29         type: string
30       - name: postal_code
31         in: query
32         description: Case insensitive 'starts-with' search on postal code
33         required: false
34         type: string
35       - name: city
36         in: query
37         description: Case insensitive 'starts-with' search on city
38         required: false
39         type: string
40       - name: state
41         in: query
42         description: Case insensitive 'starts-with' search on state
43         required: false
44         type: string
45       - name: country
46         in: query
47         description: Case insensitive 'starts_with' search on country
48         required: false
49         type: string
50       - name: phone
51         in: query
52         description: Case insensitive 'starts_with' search on phone number
53         required: false
54         type: string
55       - name: fax
56         in: query
57         description: Case insensitive 'starts_with' search on fax number
58         required: false
59         type: string
60       - name: email
61         in: query
62         description: Case insensitive 'starts_with' search on email address
63         required: false
64         type: string
65       - name: reply_to_email
66         in: query
67         description: Case insensitive 'starts_with' search on Reply-To email address
68         required: false
69         type: string
70       - name: return_path_email
71         in: query
72         description: Case insensitive 'starts_with' search on Return-Path email address
73         required: false
74         type: string
75       - name: url
76         in: query
77         description: Case insensitive 'starts_with' search on website URL
78         required: false
79         type: string
80       - name: ip
81         in: query
82         description: Case insensitive 'starts_with' search on IP address
83         required: false
84         type: string
85       - name: notes
86         in: query
87         description: Case insensitive 'starts_with' search on notes
88         required: false
89         type: string
90       - $ref: "../swagger.yaml#/parameters/match"
91       - $ref: "../swagger.yaml#/parameters/order_by"
92       - $ref: "../swagger.yaml#/parameters/page"
93       - $ref: "../swagger.yaml#/parameters/per_page"
94       - $ref: "../swagger.yaml#/parameters/q_param"
95       - $ref: "../swagger.yaml#/parameters/q_body"
96       - $ref: "../swagger.yaml#/parameters/request_id_header"
97       - name: x-koha-embed
98         in: header
99         required: false
100         description: Embed list sent as a request header
101         type: array
102         items:
103           type: string
104           enum:
105             - cash_registers
106             - desks
107             - smtp_server
108             - library_hours
109         collectionFormat: csv
110     produces:
111       - application/json
112     responses:
113       "200":
114         description: A list of libraries
115         schema:
116           type: array
117           items:
118             $ref: "../swagger.yaml#/definitions/library"
119       "500":
120         description: |
121           Internal server error. Possible `error_code` attribute values:
122
123           * `internal_server_error`
124         schema:
125           $ref: "../swagger.yaml#/definitions/error"
126       "503":
127         description: Under maintenance
128         schema:
129           $ref: "../swagger.yaml#/definitions/error"
130     x-koha-authorization:
131       permissions:
132         catalogue: "1"
133   post:
134     x-mojo-to: Libraries#add
135     operationId: addLibrary
136     tags:
137       - libraries
138     summary: Add library
139     parameters:
140       - name: body
141         in: body
142         description: A JSON object containing informations about the new library
143         required: true
144         schema:
145           $ref: "../swagger.yaml#/definitions/library"
146     produces:
147       - application/json
148     responses:
149       "201":
150         description: Library added
151         schema:
152           $ref: "../swagger.yaml#/definitions/library"
153       "400":
154         description: Bad request
155         schema:
156           $ref: "../swagger.yaml#/definitions/error"
157       "401":
158         description: Authentication required
159         schema:
160           $ref: "../swagger.yaml#/definitions/error"
161       "403":
162         description: Access forbidden
163         schema:
164           $ref: "../swagger.yaml#/definitions/error"
165       "409":
166         description: Conflict in creating resource
167         schema:
168           $ref: "../swagger.yaml#/definitions/error"
169       "500":
170         description: |
171           Internal server error. Possible `error_code` attribute values:
172
173           * `internal_server_error`
174         schema:
175           $ref: "../swagger.yaml#/definitions/error"
176       "503":
177         description: Under maintenance
178         schema:
179           $ref: "../swagger.yaml#/definitions/error"
180     x-koha-authorization:
181       permissions:
182         parameters: manage_libraries
183 "/libraries/{library_id}":
184   get:
185     x-mojo-to: Libraries#get
186     operationId: getLibrary
187     tags:
188       - libraries
189     summary: Get library
190     parameters:
191       - $ref: "../swagger.yaml#/parameters/library_id_pp"
192       - name: x-koha-embed
193         in: header
194         required: false
195         description: Embed list sent as a request header
196         type: array
197         items:
198           type: string
199           enum:
200             - cash_registers
201             - desks
202             - smtp_server
203             - library_hours
204         collectionFormat: csv
205     produces:
206       - application/json
207     responses:
208       "200":
209         description: A library
210         schema:
211           $ref: "../swagger.yaml#/definitions/library"
212       "404":
213         description: Library not found
214         schema:
215           $ref: "../swagger.yaml#/definitions/error"
216     x-koha-authorization:
217       permissions:
218         catalogue: "1"
219   put:
220     x-mojo-to: Libraries#update
221     operationId: updateLibrary
222     tags:
223       - libraries
224     summary: Update library
225     parameters:
226       - $ref: "../swagger.yaml#/parameters/library_id_pp"
227       - name: body
228         in: body
229         description: A JSON object containing information on the library
230         required: true
231         schema:
232           $ref: "../swagger.yaml#/definitions/library"
233     consumes:
234       - application/json
235     produces:
236       - application/json
237     responses:
238       "200":
239         description: A library
240         schema:
241           $ref: "../swagger.yaml#/definitions/library"
242       "400":
243         description: Bad request
244         schema:
245           $ref: "../swagger.yaml#/definitions/error"
246       "401":
247         description: Authentication required
248         schema:
249           $ref: "../swagger.yaml#/definitions/error"
250       "403":
251         description: Access forbidden
252         schema:
253           $ref: "../swagger.yaml#/definitions/error"
254       "404":
255         description: Library not found
256         schema:
257           $ref: "../swagger.yaml#/definitions/error"
258       "500":
259         description: |
260           Internal server error. Possible `error_code` attribute values:
261
262           * `internal_server_error`
263         schema:
264           $ref: "../swagger.yaml#/definitions/error"
265       "503":
266         description: Under maintenance
267         schema:
268           $ref: "../swagger.yaml#/definitions/error"
269     x-koha-authorization:
270       permissions:
271         parameters: manage_libraries
272   delete:
273     x-mojo-to: Libraries#delete
274     operationId: deleteLibrary
275     tags:
276       - libraries
277     summary: Delete library
278     parameters:
279       - $ref: "../swagger.yaml#/parameters/library_id_pp"
280     produces:
281       - application/json
282     responses:
283       "204":
284         description: Library deleted
285         schema:
286           type: string
287       "401":
288         description: Authentication required
289         schema:
290           $ref: "../swagger.yaml#/definitions/error"
291       "403":
292         description: Access forbidden
293         schema:
294           $ref: "../swagger.yaml#/definitions/error"
295       "404":
296         description: Library not found
297         schema:
298           $ref: "../swagger.yaml#/definitions/error"
299       "500":
300         description: |
301           Internal server error. Possible `error_code` attribute values:
302
303           * `internal_server_error`
304         schema:
305           $ref: "../swagger.yaml#/definitions/error"
306       "503":
307         description: Under maintenance
308         schema:
309           $ref: "../swagger.yaml#/definitions/error"
310     x-koha-authorization:
311       permissions:
312         parameters: manage_libraries
313 "/libraries/{library_id}/desks":
314   get:
315     x-mojo-to: Libraries#list_desks
316     operationId: listLibraryDesks
317     tags:
318       - desks
319     summary: List the library's desks
320     parameters:
321       - $ref: "../swagger.yaml#/parameters/match"
322       - $ref: "../swagger.yaml#/parameters/order_by"
323       - $ref: "../swagger.yaml#/parameters/page"
324       - $ref: "../swagger.yaml#/parameters/per_page"
325       - $ref: "../swagger.yaml#/parameters/q_param"
326       - $ref: "../swagger.yaml#/parameters/q_body"
327       - $ref: "../swagger.yaml#/parameters/request_id_header"
328     produces:
329       - application/json
330     responses:
331       200:
332         description: A list of desks for the library
333         schema:
334           type: array
335           items:
336             $ref: "../swagger.yaml#/definitions/desk"
337       404:
338         description: Resource not found
339         schema:
340           $ref: "../swagger.yaml#/definitions/error"
341       500:
342         description: |
343           Internal server error. Possible `error_code` attribute values:
344
345           * `internal_server_error`
346         schema:
347           $ref: "../swagger.yaml#/definitions/error"
348       503:
349         description: Under maintenance
350         schema:
351           $ref: "../swagger.yaml#/definitions/error"
352     x-koha-authorization:
353       permissions:
354         catalogue: 1
355 "/libraries/{library_id}/cash_registers":
356   get:
357     x-mojo-to: Libraries#list_cash_registers
358     operationId: listLibraryCashRegisters
359     tags:
360       - cash_registers
361     summary: List the library's cash registers
362     parameters:
363       - $ref: "../swagger.yaml#/parameters/match"
364       - $ref: "../swagger.yaml#/parameters/order_by"
365       - $ref: "../swagger.yaml#/parameters/page"
366       - $ref: "../swagger.yaml#/parameters/per_page"
367       - $ref: "../swagger.yaml#/parameters/q_param"
368       - $ref: "../swagger.yaml#/parameters/q_body"
369       - $ref: "../swagger.yaml#/parameters/request_id_header"
370     produces:
371       - application/json
372     responses:
373       200:
374         description: A list of desks for the library
375         schema:
376           type: array
377           items:
378             $ref: "../swagger.yaml#/definitions/cash_register"
379       404:
380         description: Resource not found
381         schema:
382           $ref: "../swagger.yaml#/definitions/error"
383       500:
384         description: |
385           Internal server error. Possible `error_code` attribute values:
386
387           * `internal_server_error`
388         schema:
389           $ref: "../swagger.yaml#/definitions/error"
390       503:
391         description: Under maintenance
392         schema:
393           $ref: "../swagger.yaml#/definitions/error"
394     x-koha-authorization:
395       permissions:
396         catalogue: 1
397 /public/libraries:
398   get:
399     x-mojo-to: Libraries#list
400     operationId: listLibrariesPublic
401     tags:
402       - libraries
403     summary: List libraries
404     parameters:
405       - $ref: "../swagger.yaml#/parameters/match"
406       - $ref: "../swagger.yaml#/parameters/order_by"
407       - $ref: "../swagger.yaml#/parameters/page"
408       - $ref: "../swagger.yaml#/parameters/per_page"
409       - $ref: "../swagger.yaml#/parameters/q_param"
410       - $ref: "../swagger.yaml#/parameters/q_body"
411       - $ref: "../swagger.yaml#/parameters/request_id_header"
412     produces:
413       - application/json
414     responses:
415       "200":
416         description: A list of libraries
417         schema:
418           type: array
419           items:
420             $ref: "../swagger.yaml#/definitions/library"
421       "500":
422         description: |
423           Internal server error. Possible `error_code` attribute values:
424
425           * `internal_server_error`
426         schema:
427           $ref: "../swagger.yaml#/definitions/error"
428       "503":
429         description: Under maintenance
430         schema:
431           $ref: "../swagger.yaml#/definitions/error"
432 "/public/libraries/{library_id}":
433   get:
434     x-mojo-to: Libraries#get
435     operationId: getLibraryPublic
436     tags:
437       - libraries
438     summary: Get library (public)
439     parameters:
440       - $ref: "../swagger.yaml#/parameters/library_id_pp"
441     produces:
442       - application/json
443     responses:
444       "200":
445         description: A library
446       "401":
447         description: Authentication required
448         schema:
449           $ref: "../swagger.yaml#/definitions/error"
450       "403":
451         description: Access forbidden
452         schema:
453           $ref: "../swagger.yaml#/definitions/error"
454       "404":
455         description: Library not found
456         schema:
457           $ref: "../swagger.yaml#/definitions/error"
458       "406":
459         description: Not acceptable
460         schema:
461           type: array
462           description: Accepted content-types
463           items:
464             type: string
465       "500":
466         description: |
467           Internal server error. Possible `error_code` attribute values:
468
469           * `internal_server_error`
470         schema:
471           $ref: "../swagger.yaml#/definitions/error"
472       "503":
473         description: Under maintenance
474         schema:
475           $ref: "../swagger.yaml#/definitions/error"