Bug 16497: (follow-up) GET operations require staff access
[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       "x-koha-authorization": {
157         "permissions": {
158           "catalogue": "1"
159         }
160       }
161     },
162     "post": {
163       "x-mojo-to": "Library#add",
164       "operationId": "addLibrary",
165       "tags": [
166         "library"
167       ],
168       "parameters": [
169         {
170           "name": "body",
171           "in": "body",
172           "description": "A JSON object containing informations about the new library",
173           "required": true,
174           "schema": {
175             "$ref": "../definitions.json#/library"
176           }
177         }
178       ],
179       "produces": [
180         "application/json"
181       ],
182       "responses": {
183         "201": {
184           "description": "Library added",
185           "schema": {
186             "$ref": "../definitions.json#/library"
187           }
188         },
189         "400": {
190           "description": "Bad request",
191           "schema": {
192             "$ref": "../definitions.json#/error"
193           }
194         },
195         "401": {
196           "description": "Authentication required",
197           "schema": {
198             "$ref": "../definitions.json#/error"
199           }
200         },
201         "403": {
202           "description": "Access forbidden",
203           "schema": {
204             "$ref": "../definitions.json#/error"
205           }
206         },
207         "409": {
208           "description": "Conflict in creating resource",
209           "schema": {
210             "$ref": "../definitions.json#/error"
211           }
212         },
213         "500": {
214           "description": "Internal error",
215           "schema": {
216             "$ref": "../definitions.json#/error"
217           }
218         },
219         "503": {
220           "description": "Under maintenance",
221           "schema": {
222             "$ref": "../definitions.json#/error"
223           }
224         }
225       },
226       "x-koha-authorization": {
227         "permissions": {
228           "parameters": "manage_libraries"
229         }
230       }
231     }
232   },
233   "/libraries/{library_id}": {
234     "get": {
235       "x-mojo-to": "Library#get",
236       "operationId": "getLibrary",
237       "tags": [
238         "library"
239       ],
240       "parameters": [
241         {
242           "$ref": "../parameters.json#/library_id_pp"
243         }
244       ],
245       "produces": [
246         "application/json"
247       ],
248       "responses": {
249         "200": {
250           "description": "A library",
251           "schema": {
252             "$ref": "../definitions.json#/library"
253           }
254         },
255         "404": {
256           "description": "Library not found",
257           "schema": {
258             "$ref": "../definitions.json#/error"
259           }
260         }
261       },
262       "x-koha-authorization": {
263         "permissions": {
264           "catalogue": "1"
265         }
266       }
267     },
268     "put": {
269       "x-mojo-to": "Library#update",
270       "operationId": "updateLibrary",
271       "tags": [
272         "library"
273       ],
274       "parameters": [
275         {
276           "$ref": "../parameters.json#/library_id_pp"
277         },
278         {
279           "name": "body",
280           "in": "body",
281           "description": "A JSON object containing information on the library",
282           "required": true,
283           "schema": {
284             "$ref": "../definitions.json#/library"
285           }
286         }
287       ],
288       "consumes": [
289         "application/json"
290       ],
291       "produces": [
292         "application/json"
293       ],
294       "responses": {
295         "200": {
296           "description": "A library",
297           "schema": {
298             "$ref": "../definitions.json#/library"
299           }
300         },
301         "400": {
302           "description": "Bad request",
303           "schema": {
304             "$ref": "../definitions.json#/error"
305           }
306         },
307         "401": {
308           "description": "Authentication required",
309           "schema": {
310             "$ref": "../definitions.json#/error"
311           }
312         },
313         "403": {
314           "description": "Access forbidden",
315           "schema": {
316             "$ref": "../definitions.json#/error"
317           }
318         },
319         "404": {
320           "description": "Library not found",
321           "schema": {
322             "$ref": "../definitions.json#/error"
323           }
324         },
325         "500": {
326           "description": "Internal error",
327           "schema": {
328             "$ref": "../definitions.json#/error"
329           }
330         },
331         "503": {
332           "description": "Under maintenance",
333           "schema": {
334             "$ref": "../definitions.json#/error"
335           }
336         }
337       },
338       "x-koha-authorization": {
339         "permissions": {
340           "parameters": "manage_libraries"
341         }
342       }
343     },
344     "delete": {
345       "x-mojo-to": "Library#delete",
346       "operationId": "deleteLibrary",
347       "tags": [
348         "library"
349       ],
350       "parameters": [
351         {
352           "$ref": "../parameters.json#/library_id_pp"
353         }
354       ],
355       "produces": [
356         "application/json"
357       ],
358       "responses": {
359         "204": {
360           "description": "Library deleted",
361           "schema": {
362             "type": "string"
363           }
364         },
365         "401": {
366           "description": "Authentication required",
367           "schema": {
368             "$ref": "../definitions.json#/error"
369           }
370         },
371         "403": {
372           "description": "Access forbidden",
373           "schema": {
374             "$ref": "../definitions.json#/error"
375           }
376         },
377         "404": {
378           "description": "Library not found",
379           "schema": {
380             "$ref": "../definitions.json#/error"
381           }
382         },
383         "500": {
384           "description": "Internal error",
385           "schema": {
386             "$ref": "../definitions.json#/error"
387           }
388         },
389         "503": {
390           "description": "Under maintenance",
391           "schema": {
392             "$ref": "../definitions.json#/error"
393           }
394         }
395       },
396       "x-koha-authorization": {
397         "permissions": {
398           "parameters": "manage_libraries"
399         }
400       }
401     }
402   }
403 }