Bug 27251: Rewrite QOTD with the Koha REST API
[koha.git] / api / v1 / swagger / paths / quotes.json
1 {
2   "/quotes": {
3     "get": {
4       "x-mojo-to": "Quotes#list",
5       "operationId": "listQuotes",
6       "tags": [
7         "quotes"
8       ],
9       "produces": [
10         "application/json"
11       ],
12       "parameters": [
13         {
14           "name": "quote_id",
15           "in": "query",
16           "description": "Case insensitive search on quote id",
17           "required": false,
18           "type": "string"
19         },
20         {
21           "name": "source",
22           "in": "query",
23           "description": "Case insensitive search on source",
24           "required": false,
25           "type": "string"
26         },
27         {
28           "name": "text",
29           "in": "query",
30           "description": "Case insensitive search on text",
31           "required": false,
32           "type": "string"
33         },
34         {
35           "name": "displayed_on",
36           "in": "query",
37           "description": "Case Insensative search on last displayed date",
38           "required": false,
39           "type": "string"
40         },
41         {
42           "$ref": "../parameters.json#/match"
43         },
44         {
45           "$ref": "../parameters.json#/order_by"
46         },
47         {
48           "$ref": "../parameters.json#/page"
49         },
50         {
51           "$ref": "../parameters.json#/per_page"
52         },
53         {
54           "$ref": "../parameters.json#/q_param"
55         },
56         {
57           "$ref": "../parameters.json#/q_body"
58         },
59         {
60           "$ref": "../parameters.json#/q_header"
61         }
62       ],
63       "responses": {
64         "200": {
65           "description": "A list of quotes",
66           "schema": {
67             "type": "array",
68             "items": {
69               "$ref": "../definitions.json#/quote"
70             }
71           }
72         },
73         "403": {
74           "description": "Access forbidden",
75           "schema": {
76             "$ref": "../definitions.json#/error"
77           }
78         },
79         "500": {
80           "description": "Internal error",
81           "schema": {
82             "$ref": "../definitions.json#/error"
83           }
84         },
85         "503": {
86           "description": "Under maintenance",
87           "schema": {
88             "$ref": "../definitions.json#/error"
89           }
90         }
91       },
92       "x-koha-authorization": {
93         "permissions": {
94           "catalogue": "1"
95         }
96       }
97     },
98     "post": {
99       "x-mojo-to": "Quotes#add",
100       "operationId": "addQuote",
101       "tags": [
102         "quotes"
103       ],
104       "parameters": [
105         {
106           "name": "body",
107           "in": "body",
108           "description": "A JSON object containing informations about the new quote",
109           "required": true,
110           "schema": {
111             "$ref": "../definitions.json#/quote"
112           }
113         }
114       ],
115       "produces": [
116         "application/json"
117       ],
118       "responses": {
119         "201": {
120           "description": "Quote added",
121           "schema": {
122             "$ref": "../definitions.json#/quote"
123           }
124         },
125         "401": {
126           "description": "Authentication required",
127           "schema": {
128             "$ref": "../definitions.json#/error"
129           }
130         },
131         "403": {
132           "description": "Access forbidden",
133           "schema": {
134             "$ref": "../definitions.json#/error"
135           }
136         },
137         "500": {
138           "description": "Internal error",
139           "schema": {
140             "$ref": "../definitions.json#/error"
141           }
142         },
143         "503": {
144           "description": "Under maintenance",
145           "schema": {
146             "$ref": "../definitions.json#/error"
147           }
148         }
149       },
150       "x-koha-authorization": {
151         "permissions": {
152           "tools": "edit_quotes"
153         }
154       }
155     }
156   },
157   "/quotes/{quote_id}": {
158     "get": {
159       "x-mojo-to": "Quotes#get",
160       "operationId": "getQuote",
161       "tags": [
162         "quotes"
163       ],
164       "parameters": [
165         {
166           "$ref": "../parameters.json#/quote_id_pp"
167         }
168       ],
169       "produces": [
170         "application/json"
171       ],
172       "responses": {
173         "200": {
174           "description": "A Quote",
175           "schema": {
176             "$ref": "../definitions.json#/quote"
177           }
178         },
179         "404": {
180           "description": "Quote not found",
181           "schema": {
182             "$ref": "../definitions.json#/error"
183           }
184         },
185         "500": {
186           "description": "Internal error",
187           "schema": {
188             "$ref": "../definitions.json#/error"
189           }
190         },
191         "503": {
192           "description": "Under maintenance",
193           "schema": {
194             "$ref": "../definitions.json#/error"
195           }
196         }
197       },
198       "x-koha-authorization": {
199         "permissions": {
200           "catalogue": "1"
201         }
202       }
203     },
204     "put": {
205       "x-mojo-to": "Quotes#update",
206       "operationId": "updateQuote",
207       "tags": [
208         "quotes"
209       ],
210       "parameters": [
211         {
212           "$ref": "../parameters.json#/quote_id_pp"
213         },
214         {
215           "name": "body",
216           "in": "body",
217           "description": "a quote object",
218           "required": true,
219           "schema": {
220             "$ref": "../definitions.json#/quote"
221           }
222         }
223       ],
224       "produces": [
225         "application/json"
226       ],
227       "responses": {
228         "200": {
229           "description": "A quote",
230           "schema": {
231             "$ref": "../definitions.json#/quote"
232           }
233         },
234         "401": {
235           "description": "Authentication required",
236           "schema": {
237             "$ref": "../definitions.json#/error"
238           }
239         },
240         "403": {
241           "description": "Access forbidden",
242           "schema": {
243             "$ref": "../definitions.json#/error"
244           }
245         },
246         "404": {
247           "description": "Quote not found",
248           "schema": {
249             "$ref": "../definitions.json#/error"
250           }
251         },
252         "500": {
253           "description": "Internal error",
254           "schema": {
255             "$ref": "../definitions.json#/error"
256           }
257         },
258         "503": {
259           "description": "Under maintenance",
260           "schema": {
261             "$ref": "../definitions.json#/error"
262           }
263         }
264       },
265       "x-koha-authorization": {
266         "permissions": {
267           "tools": "edit_quotes"
268         }
269       }
270     },
271     "delete": {
272       "x-mojo-to": "Quotes#delete",
273       "operationId": "deleteQuote",
274       "tags": [
275         "quotes"
276       ],
277       "parameters": [
278         {
279           "$ref": "../parameters.json#/quote_id_pp"
280         }
281       ],
282       "produces": [
283         "application/json"
284       ],
285       "responses": {
286         "204": {
287           "description": "Quote deleted"
288         },
289         "401": {
290           "description": "Authentication required",
291           "schema": {
292             "$ref": "../definitions.json#/error"
293           }
294         },
295         "403": {
296           "description": "Access forbidden",
297           "schema": {
298             "$ref": "../definitions.json#/error"
299           }
300         },
301         "404": {
302           "description": "Quote not found",
303           "schema": {
304             "$ref": "../definitions.json#/error"
305           }
306         },
307         "500": {
308           "description": "Internal error",
309           "schema": {
310             "$ref": "../definitions.json#/error"
311           }
312         },
313         "503": {
314           "description": "Under maintenance",
315           "schema": {
316             "$ref": "../definitions.json#/error"
317           }
318         }
319       },
320       "x-koha-authorization": {
321         "permissions": {
322           "tools": "edit_quotes"
323         }
324       }
325     }
326   }
327 }