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