Bug 16699: Reference new x-primitives in currently defined objects
[koha.git] / api / v1 / 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     },
129     "post": {
130       "operationId": "addHold",
131       "tags": ["borrowers", "holds"],
132       "parameters": [{
133           "name": "body",
134           "in": "body",
135           "description": "A JSON object containing informations about the new hold",
136           "required": true,
137           "schema": {
138             "type": "object",
139             "properties": {
140               "borrowernumber": {
141                 "description": "Borrower internal identifier",
142                 "type": "integer"
143               },
144               "biblionumber": {
145                 "description": "Biblio internal identifier",
146                 "type": "integer"
147               },
148               "itemnumber": {
149                 "description": "Item internal identifier",
150                 "type": "integer"
151               },
152               "branchcode": {
153                 "description": "Pickup location",
154                 "type": "string"
155               },
156               "expirationdate": {
157                 "description": "Hold end date",
158                 "type": "string",
159                 "format": "date"
160               }
161             }
162           }
163         }
164       ],
165       "consumes": ["application/json"],
166       "produces": ["application/json"],
167       "responses": {
168         "201": {
169           "description": "Created hold",
170           "schema": {
171             "$ref": "../definitions.json#/hold"
172           }
173         },
174         "400": {
175           "description": "Missing or wrong parameters",
176           "schema": {
177             "$ref": "../definitions.json#/error"
178           }
179         },
180         "403": {
181           "description": "Hold not allowed",
182           "schema": {
183             "$ref": "../definitions.json#/error"
184           }
185         },
186         "404": {
187           "description": "Borrower not found",
188           "schema": {
189             "$ref": "../definitions.json#/error"
190           }
191         },
192         "500": {
193           "description": "Internal error",
194           "schema": {
195             "$ref": "../definitions.json#/error"
196           }
197         }
198       }
199     }
200   },
201   "/holds/{reserve_id}": {
202     "put": {
203       "operationId": "editHold",
204       "tags": ["holds"],
205       "parameters": [{
206           "$ref": "../parameters.json#/holdIdPathParam"
207         }, {
208           "name": "body",
209           "in": "body",
210           "description": "A JSON object containing fields to modify",
211           "required": true,
212           "schema": {
213             "type": "object",
214             "properties": {
215               "priority": {
216                 "description": "Position in waiting queue",
217                 "type": "integer",
218                 "minimum": 1
219               },
220               "branchcode": {
221                 "description": "Pickup location",
222                 "type": "string"
223               },
224               "suspend_until": {
225                 "description": "Suspend until",
226                 "type": "string",
227                 "format": "date"
228               }
229             }
230           }
231         }
232       ],
233       "consumes": ["application/json"],
234       "produces": ["application/json"],
235       "responses": {
236         "200": {
237           "description": "Updated hold",
238           "schema": {
239             "$ref": "../definitions.json#/hold"
240           }
241         },
242         "400": {
243           "description": "Missing or wrong parameters",
244           "schema": {
245             "$ref": "../definitions.json#/error"
246           }
247         },
248         "404": {
249           "description": "Hold not found",
250           "schema": {
251             "$ref": "../definitions.json#/error"
252           }
253         }
254       }
255     },
256     "delete": {
257       "operationId": "deleteHold",
258       "tags": ["holds"],
259       "parameters": [{
260           "$ref": "../parameters.json#/holdIdPathParam"
261         }
262       ],
263       "produces": ["application/json"],
264       "responses": {
265         "200": {
266           "description": "Successful deletion",
267           "schema": {
268             "type": "object"
269           }
270         },
271         "404": {
272           "description": "Hold not found",
273           "schema": {
274             "$ref": "../definitions.json#/error"
275           }
276         }
277       }
278     }
279   }
280 }