Bug 29072: Move reference route /cities spec to YAML
[koha.git] / api / v1 / swagger / paths / cities.yaml
1 ---
2 /cities:
3   get:
4     x-mojo-to: Cities#list
5     operationId: listCities
6     tags:
7       - cities
8     summary: List cities
9     produces:
10       - application/json
11     parameters:
12       - name: name
13         in: query
14         description: Case insensative search on city name
15         required: false
16         type: string
17       - name: state
18         in: query
19         description: Case insensative search on city state
20         required: false
21         type: string
22       - name: country
23         in: query
24         description: Case insensative search on city country
25         required: false
26         type: string
27       - name: postal_code
28         in: query
29         description: Case Insensative search on city postal code
30         required: false
31         type: string
32       - $ref: ../parameters.json#/match
33       - $ref: ../parameters.json#/order_by
34       - $ref: ../parameters.json#/page
35       - $ref: ../parameters.json#/per_page
36       - $ref: ../parameters.json#/q_param
37       - $ref: ../parameters.json#/q_body
38       - $ref: ../parameters.json#/q_header
39     responses:
40       "200":
41         description: A list of cities
42         schema:
43           type: array
44           items:
45             $ref: ../definitions.json#/city
46       "403":
47         description: Access forbidden
48         schema:
49           $ref: ../definitions.json#/error
50       "500":
51         description: Internal error
52         schema:
53           $ref: ../definitions.json#/error
54       "503":
55         description: Under maintenance
56         schema:
57           $ref: ../definitions.json#/error
58     x-koha-authorization:
59       permissions:
60         catalogue: "1"
61   post:
62     x-mojo-to: Cities#add
63     operationId: addCity
64     tags:
65       - cities
66     summary: Add city
67     parameters:
68       - name: body
69         in: body
70         description: A JSON object containing informations about the new hold
71         required: true
72         schema:
73           $ref: ../definitions.json#/city
74     produces:
75       - application/json
76     responses:
77       "201":
78         description: City added
79         schema:
80           $ref: ../definitions.json#/city
81       "401":
82         description: Authentication required
83         schema:
84           $ref: ../definitions.json#/error
85       "403":
86         description: Access forbidden
87         schema:
88           $ref: ../definitions.json#/error
89       "500":
90         description: Internal error
91         schema:
92           $ref: ../definitions.json#/error
93       "503":
94         description: Under maintenance
95         schema:
96           $ref: ../definitions.json#/error
97     x-koha-authorization:
98       permissions:
99         parameters: manage_cities
100 "/cities/{city_id}":
101   get:
102     x-mojo-to: Cities#get
103     operationId: getCity
104     tags:
105       - cities
106     summary: Get city
107     parameters:
108       - $ref: ../parameters.json#/city_id_pp
109     produces:
110       - application/json
111     responses:
112       "200":
113         description: A city
114         schema:
115           $ref: ../definitions.json#/city
116       "404":
117         description: City not found
118         schema:
119           $ref: ../definitions.json#/error
120       "500":
121         description: Internal error
122         schema:
123           $ref: ../definitions.json#/error
124       "503":
125         description: Under maintenance
126         schema:
127           $ref: ../definitions.json#/error
128     x-koha-authorization:
129       permissions:
130         catalogue: "1"
131   put:
132     x-mojo-to: Cities#update
133     operationId: updateCity
134     tags:
135       - cities
136     summary: Update city
137     parameters:
138       - $ref: ../parameters.json#/city_id_pp
139       - name: body
140         in: body
141         description: A city object
142         required: true
143         schema:
144           $ref: ../definitions.json#/city
145     produces:
146       - application/json
147     responses:
148       "200":
149         description: A city
150         schema:
151           $ref: ../definitions.json#/city
152       "401":
153         description: Authentication required
154         schema:
155           $ref: ../definitions.json#/error
156       "403":
157         description: Access forbidden
158         schema:
159           $ref: ../definitions.json#/error
160       "404":
161         description: City not found
162         schema:
163           $ref: ../definitions.json#/error
164       "500":
165         description: Internal error
166         schema:
167           $ref: ../definitions.json#/error
168       "503":
169         description: Under maintenance
170         schema:
171           $ref: ../definitions.json#/error
172     x-koha-authorization:
173       permissions:
174         parameters: manage_cities
175   delete:
176     x-mojo-to: Cities#delete
177     operationId: deleteCity
178     tags:
179       - cities
180     summary: Delete city
181     parameters:
182       - $ref: ../parameters.json#/city_id_pp
183     produces:
184       - application/json
185     responses:
186       "204":
187         description: City deleted
188       "401":
189         description: Authentication required
190         schema:
191           $ref: ../definitions.json#/error
192       "403":
193         description: Access forbidden
194         schema:
195           $ref: ../definitions.json#/error
196       "404":
197         description: City not found
198         schema:
199           $ref: ../definitions.json#/error
200       "500":
201         description: Internal error
202         schema:
203           $ref: ../definitions.json#/error
204       "503":
205         description: Under maintenance
206         schema:
207           $ref: ../definitions.json#/error
208     x-koha-authorization:
209       permissions:
210         parameters: manage_cities