Bug 17428: [REST] best practice followup
[koha.git] / api / v1 / swagger / paths / cities.json
1 {
2   "/cities": {
3     "get": {
4       "x-mojo-controller": "Koha::REST::V1::Cities",
5       "operationId": "list",
6       "tags": ["cities"],
7       "produces": [
8         "application/json"
9       ],
10       "parameters": [{
11         "name": "city_name",
12         "in": "query",
13         "description": "Case insensative 'starts-with' search on city name",
14         "required": false,
15         "type": "string"
16       }, {
17         "name": "city_state",
18         "in": "query",
19         "description": "Case insensative 'starts-with' search on city state",
20         "required": false,
21         "type": "string"
22       }, {
23         "name": "city_country",
24         "in": "query",
25         "description": "Case insensative 'starts_with' search on city country",
26         "required": false,
27         "type": "string"
28       }, {
29         "name": "city_zipcode",
30         "in": "query",
31         "description": "Case Insensative 'starts-with' search on zipcode",
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       }
58     },
59     "post": {
60       "x-mojo-controller": "Koha::REST::V1::Cities",
61       "operationId": "add",
62       "tags": ["cities"],
63       "parameters": [{
64         "name": "body",
65         "in": "body",
66         "description": "A JSON object containing informations about the new hold",
67         "required": true,
68         "schema": {
69           "$ref": "../definitions.json#/city"
70         }
71       }],
72       "produces": [
73         "application/json"
74       ],
75       "responses": {
76         "200": {
77           "description": "City added",
78           "schema": {
79             "$ref": "../definitions.json#/city"
80           }
81         },
82         "403": {
83           "description": "Access forbidden",
84           "schema": {
85             "$ref": "../definitions.json#/error"
86           }
87         },
88         "500": {
89           "description": "Internal error",
90           "schema": {
91             "$ref": "../definitions.json#/error"
92           }
93         }
94       },
95       "x-koha-authorization": {
96         "permissions": {
97           "parameters": "parameters_remaining_permissions"
98         }
99       }
100     }
101   },
102   "/cities/{cityid}": {
103     "get": {
104       "x-mojo-controller": "Koha::REST::V1::Cities",
105       "operationId": "get",
106       "tags": ["cities"],
107       "parameters": [{
108         "$ref": "../parameters.json#/cityidPathParam"
109       }],
110       "produces": [
111         "application/json"
112       ],
113       "responses": {
114         "200": {
115           "description": "A city",
116           "schema": {
117             "$ref": "../definitions.json#/city"
118           }
119         },
120         "403": {
121           "description": "Access forbidden",
122           "schema": {
123             "$ref": "../definitions.json#/error"
124           }
125         },
126         "404": {
127           "description": "City not found",
128           "schema": {
129             "$ref": "../definitions.json#/error"
130           }
131         },
132         "500": {
133           "description": "Internal error",
134           "schema": {
135             "$ref": "../definitions.json#/error"
136           }
137         }
138       }
139     },
140     "put": {
141       "x-mojo-controller": "Koha::REST::V1::Cities",
142       "operationId": "update",
143       "tags": ["cities"],
144       "parameters": [{
145         "$ref": "../parameters.json#/cityidPathParam"
146       }, {
147         "name": "body",
148         "in": "body",
149         "description": "A JSON object containing informations about the new hold",
150         "required": true,
151         "schema": {
152           "$ref": "../definitions.json#/city"
153         }
154       }],
155       "produces": [
156         "application/json"
157       ],
158       "responses": {
159         "200": {
160           "description": "A city",
161           "schema": {
162             "$ref": "../definitions.json#/city"
163           }
164         },
165         "403": {
166           "description": "Access forbidden",
167           "schema": {
168             "$ref": "../definitions.json#/error"
169           }
170         },
171         "404": {
172           "description": "City not found",
173           "schema": {
174             "$ref": "../definitions.json#/error"
175           }
176         },
177         "500": {
178           "description": "Internal error",
179           "schema": {
180             "$ref": "../definitions.json#/error"
181           }
182         }
183       },
184       "x-koha-authorization": {
185         "permissions": {
186           "parameters": "parameters_remaining_permissions"
187         }
188       }
189     },
190     "delete": {
191       "x-mojo-controller": "Koha::REST::V1::Cities",
192       "operationId": "delete",
193       "tags": ["cities"],
194       "parameters": [{
195         "$ref": "../parameters.json#/cityidPathParam"
196       }],
197       "produces": [
198         "application/json"
199       ],
200       "responses": {
201         "200": {
202           "description": "City deleted",
203           "schema": {
204             "type": "string"
205           }
206         },
207         "403": {
208           "description": "Access forbidden",
209           "schema": {
210             "$ref": "../definitions.json#/error"
211           }
212         },
213         "404": {
214           "description": "City not found",
215           "schema": {
216             "$ref": "../definitions.json#/error"
217           }
218         },
219         "500": {
220           "description": "Internal error",
221           "schema": {
222             "$ref": "../definitions.json#/error"
223           }
224         }
225       },
226       "x-koha-authorization": {
227         "permissions": {
228           "parameters": "parameters_remaining_permissions"
229         }
230       }
231     }
232   }
233 }