Bug 30394: Add x-koha-request-id support on API routes
[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       - name: opac_info
91         in: query
92         description: Case insensitive 'starts-with' search on OPAC info
93         required: false
94         type: string
95       - $ref: "../swagger.yaml#/parameters/match"
96       - $ref: "../swagger.yaml#/parameters/order_by"
97       - $ref: "../swagger.yaml#/parameters/page"
98       - $ref: "../swagger.yaml#/parameters/per_page"
99       - $ref: "../swagger.yaml#/parameters/q_param"
100       - $ref: "../swagger.yaml#/parameters/q_body"
101       - $ref: "../swagger.yaml#/parameters/q_header"
102       - $ref: "../swagger.yaml#/parameters/request_id_header"
103     produces:
104       - application/json
105     responses:
106       "200":
107         description: A list of libraries
108         schema:
109           type: array
110           items:
111             $ref: "../swagger.yaml#/definitions/library"
112       "500":
113         description: |
114           Internal server error. Possible `error_code` attribute values:
115
116           * `internal_server_error`
117         schema:
118           $ref: "../swagger.yaml#/definitions/error"
119       "503":
120         description: Under maintenance
121         schema:
122           $ref: "../swagger.yaml#/definitions/error"
123     x-koha-authorization:
124       permissions:
125         catalogue: "1"
126     x-koha-embed:
127       - smtp_server
128   post:
129     x-mojo-to: Libraries#add
130     operationId: addLibrary
131     tags:
132       - libraries
133     summary: Add library
134     parameters:
135       - name: body
136         in: body
137         description: A JSON object containing informations about the new library
138         required: true
139         schema:
140           $ref: "../swagger.yaml#/definitions/library"
141     produces:
142       - application/json
143     responses:
144       "201":
145         description: Library added
146         schema:
147           $ref: "../swagger.yaml#/definitions/library"
148       "400":
149         description: Bad request
150         schema:
151           $ref: "../swagger.yaml#/definitions/error"
152       "401":
153         description: Authentication required
154         schema:
155           $ref: "../swagger.yaml#/definitions/error"
156       "403":
157         description: Access forbidden
158         schema:
159           $ref: "../swagger.yaml#/definitions/error"
160       "409":
161         description: Conflict in creating resource
162         schema:
163           $ref: "../swagger.yaml#/definitions/error"
164       "500":
165         description: |
166           Internal server error. Possible `error_code` attribute values:
167
168           * `internal_server_error`
169         schema:
170           $ref: "../swagger.yaml#/definitions/error"
171       "503":
172         description: Under maintenance
173         schema:
174           $ref: "../swagger.yaml#/definitions/error"
175     x-koha-authorization:
176       permissions:
177         parameters: manage_libraries
178 "/libraries/{library_id}":
179   get:
180     x-mojo-to: Libraries#get
181     operationId: getLibrary
182     tags:
183       - libraries
184     summary: Get library
185     parameters:
186       - $ref: "../swagger.yaml#/parameters/library_id_pp"
187     produces:
188       - application/json
189     responses:
190       "200":
191         description: A library
192         schema:
193           $ref: "../swagger.yaml#/definitions/library"
194       "404":
195         description: Library not found
196         schema:
197           $ref: "../swagger.yaml#/definitions/error"
198     x-koha-authorization:
199       permissions:
200         catalogue: "1"
201     x-koha-embed:
202       - smtp_server
203   put:
204     x-mojo-to: Libraries#update
205     operationId: updateLibrary
206     tags:
207       - libraries
208     summary: Update library
209     parameters:
210       - $ref: "../swagger.yaml#/parameters/library_id_pp"
211       - name: body
212         in: body
213         description: A JSON object containing information on the library
214         required: true
215         schema:
216           $ref: "../swagger.yaml#/definitions/library"
217     consumes:
218       - application/json
219     produces:
220       - application/json
221     responses:
222       "200":
223         description: A library
224         schema:
225           $ref: "../swagger.yaml#/definitions/library"
226       "400":
227         description: Bad request
228         schema:
229           $ref: "../swagger.yaml#/definitions/error"
230       "401":
231         description: Authentication required
232         schema:
233           $ref: "../swagger.yaml#/definitions/error"
234       "403":
235         description: Access forbidden
236         schema:
237           $ref: "../swagger.yaml#/definitions/error"
238       "404":
239         description: Library not found
240         schema:
241           $ref: "../swagger.yaml#/definitions/error"
242       "500":
243         description: |
244           Internal server error. Possible `error_code` attribute values:
245
246           * `internal_server_error`
247         schema:
248           $ref: "../swagger.yaml#/definitions/error"
249       "503":
250         description: Under maintenance
251         schema:
252           $ref: "../swagger.yaml#/definitions/error"
253     x-koha-authorization:
254       permissions:
255         parameters: manage_libraries
256   delete:
257     x-mojo-to: Libraries#delete
258     operationId: deleteLibrary
259     tags:
260       - libraries
261     summary: Delete library
262     parameters:
263       - $ref: "../swagger.yaml#/parameters/library_id_pp"
264     produces:
265       - application/json
266     responses:
267       "204":
268         description: Library deleted
269         schema:
270           type: string
271       "401":
272         description: Authentication required
273         schema:
274           $ref: "../swagger.yaml#/definitions/error"
275       "403":
276         description: Access forbidden
277         schema:
278           $ref: "../swagger.yaml#/definitions/error"
279       "404":
280         description: Library not found
281         schema:
282           $ref: "../swagger.yaml#/definitions/error"
283       "500":
284         description: |
285           Internal server error. Possible `error_code` attribute values:
286
287           * `internal_server_error`
288         schema:
289           $ref: "../swagger.yaml#/definitions/error"
290       "503":
291         description: Under maintenance
292         schema:
293           $ref: "../swagger.yaml#/definitions/error"
294     x-koha-authorization:
295       permissions:
296         parameters: manage_libraries
297 /public/libraries:
298   get:
299     x-mojo-to: Libraries#list
300     operationId: listLibrariesPublic
301     tags:
302       - libraries
303     summary: List libraries
304     parameters:
305       - $ref: "../swagger.yaml#/parameters/match"
306       - $ref: "../swagger.yaml#/parameters/order_by"
307       - $ref: "../swagger.yaml#/parameters/page"
308       - $ref: "../swagger.yaml#/parameters/per_page"
309       - $ref: "../swagger.yaml#/parameters/q_param"
310       - $ref: "../swagger.yaml#/parameters/q_body"
311       - $ref: "../swagger.yaml#/parameters/q_header"
312       - $ref: "../swagger.yaml#/parameters/request_id_header"
313     produces:
314       - application/json
315     responses:
316       "200":
317         description: A list of libraries
318         schema:
319           type: array
320           items:
321             $ref: "../swagger.yaml#/definitions/library"
322       "500":
323         description: |
324           Internal server error. Possible `error_code` attribute values:
325
326           * `internal_server_error`
327         schema:
328           $ref: "../swagger.yaml#/definitions/error"
329       "503":
330         description: Under maintenance
331         schema:
332           $ref: "../swagger.yaml#/definitions/error"
333 "/public/libraries/{library_id}":
334   get:
335     x-mojo-to: Libraries#get
336     operationId: getLibraryPublic
337     tags:
338       - libraries
339     summary: Get library (public)
340     parameters:
341       - $ref: "../swagger.yaml#/parameters/library_id_pp"
342     produces:
343       - application/json
344     responses:
345       "200":
346         description: A library
347       "401":
348         description: Authentication required
349         schema:
350           $ref: "../swagger.yaml#/definitions/error"
351       "403":
352         description: Access forbidden
353         schema:
354           $ref: "../swagger.yaml#/definitions/error"
355       "404":
356         description: Library not found
357         schema:
358           $ref: "../swagger.yaml#/definitions/error"
359       "406":
360         description: Not acceptable
361         schema:
362           type: array
363           description: Accepted content-types
364           items:
365             type: string
366       "500":
367         description: |
368           Internal server error. Possible `error_code` attribute values:
369
370           * `internal_server_error`
371         schema:
372           $ref: "../swagger.yaml#/definitions/error"
373       "503":
374         description: Under maintenance
375         schema:
376           $ref: "../swagger.yaml#/definitions/error"