Bug 16497: (follow-up) Adapt to existing guidelines and RFC
[koha.git] / api / v1 / swagger / paths / libraries.json
1 {
2   "/libraries": {
3     "get": {
4       "x-mojo-to": "Library#list",
5       "operationId": "listLibrary",
6       "tags": [
7         "library"
8       ],
9       "parameters": [
10         {
11           "name": "name",
12           "in": "query",
13           "description": "Case insensitive 'starts-with' search on name",
14           "required": false,
15           "type": "string"
16         },
17         {
18           "name": "address1",
19           "in": "query",
20           "description": "Case insensitive 'starts-with' search on address1",
21           "required": false,
22           "type": "string"
23         },
24         {
25           "name": "address2",
26           "in": "query",
27           "description": "Case insensitive 'starts-with' search on address2",
28           "required": false,
29           "type": "string"
30         },
31         {
32           "name": "address3",
33           "in": "query",
34           "description": "Case insensitive 'starts-with' search on address3",
35           "required": false,
36           "type": "string"
37         },
38         {
39           "name": "postal_code",
40           "in": "query",
41           "description": "Case insensitive 'starts-with' search on postal code",
42           "required": false,
43           "type": "string"
44         },
45         {
46           "name": "city",
47           "in": "query",
48           "description": "Case insensitive 'starts-with' search on city",
49           "required": false,
50           "type": "string"
51         },
52         {
53           "name": "state",
54           "in": "query",
55           "description": "Case insensitive 'starts-with' search on state",
56           "required": false,
57           "type": "string"
58         },
59         {
60           "name": "country",
61           "in": "query",
62           "description": "Case insensitive 'starts_with' search on country",
63           "required": false,
64           "type": "string"
65         },
66         {
67           "name": "phone",
68           "in": "query",
69           "description": "Case insensitive 'starts_with' search on phone number",
70           "required": false,
71           "type": "string"
72         },
73         {
74           "name": "fax",
75           "in": "query",
76           "description": "Case insensitive 'starts_with' search on fax number",
77           "required": false,
78           "type": "string"
79         },
80         {
81           "name": "email",
82           "in": "query",
83           "description": "Case insensitive 'starts_with' search on email address",
84           "required": false,
85           "type": "string"
86         },
87         {
88           "name": "reply_to_email",
89           "in": "query",
90           "description": "Case insensitive 'starts_with' search on Reply-To email address",
91           "required": false,
92           "type": "string"
93         },
94         {
95           "name": "return_path_email",
96           "in": "query",
97           "description": "Case insensitive 'starts_with' search on Return-Path email address",
98           "required": false,
99           "type": "string"
100         },
101         {
102           "name": "url",
103           "in": "query",
104           "description": "Case insensitive 'starts_with' search on website URL",
105           "required": false,
106           "type": "string"
107         },
108         {
109           "name": "ip",
110           "in": "query",
111           "description": "Case insensitive 'starts_with' search on IP address",
112           "required": false,
113           "type": "string"
114         },
115         {
116           "name": "notes",
117           "in": "query",
118           "description": "Case insensitive 'starts_with' search on notes",
119           "required": false,
120           "type": "string"
121         },
122         {
123           "name": "opac_info",
124           "in": "query",
125           "description": "Case insensitive 'starts-with' search on OPAC info",
126           "required": false,
127           "type": "string"
128         }
129       ],
130       "produces": [
131         "application/json"
132       ],
133       "responses": {
134         "200": {
135           "description": "A list of libraries",
136           "schema": {
137             "type": "array",
138             "items": {
139               "$ref": "../definitions.json#/library"
140             }
141           }
142         },
143         "500": {
144           "description": "Internal error",
145           "schema": {
146             "$ref": "../definitions.json#/error"
147           }
148         },
149         "503": {
150           "description": "Under maintenance",
151           "schema": {
152             "$ref": "../definitions.json#/error"
153           }
154         }
155       }
156     },
157     "post": {
158       "x-mojo-to": "Library#add",
159       "operationId": "addLibrary",
160       "tags": [
161         "library"
162       ],
163       "parameters": [
164         {
165           "name": "body",
166           "in": "body",
167           "description": "A JSON object containing informations about the new library",
168           "required": true,
169           "schema": {
170             "$ref": "../definitions.json#/library"
171           }
172         }
173       ],
174       "produces": [
175         "application/json"
176       ],
177       "responses": {
178         "201": {
179           "description": "Library added",
180           "schema": {
181             "$ref": "../definitions.json#/library"
182           }
183         },
184         "400": {
185           "description": "Bad request",
186           "schema": {
187             "$ref": "../definitions.json#/error"
188           }
189         },
190         "401": {
191           "description": "Authentication required",
192           "schema": {
193             "$ref": "../definitions.json#/error"
194           }
195         },
196         "403": {
197           "description": "Access forbidden",
198           "schema": {
199             "$ref": "../definitions.json#/error"
200           }
201         },
202         "409": {
203           "description": "Conflict in creating resource",
204           "schema": {
205             "$ref": "../definitions.json#/error"
206           }
207         },
208         "500": {
209           "description": "Internal error",
210           "schema": {
211             "$ref": "../definitions.json#/error"
212           }
213         },
214         "503": {
215           "description": "Under maintenance",
216           "schema": {
217             "$ref": "../definitions.json#/error"
218           }
219         }
220       },
221       "x-koha-authorization": {
222         "permissions": {
223           "parameters": "manage_libraries"
224         }
225       }
226     }
227   },
228   "/libraries/{library_id}": {
229     "get": {
230       "x-mojo-to": "Library#get",
231       "operationId": "getLibrary",
232       "tags": [
233         "library"
234       ],
235       "parameters": [
236         {
237           "$ref": "../parameters.json#/library_id_pp"
238         }
239       ],
240       "produces": [
241         "application/json"
242       ],
243       "responses": {
244         "200": {
245           "description": "A library",
246           "schema": {
247             "$ref": "../definitions.json#/library"
248           }
249         },
250         "404": {
251           "description": "Library not found",
252           "schema": {
253             "$ref": "../definitions.json#/error"
254           }
255         }
256       }
257     },
258     "put": {
259       "x-mojo-to": "Library#update",
260       "operationId": "updateLibrary",
261       "tags": [
262         "library"
263       ],
264       "parameters": [
265         {
266           "$ref": "../parameters.json#/library_id_pp"
267         },
268         {
269           "name": "body",
270           "in": "body",
271           "description": "A JSON object containing information on the library",
272           "required": true,
273           "schema": {
274             "$ref": "../definitions.json#/library"
275           }
276         }
277       ],
278       "consumes": [
279         "application/json"
280       ],
281       "produces": [
282         "application/json"
283       ],
284       "responses": {
285         "200": {
286           "description": "A library",
287           "schema": {
288             "$ref": "../definitions.json#/library"
289           }
290         },
291         "400": {
292           "description": "Bad request",
293           "schema": {
294             "$ref": "../definitions.json#/error"
295           }
296         },
297         "401": {
298           "description": "Authentication required",
299           "schema": {
300             "$ref": "../definitions.json#/error"
301           }
302         },
303         "403": {
304           "description": "Access forbidden",
305           "schema": {
306             "$ref": "../definitions.json#/error"
307           }
308         },
309         "404": {
310           "description": "Library not found",
311           "schema": {
312             "$ref": "../definitions.json#/error"
313           }
314         },
315         "500": {
316           "description": "Internal error",
317           "schema": {
318             "$ref": "../definitions.json#/error"
319           }
320         },
321         "503": {
322           "description": "Under maintenance",
323           "schema": {
324             "$ref": "../definitions.json#/error"
325           }
326         }
327       },
328       "x-koha-authorization": {
329         "permissions": {
330           "parameters": "manage_libraries"
331         }
332       }
333     },
334     "delete": {
335       "x-mojo-to": "Library#delete",
336       "operationId": "deleteLibrary",
337       "tags": [
338         "library"
339       ],
340       "parameters": [
341         {
342           "$ref": "../parameters.json#/library_id_pp"
343         }
344       ],
345       "produces": [
346         "application/json"
347       ],
348       "responses": {
349         "204": {
350           "description": "Library deleted",
351           "schema": {
352             "type": "string"
353           }
354         },
355         "401": {
356           "description": "Authentication required",
357           "schema": {
358             "$ref": "../definitions.json#/error"
359           }
360         },
361         "403": {
362           "description": "Access forbidden",
363           "schema": {
364             "$ref": "../definitions.json#/error"
365           }
366         },
367         "404": {
368           "description": "Library not found",
369           "schema": {
370             "$ref": "../definitions.json#/error"
371           }
372         },
373         "500": {
374           "description": "Internal error",
375           "schema": {
376             "$ref": "../definitions.json#/error"
377           }
378         },
379         "503": {
380           "description": "Under maintenance",
381           "schema": {
382             "$ref": "../definitions.json#/error"
383           }
384         }
385       },
386       "x-koha-authorization": {
387         "permissions": {
388           "parameters": "manage_libraries"
389         }
390       }
391     }
392   }
393 }