Bug 14868: Use x-koha-authorization in current routes
[koha.git] / api / v1 / swagger / paths / holds.json
1 {
2   "/holds": {
3     "get": {
4       "operationId": "listHolds",
5       "tags": ["borrowers", "holds"],
6       "parameters": [
7         {
8           "name": "reserve_id",
9           "in": "query",
10           "description": "Internal reserve identifier",
11           "type": "integer"
12         },
13         {
14           "$ref": "../parameters.json#/borrowernumberQueryParam"
15         },
16         {
17           "name": "reservedate",
18           "in": "query",
19           "description": "Reserve date",
20           "type": "string"
21         },
22         {
23           "name": "biblionumber",
24           "in": "query",
25           "description": "Internal biblio identifier",
26           "type": "integer"
27         },
28         {
29           "name": "branchcode",
30           "in": "query",
31           "description": "Branch code",
32           "type": "string"
33         },
34         {
35           "name": "notificationdate",
36           "in": "query",
37           "description": "Notification date",
38           "type": "string"
39         },
40         {
41           "name": "reminderdate",
42           "in": "query",
43           "description": "Reminder date",
44           "type": "string"
45         },
46         {
47           "name": "cancellationdate",
48           "in": "query",
49           "description": "Cancellation date",
50           "type": "string"
51         },
52         {
53           "name": "reservenotes",
54           "in": "query",
55           "description": "Reserve notes",
56           "type": "string"
57         },
58         {
59           "name": "priority",
60           "in": "query",
61           "description": "Priority",
62           "type": "integer"
63         },
64         {
65           "name": "found",
66           "in": "query",
67           "description": "Found status",
68           "type": "string"
69         },
70         {
71           "name": "timestamp",
72           "in": "query",
73           "description": "Time of latest update",
74           "type": "string"
75         },
76         {
77           "name": "itemnumber",
78           "in": "query",
79           "description": "Internal item identifier",
80           "type": "integer"
81         },
82         {
83           "name": "waitingdate",
84           "in": "query",
85           "description": "Date the item was marked as waiting for the patron",
86           "type": "string"
87         },
88         {
89           "name": "expirationdate",
90           "in": "query",
91           "description": "Date the hold expires",
92           "type": "string"
93         },
94         {
95           "name": "lowestPriority",
96           "in": "query",
97           "description": "Lowest priority",
98           "type": "integer"
99         },
100         {
101           "name": "suspend",
102           "in": "query",
103           "description": "Suspended",
104           "type": "integer"
105         },
106         {
107           "name": "suspend_until",
108           "in": "query",
109           "description": "Suspended until",
110           "type": "string"
111         }
112       ],
113       "produces": ["application/json"],
114       "responses": {
115         "200": {
116           "description": "A list of holds",
117           "schema": {
118             "$ref": "../definitions.json#/holds"
119           }
120         },
121         "404": {
122           "description": "Borrower not found",
123           "schema": {
124             "$ref": "../definitions.json#/error"
125           }
126         }
127       },
128       "x-koha-authorization": {
129         "allow-owner": true,
130         "allow-guarantor": true,
131         "permissions": {
132           "borrowers": "1"
133         }
134       }
135     },
136     "post": {
137       "operationId": "addHold",
138       "tags": ["borrowers", "holds"],
139       "parameters": [{
140           "name": "body",
141           "in": "body",
142           "description": "A JSON object containing informations about the new hold",
143           "required": true,
144           "schema": {
145             "type": "object",
146             "properties": {
147               "borrowernumber": {
148                 "description": "Borrower internal identifier",
149                 "type": "integer"
150               },
151               "biblionumber": {
152                 "description": "Biblio internal identifier",
153                 "type": "integer"
154               },
155               "itemnumber": {
156                 "description": "Item internal identifier",
157                 "type": "integer"
158               },
159               "branchcode": {
160                 "description": "Pickup location",
161                 "type": "string"
162               },
163               "expirationdate": {
164                 "description": "Hold end date",
165                 "type": "string",
166                 "format": "date"
167               }
168             }
169           }
170         }
171       ],
172       "consumes": ["application/json"],
173       "produces": ["application/json"],
174       "responses": {
175         "201": {
176           "description": "Created hold",
177           "schema": {
178             "$ref": "../definitions.json#/hold"
179           }
180         },
181         "400": {
182           "description": "Missing or wrong parameters",
183           "schema": {
184             "$ref": "../definitions.json#/error"
185           }
186         },
187         "403": {
188           "description": "Hold not allowed",
189           "schema": {
190             "$ref": "../definitions.json#/error"
191           }
192         },
193         "404": {
194           "description": "Borrower not found",
195           "schema": {
196             "$ref": "../definitions.json#/error"
197           }
198         },
199         "500": {
200           "description": "Internal error",
201           "schema": {
202             "$ref": "../definitions.json#/error"
203           }
204         }
205       },
206       "x-koha-authorization": {
207         "allow-owner": true,
208         "permissions": {
209           "reserveforothers": "1"
210         }
211       }
212     }
213   },
214   "/holds/{reserve_id}": {
215     "put": {
216       "operationId": "editHold",
217       "tags": ["holds"],
218       "parameters": [{
219           "$ref": "../parameters.json#/holdIdPathParam"
220         }, {
221           "name": "body",
222           "in": "body",
223           "description": "A JSON object containing fields to modify",
224           "required": true,
225           "schema": {
226             "type": "object",
227             "properties": {
228               "priority": {
229                 "description": "Position in waiting queue",
230                 "type": "integer",
231                 "minimum": 1
232               },
233               "branchcode": {
234                 "description": "Pickup location",
235                 "type": "string"
236               },
237               "suspend_until": {
238                 "description": "Suspend until",
239                 "type": "string",
240                 "format": "date"
241               }
242             }
243           }
244         }
245       ],
246       "consumes": ["application/json"],
247       "produces": ["application/json"],
248       "responses": {
249         "200": {
250           "description": "Updated hold",
251           "schema": {
252             "$ref": "../definitions.json#/hold"
253           }
254         },
255         "400": {
256           "description": "Missing or wrong parameters",
257           "schema": {
258             "$ref": "../definitions.json#/error"
259           }
260         },
261         "404": {
262           "description": "Hold not found",
263           "schema": {
264             "$ref": "../definitions.json#/error"
265           }
266         }
267       },
268       "x-koha-authorization": {
269         "allow-owner": true,
270         "allow-guarantor": true,
271         "permissions": {
272           "reserveforothers": "1"
273         }
274       }
275     },
276     "delete": {
277       "operationId": "deleteHold",
278       "tags": ["holds"],
279       "parameters": [{
280           "$ref": "../parameters.json#/holdIdPathParam"
281         }
282       ],
283       "produces": ["application/json"],
284       "responses": {
285         "200": {
286           "description": "Successful deletion",
287           "schema": {
288             "type": "object"
289           }
290         },
291         "404": {
292           "description": "Hold not found",
293           "schema": {
294             "$ref": "../definitions.json#/error"
295           }
296         }
297       },
298       "x-koha-authorization": {
299         "permissions": {
300           "reserveforothers": "1"
301         }
302       }
303     }
304   }
305 }