Bug 20006: (follow-up) Plural class name
[koha.git] / api / v1 / swagger / paths / holds.json
blobafeaac44d1826f777db41d7f2c3237bddfd90f0e
2   "/holds": {
3     "get": {
4       "x-mojo-to": "Holds#list",
5       "operationId": "listHolds",
6       "tags": ["patrons", "holds"],
7       "parameters": [
8         {
9           "name": "hold_id",
10           "in": "query",
11           "description": "Internal reserve identifier",
12           "type": "integer"
13         },
14         {
15           "name": "patron_id",
16           "in": "query",
17           "description": "Internal patron identifier",
18           "type": "integer"
19         },
20         {
21           "name": "hold_date",
22           "in": "query",
23           "description": "Hold",
24           "type": "string",
25           "format": "date"
26         },
27         {
28           "name": "biblio_id",
29           "in": "query",
30           "description": "Internal biblio identifier",
31           "type": "integer"
32         },
33         {
34           "name": "pickup_library_id",
35           "in": "query",
36           "description": "Internal library identifier for the pickup library",
37           "type": "string"
38         },
39         {
40           "name": "cancelation_date",
41           "in": "query",
42           "description": "The date the hold was cancelled",
43           "type": "string",
44           "format": "date"
45         },
46         {
47           "name": "notes",
48           "in": "query",
49           "description": "Notes related to this hold",
50           "type": "string"
51         },
52         {
53           "name": "priority",
54           "in": "query",
55           "description": "Where in the queue the patron sits",
56           "type": "integer"
57         },
58         {
59           "name": "status",
60           "in": "query",
61           "description": "Found status",
62           "type": "string"
63         },
64         {
65           "name": "timestamp",
66           "in": "query",
67           "description": "Time of latest update",
68           "type": "string"
69         },
70         {
71           "name": "item_id",
72           "in": "query",
73           "description": "Internal item identifier",
74           "type": "integer"
75         },
76         {
77           "name": "waiting_date",
78           "in": "query",
79           "description": "Date the item was marked as waiting for the patron",
80           "type": "string"
81         },
82         {
83           "name": "expiration_date",
84           "in": "query",
85           "description": "Date the hold expires",
86           "type": "string"
87         },
88         {
89           "name": "lowest_priority",
90           "in": "query",
91           "description": "Lowest priority",
92           "type": "boolean"
93         },
94         {
95           "name": "suspended",
96           "in": "query",
97           "description": "Suspended",
98           "type": "boolean"
99         },
100         {
101           "name": "suspended_until",
102           "in": "query",
103           "description": "Suspended until",
104           "type": "string"
105         }
106       ],
107       "produces": ["application/json"],
108       "responses": {
109         "200": {
110           "description": "A list of holds",
111           "schema": {
112             "$ref": "../definitions.json#/holds"
113           }
114         },
115         "401": {
116           "description": "Authentication required",
117           "schema": {
118             "$ref": "../definitions.json#/error"
119           }
120         },
121         "403": {
122           "description": "Hold not allowed",
123           "schema": {
124             "$ref": "../definitions.json#/error"
125           }
126         },
127         "404": {
128           "description": "Borrower not found",
129           "schema": {
130             "$ref": "../definitions.json#/error"
131           }
132         },
133         "500": {
134           "description": "Internal server error",
135           "schema": {
136             "$ref": "../definitions.json#/error"
137           }
138         },
139         "503": {
140           "description": "Under maintenance",
141           "schema": {
142             "$ref": "../definitions.json#/error"
143           }
144         }
145       },
146       "x-koha-authorization": {
147         "permissions": {
148           "borrowers": "edit_borrowers"
149         }
150       }
151     },
152     "post": {
153       "x-mojo-to": "Holds#add",
154       "operationId": "addHold",
155       "tags": ["patrons", "holds"],
156       "parameters": [{
157           "name": "body",
158           "in": "body",
159           "description": "A JSON object containing informations about the new hold",
160           "required": true,
161           "schema": {
162             "type": "object",
163             "properties": {
164               "patron_id": {
165                 "description": "Internal patron identifier",
166                 "type": "integer"
167               },
168               "biblio_id": {
169                 "description": "Internal biblio identifier",
170                 "type": [ "integer", "null" ]
171               },
172               "item_id": {
173                 "description": "Internal item identifier",
174                 "type": [ "integer", "null" ]
175               },
176               "pickup_library_id": {
177                 "description": "Internal library identifier for the pickup library",
178                 "type": "string"
179               },
180               "expiration_date": {
181                 "description": "Hold end date",
182                 "type": ["string", "null"],
183                 "format": "date"
184               },
185               "notes": {
186                 "description": "Notes related to this hold",
187                 "type": [ "string", "null" ]
188               },
189               "item_type": {
190                 "description": "Limit hold on one itemtype (ignored for item-level holds)",
191                 "type": [ "string", "null" ]
192               }
193             },
194             "required": [ "patron_id", "pickup_library_id" ]
195           }
196         }
197       ],
198       "consumes": ["application/json"],
199       "produces": ["application/json"],
200       "responses": {
201         "201": {
202           "description": "Created hold",
203           "schema": {
204             "$ref": "../definitions.json#/hold"
205           }
206         },
207         "400": {
208           "description": "Missing or wrong parameters",
209           "schema": {
210             "$ref": "../definitions.json#/error"
211           }
212         },
213         "401": {
214           "description": "Authentication required",
215           "schema": {
216             "$ref": "../definitions.json#/error"
217           }
218         },
219         "403": {
220           "description": "Hold not allowed",
221           "schema": {
222             "$ref": "../definitions.json#/error"
223           }
224         },
225         "404": {
226           "description": "Borrower not found",
227           "schema": {
228             "$ref": "../definitions.json#/error"
229           }
230         },
231         "500": {
232           "description": "Internal server error",
233           "schema": {
234             "$ref": "../definitions.json#/error"
235           }
236         },
237         "503": {
238           "description": "Under maintenance",
239           "schema": {
240             "$ref": "../definitions.json#/error"
241           }
242         }
243       },
244       "x-koha-authorization": {
245         "permissions": {
246           "reserveforothers": "1"
247         }
248       }
249     }
250   },
251   "/holds/{hold_id}": {
252     "put": {
253       "x-mojo-to": "Holds#edit",
254       "operationId": "editHold",
255       "tags": ["holds"],
256       "parameters": [{
257           "$ref": "../parameters.json#/hold_id_pp"
258         }, {
259           "name": "body",
260           "in": "body",
261           "description": "A JSON object containing fields to modify",
262           "required": true,
263           "schema": {
264             "type": "object",
265             "properties": {
266               "priority": {
267                 "description": "Position in waiting queue",
268                 "type": "integer",
269                 "minimum": 1
270               },
271               "branchcode": {
272                 "description": "Pickup location",
273                 "type": "string"
274               },
275               "suspend_until": {
276                 "description": "Suspend until",
277                 "type": "string",
278                 "format": "date"
279               }
280             }
281           }
282         }
283       ],
284       "consumes": ["application/json"],
285       "produces": ["application/json"],
286       "responses": {
287         "200": {
288           "description": "Updated hold",
289           "schema": {
290             "$ref": "../definitions.json#/hold"
291           }
292         },
293         "400": {
294           "description": "Missing or wrong parameters",
295           "schema": {
296             "$ref": "../definitions.json#/error"
297           }
298         },
299         "401": {
300           "description": "Authentication required",
301           "schema": {
302             "$ref": "../definitions.json#/error"
303           }
304         },
305         "403": {
306           "description": "Hold not allowed",
307           "schema": {
308             "$ref": "../definitions.json#/error"
309           }
310         },
311         "404": {
312           "description": "Hold not found",
313           "schema": {
314             "$ref": "../definitions.json#/error"
315           }
316         },
317         "500": {
318           "description": "Internal server error",
319           "schema": {
320             "$ref": "../definitions.json#/error"
321           }
322         },
323         "503": {
324           "description": "Under maintenance",
325           "schema": {
326             "$ref": "../definitions.json#/error"
327           }
328         }
329       },
330       "x-koha-authorization": {
331         "permissions": {
332           "reserveforothers": "1"
333         }
334       }
335     },
336     "delete": {
337       "x-mojo-to": "Holds#delete",
338       "operationId": "deleteHold",
339       "tags": ["holds"],
340       "parameters": [{
341           "$ref": "../parameters.json#/hold_id_pp"
342         }
343       ],
344       "produces": ["application/json"],
345       "responses": {
346         "200": {
347           "description": "Successful deletion",
348           "schema": {
349             "type": "object"
350           }
351         },
352         "401": {
353           "description": "Authentication required",
354           "schema": {
355             "$ref": "../definitions.json#/error"
356           }
357         },
358         "403": {
359           "description": "Hold not allowed",
360           "schema": {
361             "$ref": "../definitions.json#/error"
362           }
363         },
364         "404": {
365           "description": "Hold not found",
366           "schema": {
367             "$ref": "../definitions.json#/error"
368           }
369         },
370         "500": {
371           "description": "Internal server error",
372           "schema": {
373             "$ref": "../definitions.json#/error"
374           }
375         },
376         "503": {
377           "description": "Under maintenance",
378           "schema": {
379             "$ref": "../definitions.json#/error"
380           }
381         }
382       },
383       "x-koha-authorization": {
384         "permissions": {
385           "reserveforothers": "1"
386         }
387       }
388     }
389   }