Bug 28948: Add GET /public/libraries routes
[koha.git] / api / v1 / swagger / paths / libraries.json
1 {
2   "/libraries": {
3     "get": {
4       "x-mojo-to": "Libraries#list",
5       "operationId": "listLibraries",
6       "tags": [
7         "library"
8       ],
9       "summary": "List libraries",
10       "parameters": [
11         {
12           "name": "name",
13           "in": "query",
14           "description": "Case insensitive 'starts-with' search on name",
15           "required": false,
16           "type": "string"
17         },
18         {
19           "name": "address1",
20           "in": "query",
21           "description": "Case insensitive 'starts-with' search on address1",
22           "required": false,
23           "type": "string"
24         },
25         {
26           "name": "address2",
27           "in": "query",
28           "description": "Case insensitive 'starts-with' search on address2",
29           "required": false,
30           "type": "string"
31         },
32         {
33           "name": "address3",
34           "in": "query",
35           "description": "Case insensitive 'starts-with' search on address3",
36           "required": false,
37           "type": "string"
38         },
39         {
40           "name": "postal_code",
41           "in": "query",
42           "description": "Case insensitive 'starts-with' search on postal code",
43           "required": false,
44           "type": "string"
45         },
46         {
47           "name": "city",
48           "in": "query",
49           "description": "Case insensitive 'starts-with' search on city",
50           "required": false,
51           "type": "string"
52         },
53         {
54           "name": "state",
55           "in": "query",
56           "description": "Case insensitive 'starts-with' search on state",
57           "required": false,
58           "type": "string"
59         },
60         {
61           "name": "country",
62           "in": "query",
63           "description": "Case insensitive 'starts_with' search on country",
64           "required": false,
65           "type": "string"
66         },
67         {
68           "name": "phone",
69           "in": "query",
70           "description": "Case insensitive 'starts_with' search on phone number",
71           "required": false,
72           "type": "string"
73         },
74         {
75           "name": "fax",
76           "in": "query",
77           "description": "Case insensitive 'starts_with' search on fax number",
78           "required": false,
79           "type": "string"
80         },
81         {
82           "name": "email",
83           "in": "query",
84           "description": "Case insensitive 'starts_with' search on email address",
85           "required": false,
86           "type": "string"
87         },
88         {
89           "name": "reply_to_email",
90           "in": "query",
91           "description": "Case insensitive 'starts_with' search on Reply-To email address",
92           "required": false,
93           "type": "string"
94         },
95         {
96           "name": "return_path_email",
97           "in": "query",
98           "description": "Case insensitive 'starts_with' search on Return-Path email address",
99           "required": false,
100           "type": "string"
101         },
102         {
103           "name": "url",
104           "in": "query",
105           "description": "Case insensitive 'starts_with' search on website URL",
106           "required": false,
107           "type": "string"
108         },
109         {
110           "name": "ip",
111           "in": "query",
112           "description": "Case insensitive 'starts_with' search on IP address",
113           "required": false,
114           "type": "string"
115         },
116         {
117           "name": "notes",
118           "in": "query",
119           "description": "Case insensitive 'starts_with' search on notes",
120           "required": false,
121           "type": "string"
122         },
123         {
124           "name": "opac_info",
125           "in": "query",
126           "description": "Case insensitive 'starts-with' search on OPAC info",
127           "required": false,
128           "type": "string"
129         },
130         {
131           "$ref": "../parameters.json#/match"
132         },
133         {
134           "$ref": "../parameters.json#/order_by"
135         },
136         {
137           "$ref": "../parameters.json#/page"
138         },
139         {
140           "$ref": "../parameters.json#/per_page"
141         },
142         {
143           "$ref": "../parameters.json#/q_param"
144         },
145         {
146           "$ref": "../parameters.json#/q_body"
147         },
148         {
149           "$ref": "../parameters.json#/q_header"
150         }
151       ],
152       "produces": [
153         "application/json"
154       ],
155       "responses": {
156         "200": {
157           "description": "A list of libraries",
158           "schema": {
159             "type": "array",
160             "items": {
161               "$ref": "../definitions.json#/library"
162             }
163           }
164         },
165         "500": {
166           "description": "Internal error",
167           "schema": {
168             "$ref": "../definitions.json#/error"
169           }
170         },
171         "503": {
172           "description": "Under maintenance",
173           "schema": {
174             "$ref": "../definitions.json#/error"
175           }
176         }
177       },
178       "x-koha-authorization": {
179         "permissions": {
180           "catalogue": "1"
181         }
182       },
183       "x-koha-embed": [
184         "smtp_server"
185       ]
186     },
187     "post": {
188       "x-mojo-to": "Libraries#add",
189       "operationId": "addLibrary",
190       "tags": [
191         "library"
192       ],
193       "summary": "Add library",
194       "parameters": [
195         {
196           "name": "body",
197           "in": "body",
198           "description": "A JSON object containing informations about the new library",
199           "required": true,
200           "schema": {
201             "$ref": "../definitions.json#/library"
202           }
203         }
204       ],
205       "produces": [
206         "application/json"
207       ],
208       "responses": {
209         "201": {
210           "description": "Library added",
211           "schema": {
212             "$ref": "../definitions.json#/library"
213           }
214         },
215         "400": {
216           "description": "Bad request",
217           "schema": {
218             "$ref": "../definitions.json#/error"
219           }
220         },
221         "401": {
222           "description": "Authentication required",
223           "schema": {
224             "$ref": "../definitions.json#/error"
225           }
226         },
227         "403": {
228           "description": "Access forbidden",
229           "schema": {
230             "$ref": "../definitions.json#/error"
231           }
232         },
233         "409": {
234           "description": "Conflict in creating resource",
235           "schema": {
236             "$ref": "../definitions.json#/error"
237           }
238         },
239         "500": {
240           "description": "Internal error",
241           "schema": {
242             "$ref": "../definitions.json#/error"
243           }
244         },
245         "503": {
246           "description": "Under maintenance",
247           "schema": {
248             "$ref": "../definitions.json#/error"
249           }
250         }
251       },
252       "x-koha-authorization": {
253         "permissions": {
254           "parameters": "manage_libraries"
255         }
256       }
257     }
258   },
259   "/libraries/{library_id}": {
260     "get": {
261       "x-mojo-to": "Libraries#get",
262       "operationId": "getLibrary",
263       "tags": [
264         "library"
265       ],
266       "summary": "Get library",
267       "parameters": [
268         {
269           "$ref": "../parameters.json#/library_id_pp"
270         }
271       ],
272       "produces": [
273         "application/json"
274       ],
275       "responses": {
276         "200": {
277           "description": "A library",
278           "schema": {
279             "$ref": "../definitions.json#/library"
280           }
281         },
282         "404": {
283           "description": "Library not found",
284           "schema": {
285             "$ref": "../definitions.json#/error"
286           }
287         }
288       },
289       "x-koha-authorization": {
290         "permissions": {
291           "catalogue": "1"
292         }
293       },
294       "x-koha-embed": [
295         "smtp_server"
296       ]
297     },
298     "put": {
299       "x-mojo-to": "Libraries#update",
300       "operationId": "updateLibrary",
301       "tags": [
302         "library"
303       ],
304       "summary": "Update library",
305       "parameters": [
306         {
307           "$ref": "../parameters.json#/library_id_pp"
308         },
309         {
310           "name": "body",
311           "in": "body",
312           "description": "A JSON object containing information on the library",
313           "required": true,
314           "schema": {
315             "$ref": "../definitions.json#/library"
316           }
317         }
318       ],
319       "consumes": [
320         "application/json"
321       ],
322       "produces": [
323         "application/json"
324       ],
325       "responses": {
326         "200": {
327           "description": "A library",
328           "schema": {
329             "$ref": "../definitions.json#/library"
330           }
331         },
332         "400": {
333           "description": "Bad request",
334           "schema": {
335             "$ref": "../definitions.json#/error"
336           }
337         },
338         "401": {
339           "description": "Authentication required",
340           "schema": {
341             "$ref": "../definitions.json#/error"
342           }
343         },
344         "403": {
345           "description": "Access forbidden",
346           "schema": {
347             "$ref": "../definitions.json#/error"
348           }
349         },
350         "404": {
351           "description": "Library not found",
352           "schema": {
353             "$ref": "../definitions.json#/error"
354           }
355         },
356         "500": {
357           "description": "Internal error",
358           "schema": {
359             "$ref": "../definitions.json#/error"
360           }
361         },
362         "503": {
363           "description": "Under maintenance",
364           "schema": {
365             "$ref": "../definitions.json#/error"
366           }
367         }
368       },
369       "x-koha-authorization": {
370         "permissions": {
371           "parameters": "manage_libraries"
372         }
373       }
374     },
375     "delete": {
376       "x-mojo-to": "Libraries#delete",
377       "operationId": "deleteLibrary",
378       "tags": [
379         "library"
380       ],
381       "summary": "Delete library",
382       "parameters": [
383         {
384           "$ref": "../parameters.json#/library_id_pp"
385         }
386       ],
387       "produces": [
388         "application/json"
389       ],
390       "responses": {
391         "204": {
392           "description": "Library deleted",
393           "schema": {
394             "type": "string"
395           }
396         },
397         "401": {
398           "description": "Authentication required",
399           "schema": {
400             "$ref": "../definitions.json#/error"
401           }
402         },
403         "403": {
404           "description": "Access forbidden",
405           "schema": {
406             "$ref": "../definitions.json#/error"
407           }
408         },
409         "404": {
410           "description": "Library not found",
411           "schema": {
412             "$ref": "../definitions.json#/error"
413           }
414         },
415         "500": {
416           "description": "Internal error",
417           "schema": {
418             "$ref": "../definitions.json#/error"
419           }
420         },
421         "503": {
422           "description": "Under maintenance",
423           "schema": {
424             "$ref": "../definitions.json#/error"
425           }
426         }
427       },
428       "x-koha-authorization": {
429         "permissions": {
430           "parameters": "manage_libraries"
431         }
432       }
433     }
434   },
435   "/public/libraries": {
436     "get": {
437       "x-mojo-to": "Libraries#list",
438       "operationId": "listLibrariesPublic",
439       "tags": [
440         "library"
441       ],
442       "summary": "List libraries",
443       "parameters": [
444         {
445           "name": "name",
446           "in": "query",
447           "description": "Case insensitive 'starts-with' search on name",
448           "required": false,
449           "type": "string"
450         },
451         {
452           "name": "address1",
453           "in": "query",
454           "description": "Case insensitive 'starts-with' search on address1",
455           "required": false,
456           "type": "string"
457         },
458         {
459           "name": "address2",
460           "in": "query",
461           "description": "Case insensitive 'starts-with' search on address2",
462           "required": false,
463           "type": "string"
464         },
465         {
466           "name": "address3",
467           "in": "query",
468           "description": "Case insensitive 'starts-with' search on address3",
469           "required": false,
470           "type": "string"
471         },
472         {
473           "name": "postal_code",
474           "in": "query",
475           "description": "Case insensitive 'starts-with' search on postal code",
476           "required": false,
477           "type": "string"
478         },
479         {
480           "name": "city",
481           "in": "query",
482           "description": "Case insensitive 'starts-with' search on city",
483           "required": false,
484           "type": "string"
485         },
486         {
487           "name": "state",
488           "in": "query",
489           "description": "Case insensitive 'starts-with' search on state",
490           "required": false,
491           "type": "string"
492         },
493         {
494           "name": "country",
495           "in": "query",
496           "description": "Case insensitive 'starts_with' search on country",
497           "required": false,
498           "type": "string"
499         },
500         {
501           "name": "phone",
502           "in": "query",
503           "description": "Case insensitive 'starts_with' search on phone number",
504           "required": false,
505           "type": "string"
506         },
507         {
508           "name": "fax",
509           "in": "query",
510           "description": "Case insensitive 'starts_with' search on fax number",
511           "required": false,
512           "type": "string"
513         },
514         {
515           "name": "email",
516           "in": "query",
517           "description": "Case insensitive 'starts_with' search on email address",
518           "required": false,
519           "type": "string"
520         },
521         {
522           "name": "reply_to_email",
523           "in": "query",
524           "description": "Case insensitive 'starts_with' search on Reply-To email address",
525           "required": false,
526           "type": "string"
527         },
528         {
529           "name": "return_path_email",
530           "in": "query",
531           "description": "Case insensitive 'starts_with' search on Return-Path email address",
532           "required": false,
533           "type": "string"
534         },
535         {
536           "name": "url",
537           "in": "query",
538           "description": "Case insensitive 'starts_with' search on website URL",
539           "required": false,
540           "type": "string"
541         },
542         {
543           "name": "ip",
544           "in": "query",
545           "description": "Case insensitive 'starts_with' search on IP address",
546           "required": false,
547           "type": "string"
548         },
549         {
550           "name": "notes",
551           "in": "query",
552           "description": "Case insensitive 'starts_with' search on notes",
553           "required": false,
554           "type": "string"
555         },
556         {
557           "name": "opac_info",
558           "in": "query",
559           "description": "Case insensitive 'starts-with' search on OPAC info",
560           "required": false,
561           "type": "string"
562         },
563         {
564           "$ref": "../parameters.json#/match"
565         },
566         {
567           "$ref": "../parameters.json#/order_by"
568         },
569         {
570           "$ref": "../parameters.json#/page"
571         },
572         {
573           "$ref": "../parameters.json#/per_page"
574         },
575         {
576           "$ref": "../parameters.json#/q_param"
577         },
578         {
579           "$ref": "../parameters.json#/q_body"
580         },
581         {
582           "$ref": "../parameters.json#/q_header"
583         }
584       ],
585       "produces": [
586         "application/json"
587       ],
588       "responses": {
589         "200": {
590           "description": "A list of libraries",
591           "schema": {
592             "type": "array",
593             "items": {
594               "$ref": "../definitions.json#/library"
595             }
596           }
597         },
598         "500": {
599           "description": "Internal error",
600           "schema": {
601             "$ref": "../definitions.json#/error"
602           }
603         },
604         "503": {
605           "description": "Under maintenance",
606           "schema": {
607             "$ref": "../definitions.json#/error"
608           }
609         }
610       },
611       "x-koha-authorization": {
612         "permissions": {
613           "catalogue": "1"
614         }
615       },
616       "x-koha-embed": [
617         "smtp_server"
618       ]
619     }
620   },
621   "/public/libraries/{library_id}": {
622     "get": {
623       "x-mojo-to": "Libraries#get",
624       "operationId": "getLibraryPublic",
625       "tags": [
626         "libraries"
627       ],
628       "summary": "Get library (public)",
629       "parameters": [
630         {
631           "$ref": "../parameters.json#/library_id_pp"
632         }
633       ],
634       "produces": [
635         "application/json"
636       ],
637       "responses": {
638         "200": {
639           "description": "A library"
640         },
641         "401": {
642           "description": "Authentication required",
643           "schema": {
644             "$ref": "../definitions.json#/error"
645           }
646         },
647         "403": {
648           "description": "Access forbidden",
649           "schema": {
650             "$ref": "../definitions.json#/error"
651           }
652         },
653         "404": {
654           "description": "Library not found",
655           "schema": {
656             "$ref": "../definitions.json#/error"
657           }
658         },
659         "406": {
660           "description": "Not acceptable",
661           "schema": {
662             "type": "array",
663             "description": "Accepted content-types",
664             "items": {
665                 "type": "string"
666             }
667           }
668         },
669         "500": {
670           "description": "Internal server error",
671           "schema": {
672             "$ref": "../definitions.json#/error"
673           }
674         },
675         "503": {
676           "description": "Under maintenance",
677           "schema": {
678             "$ref": "../definitions.json#/error"
679           }
680         }
681       }
682     }
683   }
684 }