847d3b83ca8095c370bc3a375f361745d2c689fb
[koha.git] / api / v1 / swagger / paths / holds.json
1 {
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": "cancellation_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             "$ref": "../parameters.json#/match"
108         },
109         {
110             "$ref": "../parameters.json#/order_by"
111         },
112         {
113             "$ref": "../parameters.json#/page"
114         },
115         {
116             "$ref": "../parameters.json#/per_page"
117         }
118       ],
119       "produces": ["application/json"],
120       "responses": {
121         "200": {
122           "description": "A list of holds",
123           "schema": {
124             "$ref": "../definitions.json#/holds"
125           }
126         },
127         "401": {
128           "description": "Authentication required",
129           "schema": {
130             "$ref": "../definitions.json#/error"
131           }
132         },
133         "403": {
134           "description": "Hold not allowed",
135           "schema": {
136             "$ref": "../definitions.json#/error"
137           }
138         },
139         "404": {
140           "description": "Borrower not found",
141           "schema": {
142             "$ref": "../definitions.json#/error"
143           }
144         },
145         "500": {
146           "description": "Internal server error",
147           "schema": {
148             "$ref": "../definitions.json#/error"
149           }
150         },
151         "503": {
152           "description": "Under maintenance",
153           "schema": {
154             "$ref": "../definitions.json#/error"
155           }
156         }
157       },
158       "x-koha-authorization": {
159         "permissions": {
160           "borrowers": "edit_borrowers"
161         }
162       }
163     },
164     "post": {
165       "x-mojo-to": "Holds#add",
166       "operationId": "addHold",
167       "tags": ["patrons", "holds"],
168       "parameters": [{
169           "name": "body",
170           "in": "body",
171           "description": "A JSON object containing informations about the new hold",
172           "required": true,
173           "schema": {
174             "type": "object",
175             "properties": {
176               "patron_id": {
177                 "description": "Internal patron identifier",
178                 "type": "integer"
179               },
180               "biblio_id": {
181                 "description": "Internal biblio identifier",
182                 "type": [ "integer", "null" ]
183               },
184               "item_id": {
185                 "description": "Internal item identifier",
186                 "type": [ "integer", "null" ]
187               },
188               "pickup_library_id": {
189                 "description": "Internal library identifier for the pickup library",
190                 "type": "string"
191               },
192               "expiration_date": {
193                 "description": "Hold end date",
194                 "type": ["string", "null"],
195                 "format": "date"
196               },
197               "notes": {
198                 "description": "Notes related to this hold",
199                 "type": [ "string", "null" ]
200               },
201               "item_type": {
202                 "description": "Limit hold on one itemtype (ignored for item-level holds)",
203                 "type": [ "string", "null" ]
204               }
205             },
206             "required": [ "patron_id", "pickup_library_id" ]
207           }
208         }
209       ],
210       "consumes": ["application/json"],
211       "produces": ["application/json"],
212       "responses": {
213         "201": {
214           "description": "Created hold",
215           "schema": {
216             "$ref": "../definitions.json#/hold"
217           }
218         },
219         "400": {
220           "description": "Missing or wrong parameters",
221           "schema": {
222             "$ref": "../definitions.json#/error"
223           }
224         },
225         "401": {
226           "description": "Authentication required",
227           "schema": {
228             "$ref": "../definitions.json#/error"
229           }
230         },
231         "403": {
232           "description": "Hold not allowed",
233           "schema": {
234             "$ref": "../definitions.json#/error"
235           }
236         },
237         "404": {
238           "description": "Borrower not found",
239           "schema": {
240             "$ref": "../definitions.json#/error"
241           }
242         },
243         "500": {
244           "description": "Internal server error",
245           "schema": {
246             "$ref": "../definitions.json#/error"
247           }
248         },
249         "503": {
250           "description": "Under maintenance",
251           "schema": {
252             "$ref": "../definitions.json#/error"
253           }
254         }
255       },
256       "x-koha-authorization": {
257         "permissions": {
258           "reserveforothers": "1"
259         }
260       }
261     }
262   },
263   "/holds/{hold_id}": {
264     "put": {
265       "x-mojo-to": "Holds#edit",
266       "operationId": "editHold",
267       "tags": ["holds"],
268       "parameters": [{
269           "$ref": "../parameters.json#/hold_id_pp"
270         }, {
271           "name": "body",
272           "in": "body",
273           "description": "A JSON object containing fields to modify",
274           "required": true,
275           "schema": {
276             "type": "object",
277             "properties": {
278               "priority": {
279                 "description": "Position in waiting queue",
280                 "type": "integer",
281                 "minimum": 1
282               },
283               "branchcode": {
284                 "description": "Pickup location",
285                 "type": "string"
286               },
287               "suspend_until": {
288                 "description": "Suspend until",
289                 "type": "string",
290                 "format": "date"
291               }
292             }
293           }
294         }
295       ],
296       "consumes": ["application/json"],
297       "produces": ["application/json"],
298       "responses": {
299         "200": {
300           "description": "Updated hold",
301           "schema": {
302             "$ref": "../definitions.json#/hold"
303           }
304         },
305         "400": {
306           "description": "Missing or wrong parameters",
307           "schema": {
308             "$ref": "../definitions.json#/error"
309           }
310         },
311         "401": {
312           "description": "Authentication required",
313           "schema": {
314             "$ref": "../definitions.json#/error"
315           }
316         },
317         "403": {
318           "description": "Hold not allowed",
319           "schema": {
320             "$ref": "../definitions.json#/error"
321           }
322         },
323         "404": {
324           "description": "Hold not found",
325           "schema": {
326             "$ref": "../definitions.json#/error"
327           }
328         },
329         "500": {
330           "description": "Internal server error",
331           "schema": {
332             "$ref": "../definitions.json#/error"
333           }
334         },
335         "503": {
336           "description": "Under maintenance",
337           "schema": {
338             "$ref": "../definitions.json#/error"
339           }
340         }
341       },
342       "x-koha-authorization": {
343         "permissions": {
344           "reserveforothers": "1"
345         }
346       }
347     },
348     "delete": {
349       "x-mojo-to": "Holds#delete",
350       "operationId": "deleteHold",
351       "tags": ["holds"],
352       "parameters": [{
353           "$ref": "../parameters.json#/hold_id_pp"
354         }
355       ],
356       "produces": ["application/json"],
357       "responses": {
358         "204": {
359           "description": "Hold deleted"
360         },
361         "401": {
362           "description": "Authentication required",
363           "schema": {
364             "$ref": "../definitions.json#/error"
365           }
366         },
367         "403": {
368           "description": "Hold not allowed",
369           "schema": {
370             "$ref": "../definitions.json#/error"
371           }
372         },
373         "404": {
374           "description": "Hold not found",
375           "schema": {
376             "$ref": "../definitions.json#/error"
377           }
378         },
379         "500": {
380           "description": "Internal server error",
381           "schema": {
382             "$ref": "../definitions.json#/error"
383           }
384         },
385         "503": {
386           "description": "Under maintenance",
387           "schema": {
388             "$ref": "../definitions.json#/error"
389           }
390         }
391       },
392       "x-koha-authorization": {
393         "permissions": {
394           "reserveforothers": "1"
395         }
396       }
397     }
398   },
399   "/holds/{hold_id}/priority": {
400     "put": {
401       "x-mojo-to": "Holds#update_priority",
402       "operationId": "updateHoldPriority",
403       "tags": [
404         "biblios",
405         "holds"
406       ],
407       "parameters": [
408         {
409           "$ref": "../parameters.json#/hold_id_pp"
410         },
411         {
412           "name": "body",
413           "in": "body",
414           "description": "An integer representing the new priority to be set for the hold",
415           "required": true,
416           "schema": {
417             "type": "integer"
418           }
419         }
420       ],
421       "produces": [
422         "application/json"
423       ],
424       "responses": {
425         "200": {
426           "description": "The new priority value for the hold",
427           "schema": {
428             "type": "integer"
429           }
430         },
431         "401": {
432           "description": "Authentication required",
433           "schema": {
434             "$ref": "../definitions.json#/error"
435           }
436         },
437         "403": {
438           "description": "Access forbidden",
439           "schema": {
440             "$ref": "../definitions.json#/error"
441           }
442         },
443         "404": {
444           "description": "Biblio not found",
445           "schema": {
446             "$ref": "../definitions.json#/error"
447           }
448         },
449         "409": {
450           "description": "Unable to perform action on biblio",
451           "schema": {
452             "$ref": "../definitions.json#/error"
453           }
454         },
455         "500": {
456           "description": "Internal error",
457           "schema": {
458             "$ref": "../definitions.json#/error"
459           }
460         },
461         "503": {
462           "description": "Under maintenance",
463           "schema": {
464             "$ref": "../definitions.json#/error"
465           }
466         }
467       },
468       "x-koha-authorization": {
469         "permissions": {
470           "reserveforothers": "modify_holds_priority"
471         }
472       }
473     }
474   },
475   "/holds/{hold_id}/suspension": {
476     "post": {
477       "x-mojo-to": "Holds#suspend",
478       "operationId": "suspendHold",
479       "tags": ["holds"],
480       "parameters": [{
481           "$ref": "../parameters.json#/hold_id_pp"
482         }, {
483           "name": "body",
484           "in": "body",
485           "description": "A JSON object containing fields to modify",
486           "required": false,
487           "schema": {
488             "type": "object",
489             "properties": {
490               "end_date": {
491                 "description": "Date the hold suspension expires",
492                 "type": "string",
493                 "format": "date"
494               }
495             }
496           }
497         }
498       ],
499       "consumes": ["application/json"],
500       "produces": ["application/json"],
501       "responses": {
502         "201": {
503           "description": "Hold suspended"
504         },
505         "400": {
506           "description": "Missing or wrong parameters",
507           "schema": {
508             "$ref": "../definitions.json#/error"
509           }
510         },
511         "401": {
512           "description": "Authentication required",
513           "schema": {
514             "$ref": "../definitions.json#/error"
515           }
516         },
517         "403": {
518           "description": "Hold not allowed",
519           "schema": {
520             "$ref": "../definitions.json#/error"
521           }
522         },
523         "404": {
524           "description": "Hold not found",
525           "schema": {
526             "$ref": "../definitions.json#/error"
527           }
528         },
529         "500": {
530           "description": "Internal server error",
531           "schema": {
532             "$ref": "../definitions.json#/error"
533           }
534         },
535         "503": {
536           "description": "Under maintenance",
537           "schema": {
538             "$ref": "../definitions.json#/error"
539           }
540         }
541       },
542       "x-koha-authorization": {
543         "permissions": {
544           "reserveforothers": "1"
545         }
546       }
547     },
548     "delete": {
549       "x-mojo-to": "Holds#resume",
550       "operationId": "resumeHold",
551       "tags": ["holds"],
552       "parameters": [
553         {
554           "$ref": "../parameters.json#/hold_id_pp"
555         }
556       ],
557       "consumes": ["application/json"],
558       "produces": ["application/json"],
559       "responses": {
560         "204": {
561           "description": "Hold resumed"
562         },
563         "400": {
564           "description": "Missing or wrong parameters",
565           "schema": {
566             "$ref": "../definitions.json#/error"
567           }
568         },
569         "401": {
570           "description": "Authentication required",
571           "schema": {
572             "$ref": "../definitions.json#/error"
573           }
574         },
575         "403": {
576           "description": "Hold not allowed",
577           "schema": {
578             "$ref": "../definitions.json#/error"
579           }
580         },
581         "404": {
582           "description": "Hold not found",
583           "schema": {
584             "$ref": "../definitions.json#/error"
585           }
586         },
587         "500": {
588           "description": "Internal server error",
589           "schema": {
590             "$ref": "../definitions.json#/error"
591           }
592         },
593         "503": {
594           "description": "Under maintenance",
595           "schema": {
596             "$ref": "../definitions.json#/error"
597           }
598         }
599       },
600       "x-koha-authorization": {
601         "permissions": {
602           "reserveforothers": "1"
603         }
604       }
605     }
606   }
607 }