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