Bug 22227: Make GET /cities staff only
[koha.git] / api / v1 / swagger / paths / cities.json
1 {
2   "/cities": {
3     "get": {
4       "x-mojo-to": "Cities#list",
5       "operationId": "listCities",
6       "tags": ["cities"],
7       "produces": [
8         "application/json"
9       ],
10       "parameters": [{
11         "name": "name",
12         "in": "query",
13         "description": "Case insensative search on city name",
14         "required": false,
15         "type": "string"
16       }, {
17         "name": "state",
18         "in": "query",
19         "description": "Case insensative search on city state",
20         "required": false,
21         "type": "string"
22       }, {
23         "name": "country",
24         "in": "query",
25         "description": "Case insensative search on city country",
26         "required": false,
27         "type": "string"
28       }, {
29         "name": "postal_code",
30         "in": "query",
31         "description": "Case Insensative search on city postal code",
32         "required": false,
33         "type": "string"
34       }],
35       "responses": {
36         "200": {
37           "description": "A list of cities",
38           "schema": {
39             "type": "array",
40             "items": {
41               "$ref": "../definitions.json#/city"
42             }
43           }
44         },
45         "403": {
46           "description": "Access forbidden",
47           "schema": {
48             "$ref": "../definitions.json#/error"
49           }
50         },
51         "500": {
52           "description": "Internal error",
53           "schema": {
54             "$ref": "../definitions.json#/error"
55           }
56         },
57         "503": {
58           "description": "Under maintenance",
59           "schema": {
60             "$ref": "../definitions.json#/error"
61           }
62         }
63       },
64       "x-koha-authorization": {
65         "permissions": {
66             "catalogue": "1"
67         }
68       }
69     },
70     "post": {
71       "x-mojo-to": "Cities#add",
72       "operationId": "addCity",
73       "tags": ["cities"],
74       "parameters": [{
75         "name": "body",
76         "in": "body",
77         "description": "A JSON object containing informations about the new hold",
78         "required": true,
79         "schema": {
80           "$ref": "../definitions.json#/city"
81         }
82       }],
83       "produces": [
84         "application/json"
85       ],
86       "responses": {
87         "200": {
88           "description": "City added",
89           "schema": {
90             "$ref": "../definitions.json#/city"
91           }
92         },
93         "401": {
94           "description": "Authentication required",
95           "schema": {
96             "$ref": "../definitions.json#/error"
97           }
98         },
99         "403": {
100           "description": "Access forbidden",
101           "schema": {
102             "$ref": "../definitions.json#/error"
103           }
104         },
105         "500": {
106           "description": "Internal error",
107           "schema": {
108             "$ref": "../definitions.json#/error"
109           }
110         },
111         "503": {
112           "description": "Under maintenance",
113           "schema": {
114             "$ref": "../definitions.json#/error"
115           }
116         }
117       },
118       "x-koha-authorization": {
119         "permissions": {
120           "parameters": "manage_cities"
121         }
122       }
123     }
124   },
125   "/cities/{city_id}": {
126     "get": {
127       "x-mojo-to": "Cities#get",
128       "operationId": "getCity",
129       "tags": ["cities"],
130       "parameters": [{
131         "$ref": "../parameters.json#/city_id_pp"
132       }],
133       "produces": [
134         "application/json"
135       ],
136       "responses": {
137         "200": {
138           "description": "A city",
139           "schema": {
140             "$ref": "../definitions.json#/city"
141           }
142         },
143         "404": {
144           "description": "City not found",
145           "schema": {
146             "$ref": "../definitions.json#/error"
147           }
148         },
149         "500": {
150           "description": "Internal error",
151           "schema": {
152             "$ref": "../definitions.json#/error"
153           }
154         },
155         "503": {
156           "description": "Under maintenance",
157           "schema": {
158             "$ref": "../definitions.json#/error"
159           }
160         }
161       },
162       "x-koha-authorization": {
163         "permissions": {
164             "catalogue": "1"
165         }
166       }
167     },
168     "put": {
169       "x-mojo-to": "Cities#update",
170       "operationId": "updateCity",
171       "tags": ["cities"],
172       "parameters": [{
173         "$ref": "../parameters.json#/city_id_pp"
174       }, {
175         "name": "body",
176         "in": "body",
177         "description": "A city object",
178         "required": true,
179         "schema": {
180           "$ref": "../definitions.json#/city"
181         }
182       }],
183       "produces": [
184         "application/json"
185       ],
186       "responses": {
187         "200": {
188           "description": "A city",
189           "schema": {
190             "$ref": "../definitions.json#/city"
191           }
192         },
193         "401": {
194           "description": "Authentication required",
195           "schema": {
196             "$ref": "../definitions.json#/error"
197           }
198         },
199         "403": {
200           "description": "Access forbidden",
201           "schema": {
202             "$ref": "../definitions.json#/error"
203           }
204         },
205         "404": {
206           "description": "City not found",
207           "schema": {
208             "$ref": "../definitions.json#/error"
209           }
210         },
211         "500": {
212           "description": "Internal error",
213           "schema": {
214             "$ref": "../definitions.json#/error"
215           }
216         },
217         "503": {
218           "description": "Under maintenance",
219           "schema": {
220             "$ref": "../definitions.json#/error"
221           }
222         }
223       },
224       "x-koha-authorization": {
225         "permissions": {
226           "parameters": "manage_cities"
227         }
228       }
229     },
230     "delete": {
231       "x-mojo-to": "Cities#delete",
232       "operationId": "deleteCity",
233       "tags": ["cities"],
234       "parameters": [{
235         "$ref": "../parameters.json#/city_id_pp"
236       }],
237       "produces": [
238         "application/json"
239       ],
240       "responses": {
241         "200": {
242           "description": "City deleted",
243           "schema": {
244             "type": "string"
245           }
246         },
247         "401": {
248           "description": "Authentication required",
249           "schema": {
250             "$ref": "../definitions.json#/error"
251           }
252         },
253         "403": {
254           "description": "Access forbidden",
255           "schema": {
256             "$ref": "../definitions.json#/error"
257           }
258         },
259         "404": {
260           "description": "City not found",
261           "schema": {
262             "$ref": "../definitions.json#/error"
263           }
264         },
265         "500": {
266           "description": "Internal error",
267           "schema": {
268             "$ref": "../definitions.json#/error"
269           }
270         },
271         "503": {
272           "description": "Under maintenance",
273           "schema": {
274             "$ref": "../definitions.json#/error"
275           }
276         }
277       },
278       "x-koha-authorization": {
279         "permissions": {
280           "parameters": "manage_cities"
281         }
282       }
283     }
284   }
285 }