Bug 20004: Adapt /v1/cities to new naming guidelines
[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     },
65     "post": {
66       "x-mojo-to": "Cities#add",
67       "operationId": "addCity",
68       "tags": ["cities"],
69       "parameters": [{
70         "name": "body",
71         "in": "body",
72         "description": "A JSON object containing informations about the new hold",
73         "required": true,
74         "schema": {
75           "$ref": "../definitions.json#/city"
76         }
77       }],
78       "produces": [
79         "application/json"
80       ],
81       "responses": {
82         "200": {
83           "description": "City added",
84           "schema": {
85             "$ref": "../definitions.json#/city"
86           }
87         },
88         "401": {
89           "description": "Authentication required",
90           "schema": {
91             "$ref": "../definitions.json#/error"
92           }
93         },
94         "403": {
95           "description": "Access forbidden",
96           "schema": {
97             "$ref": "../definitions.json#/error"
98           }
99         },
100         "500": {
101           "description": "Internal error",
102           "schema": {
103             "$ref": "../definitions.json#/error"
104           }
105         },
106         "503": {
107           "description": "Under maintenance",
108           "schema": {
109             "$ref": "../definitions.json#/error"
110           }
111         }
112       },
113       "x-koha-authorization": {
114         "permissions": {
115           "parameters": "parameters_remaining_permissions"
116         }
117       }
118     }
119   },
120   "/cities/{city_id}": {
121     "get": {
122       "x-mojo-to": "Cities#get",
123       "operationId": "getCity",
124       "tags": ["cities"],
125       "parameters": [{
126         "$ref": "../parameters.json#/city_id_pp"
127       }],
128       "produces": [
129         "application/json"
130       ],
131       "responses": {
132         "200": {
133           "description": "A city",
134           "schema": {
135             "$ref": "../definitions.json#/city"
136           }
137         },
138         "404": {
139           "description": "City not found",
140           "schema": {
141             "$ref": "../definitions.json#/error"
142           }
143         },
144         "500": {
145           "description": "Internal error",
146           "schema": {
147             "$ref": "../definitions.json#/error"
148           }
149         },
150         "503": {
151           "description": "Under maintenance",
152           "schema": {
153             "$ref": "../definitions.json#/error"
154           }
155         }
156       }
157     },
158     "put": {
159       "x-mojo-to": "Cities#update",
160       "operationId": "updateCity",
161       "tags": ["cities"],
162       "parameters": [{
163         "$ref": "../parameters.json#/city_id_pp"
164       }, {
165         "name": "body",
166         "in": "body",
167         "description": "A city object",
168         "required": true,
169         "schema": {
170           "$ref": "../definitions.json#/city"
171         }
172       }],
173       "produces": [
174         "application/json"
175       ],
176       "responses": {
177         "200": {
178           "description": "A city",
179           "schema": {
180             "$ref": "../definitions.json#/city"
181           }
182         },
183         "401": {
184           "description": "Authentication required",
185           "schema": {
186             "$ref": "../definitions.json#/error"
187           }
188         },
189         "403": {
190           "description": "Access forbidden",
191           "schema": {
192             "$ref": "../definitions.json#/error"
193           }
194         },
195         "404": {
196           "description": "City not found",
197           "schema": {
198             "$ref": "../definitions.json#/error"
199           }
200         },
201         "500": {
202           "description": "Internal error",
203           "schema": {
204             "$ref": "../definitions.json#/error"
205           }
206         },
207         "503": {
208           "description": "Under maintenance",
209           "schema": {
210             "$ref": "../definitions.json#/error"
211           }
212         }
213       },
214       "x-koha-authorization": {
215         "permissions": {
216           "parameters": "parameters_remaining_permissions"
217         }
218       }
219     },
220     "delete": {
221       "x-mojo-to": "Cities#delete",
222       "operationId": "deleteCity",
223       "tags": ["cities"],
224       "parameters": [{
225         "$ref": "../parameters.json#/city_id_pp"
226       }],
227       "produces": [
228         "application/json"
229       ],
230       "responses": {
231         "200": {
232           "description": "City deleted",
233           "schema": {
234             "type": "string"
235           }
236         },
237         "401": {
238           "description": "Authentication required",
239           "schema": {
240             "$ref": "../definitions.json#/error"
241           }
242         },
243         "403": {
244           "description": "Access forbidden",
245           "schema": {
246             "$ref": "../definitions.json#/error"
247           }
248         },
249         "404": {
250           "description": "City not found",
251           "schema": {
252             "$ref": "../definitions.json#/error"
253           }
254         },
255         "500": {
256           "description": "Internal error",
257           "schema": {
258             "$ref": "../definitions.json#/error"
259           }
260         },
261         "503": {
262           "description": "Under maintenance",
263           "schema": {
264             "$ref": "../definitions.json#/error"
265           }
266         }
267       },
268       "x-koha-authorization": {
269         "permissions": {
270           "parameters": "parameters_remaining_permissions"
271         }
272       }
273     }
274   }
275 }