Bug 18729: Add PUT /holds/{hold_id}/pickup_location
[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       "x-koha-override": {
272         "AllowHoldPolicyOverride": 1
273       }
274     }
275   },
276   "/holds/{hold_id}": {
277     "put": {
278       "x-mojo-to": "Holds#edit",
279       "operationId": "editHold",
280       "tags": ["holds"],
281       "parameters": [{
282           "$ref": "../parameters.json#/hold_id_pp"
283         }, {
284           "name": "body",
285           "in": "body",
286           "description": "A JSON object containing fields to modify",
287           "required": true,
288           "schema": {
289             "type": "object",
290             "properties": {
291               "priority": {
292                 "description": "Position in waiting queue",
293                 "type": "integer",
294                 "minimum": 1
295               },
296               "branchcode": {
297                 "description": "Pickup location",
298                 "type": "string"
299               },
300               "suspend_until": {
301                 "description": "Suspend until",
302                 "type": "string",
303                 "format": "date"
304               }
305             }
306           }
307         }
308       ],
309       "consumes": ["application/json"],
310       "produces": ["application/json"],
311       "responses": {
312         "200": {
313           "description": "Updated hold",
314           "schema": {
315             "$ref": "../definitions.json#/hold"
316           }
317         },
318         "400": {
319           "description": "Missing or wrong parameters",
320           "schema": {
321             "$ref": "../definitions.json#/error"
322           }
323         },
324         "401": {
325           "description": "Authentication required",
326           "schema": {
327             "$ref": "../definitions.json#/error"
328           }
329         },
330         "403": {
331           "description": "Hold not allowed",
332           "schema": {
333             "$ref": "../definitions.json#/error"
334           }
335         },
336         "404": {
337           "description": "Hold not found",
338           "schema": {
339             "$ref": "../definitions.json#/error"
340           }
341         },
342         "500": {
343           "description": "Internal server error",
344           "schema": {
345             "$ref": "../definitions.json#/error"
346           }
347         },
348         "503": {
349           "description": "Under maintenance",
350           "schema": {
351             "$ref": "../definitions.json#/error"
352           }
353         }
354       },
355       "x-koha-authorization": {
356         "permissions": {
357           "reserveforothers": "1"
358         }
359       }
360     },
361     "delete": {
362       "x-mojo-to": "Holds#delete",
363       "operationId": "deleteHold",
364       "tags": ["holds"],
365       "parameters": [{
366           "$ref": "../parameters.json#/hold_id_pp"
367         }
368       ],
369       "produces": ["application/json"],
370       "responses": {
371         "204": {
372           "description": "Hold deleted"
373         },
374         "401": {
375           "description": "Authentication required",
376           "schema": {
377             "$ref": "../definitions.json#/error"
378           }
379         },
380         "403": {
381           "description": "Hold not allowed",
382           "schema": {
383             "$ref": "../definitions.json#/error"
384           }
385         },
386         "404": {
387           "description": "Hold not found",
388           "schema": {
389             "$ref": "../definitions.json#/error"
390           }
391         },
392         "500": {
393           "description": "Internal server error",
394           "schema": {
395             "$ref": "../definitions.json#/error"
396           }
397         },
398         "503": {
399           "description": "Under maintenance",
400           "schema": {
401             "$ref": "../definitions.json#/error"
402           }
403         }
404       },
405       "x-koha-authorization": {
406         "permissions": {
407           "reserveforothers": "1"
408         }
409       }
410     }
411   },
412   "/holds/{hold_id}/priority": {
413     "put": {
414       "x-mojo-to": "Holds#update_priority",
415       "operationId": "updateHoldPriority",
416       "tags": [
417         "biblios",
418         "holds"
419       ],
420       "parameters": [
421         {
422           "$ref": "../parameters.json#/hold_id_pp"
423         },
424         {
425           "name": "body",
426           "in": "body",
427           "description": "An integer representing the new priority to be set for the hold",
428           "required": true,
429           "schema": {
430             "type": "integer"
431           }
432         }
433       ],
434       "produces": [
435         "application/json"
436       ],
437       "responses": {
438         "200": {
439           "description": "The new priority value for the hold",
440           "schema": {
441             "type": "integer"
442           }
443         },
444         "401": {
445           "description": "Authentication required",
446           "schema": {
447             "$ref": "../definitions.json#/error"
448           }
449         },
450         "403": {
451           "description": "Access forbidden",
452           "schema": {
453             "$ref": "../definitions.json#/error"
454           }
455         },
456         "404": {
457           "description": "Biblio not found",
458           "schema": {
459             "$ref": "../definitions.json#/error"
460           }
461         },
462         "409": {
463           "description": "Unable to perform action on biblio",
464           "schema": {
465             "$ref": "../definitions.json#/error"
466           }
467         },
468         "500": {
469           "description": "Internal error",
470           "schema": {
471             "$ref": "../definitions.json#/error"
472           }
473         },
474         "503": {
475           "description": "Under maintenance",
476           "schema": {
477             "$ref": "../definitions.json#/error"
478           }
479         }
480       },
481       "x-koha-authorization": {
482         "permissions": {
483           "reserveforothers": "modify_holds_priority"
484         }
485       }
486     }
487   },
488   "/holds/{hold_id}/suspension": {
489     "post": {
490       "x-mojo-to": "Holds#suspend",
491       "operationId": "suspendHold",
492       "tags": ["holds"],
493       "parameters": [{
494           "$ref": "../parameters.json#/hold_id_pp"
495         }, {
496           "name": "body",
497           "in": "body",
498           "description": "A JSON object containing fields to modify",
499           "required": false,
500           "schema": {
501             "type": "object",
502             "properties": {
503               "end_date": {
504                 "description": "Date the hold suspension expires",
505                 "type": "string",
506                 "format": "date"
507               }
508             }
509           }
510         }
511       ],
512       "consumes": ["application/json"],
513       "produces": ["application/json"],
514       "responses": {
515         "201": {
516           "description": "Hold suspended"
517         },
518         "400": {
519           "description": "Missing or wrong parameters",
520           "schema": {
521             "$ref": "../definitions.json#/error"
522           }
523         },
524         "401": {
525           "description": "Authentication required",
526           "schema": {
527             "$ref": "../definitions.json#/error"
528           }
529         },
530         "403": {
531           "description": "Hold not allowed",
532           "schema": {
533             "$ref": "../definitions.json#/error"
534           }
535         },
536         "404": {
537           "description": "Hold not found",
538           "schema": {
539             "$ref": "../definitions.json#/error"
540           }
541         },
542         "500": {
543           "description": "Internal server error",
544           "schema": {
545             "$ref": "../definitions.json#/error"
546           }
547         },
548         "503": {
549           "description": "Under maintenance",
550           "schema": {
551             "$ref": "../definitions.json#/error"
552           }
553         }
554       },
555       "x-koha-authorization": {
556         "permissions": {
557           "reserveforothers": "1"
558         }
559       }
560     },
561     "delete": {
562       "x-mojo-to": "Holds#resume",
563       "operationId": "resumeHold",
564       "tags": ["holds"],
565       "parameters": [
566         {
567           "$ref": "../parameters.json#/hold_id_pp"
568         }
569       ],
570       "consumes": ["application/json"],
571       "produces": ["application/json"],
572       "responses": {
573         "204": {
574           "description": "Hold resumed"
575         },
576         "400": {
577           "description": "Missing or wrong parameters",
578           "schema": {
579             "$ref": "../definitions.json#/error"
580           }
581         },
582         "401": {
583           "description": "Authentication required",
584           "schema": {
585             "$ref": "../definitions.json#/error"
586           }
587         },
588         "403": {
589           "description": "Hold not allowed",
590           "schema": {
591             "$ref": "../definitions.json#/error"
592           }
593         },
594         "404": {
595           "description": "Hold not found",
596           "schema": {
597             "$ref": "../definitions.json#/error"
598           }
599         },
600         "500": {
601           "description": "Internal server error",
602           "schema": {
603             "$ref": "../definitions.json#/error"
604           }
605         },
606         "503": {
607           "description": "Under maintenance",
608           "schema": {
609             "$ref": "../definitions.json#/error"
610           }
611         }
612       },
613       "x-koha-authorization": {
614         "permissions": {
615           "reserveforothers": "1"
616         }
617       }
618     }
619   },
620   "/holds/{hold_id}/pickup_locations": {
621     "get": {
622       "x-mojo-to": "Holds#pickup_locations",
623       "operationId": "getHoldPickupLocations",
624       "tags": ["holds"],
625       "parameters": [
626         {
627           "$ref": "../parameters.json#/hold_id_pp"
628         },
629         {
630           "$ref": "../parameters.json#/match"
631         },
632         {
633           "$ref": "../parameters.json#/order_by"
634         },
635         {
636           "$ref": "../parameters.json#/page"
637         },
638         {
639           "$ref": "../parameters.json#/per_page"
640         },
641         {
642           "$ref": "../parameters.json#/q_param"
643         },
644         {
645           "$ref": "../parameters.json#/q_body"
646         },
647         {
648           "$ref": "../parameters.json#/q_header"
649         }
650       ],
651       "produces": ["application/json"],
652       "responses": {
653         "200": {
654           "description": "Hold pickup location",
655           "schema": {
656             "type": "array",
657             "items": {
658               "$ref": "../definitions.json#/library"
659             }
660           }
661         },
662         "400": {
663           "description": "Missing or wrong parameters",
664           "schema": {
665             "$ref": "../definitions.json#/error"
666           }
667         },
668         "401": {
669           "description": "Authentication required",
670           "schema": {
671             "$ref": "../definitions.json#/error"
672           }
673         },
674         "403": {
675           "description": "Hold pickup location list not allowed",
676           "schema": {
677             "$ref": "../definitions.json#/error"
678           }
679         },
680         "404": {
681           "description": "Hold not found",
682           "schema": {
683             "$ref": "../definitions.json#/error"
684           }
685         },
686         "500": {
687           "description": "Internal server error",
688           "schema": {
689             "$ref": "../definitions.json#/error"
690           }
691         },
692         "503": {
693           "description": "Under maintenance",
694           "schema": {
695             "$ref": "../definitions.json#/error"
696           }
697         }
698       },
699       "x-koha-authorization": {
700         "permissions": {
701           "reserveforothers": "place_holds"
702         }
703       }
704     }
705   },
706   "/holds/{hold_id}/pickup_location": {
707     "put": {
708       "x-mojo-to": "Holds#update_pickup_location",
709       "operationId": "updateHoldPickupLocation",
710       "tags": ["holds"],
711       "parameters": [
712         {
713           "$ref": "../parameters.json#/hold_id_pp"
714         },
715         {
716           "name": "body",
717           "in": "body",
718           "description": "Pickup location",
719           "required": true,
720           "schema": {
721             "type": "string"
722           }
723         }
724       ],
725       "produces": [
726         "application/json"
727       ],
728       "responses": {
729         "200": {
730           "description": "The new pickup location value for the hold",
731           "schema": {
732             "type": "string"
733           }
734         },
735         "401": {
736           "description": "Authentication required",
737           "schema": {
738             "$ref": "../definitions.json#/error"
739           }
740         },
741         "403": {
742           "description": "Access forbidden",
743           "schema": {
744             "$ref": "../definitions.json#/error"
745           }
746         },
747         "404": {
748           "description": "Hold not found",
749           "schema": {
750             "$ref": "../definitions.json#/error"
751           }
752         },
753         "409": {
754           "description": "Unable to perform action on hold",
755           "schema": {
756             "$ref": "../definitions.json#/error"
757           }
758         },
759         "500": {
760           "description": "Internal error",
761           "schema": {
762             "$ref": "../definitions.json#/error"
763           }
764         },
765         "503": {
766           "description": "Under maintenance",
767           "schema": {
768             "$ref": "../definitions.json#/error"
769           }
770         }
771       },
772       "x-koha-authorization": {
773         "permissions": {
774           "reserveforothers": "place_holds"
775         }
776       }
777     }
778   }
779 }