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