Line 0
Link Here
|
|
|
1 |
{ |
2 |
"swagger": "2.0", |
3 |
"info": { |
4 |
"title": "Koha REST API", |
5 |
"version": "1", |
6 |
"license": { |
7 |
"name": "GPL v3", |
8 |
"url": "http://www.gnu.org/licenses/gpl.txt" |
9 |
}, |
10 |
"contact": { |
11 |
"name": "Koha Team", |
12 |
"url": "http://koha-community.org/" |
13 |
} |
14 |
}, |
15 |
"basePath": "/api/v1", |
16 |
"paths": { |
17 |
"/patrons": { |
18 |
"get": { |
19 |
"operationId": "listPatrons", |
20 |
"tags": ["patrons"], |
21 |
"produces": [ |
22 |
"application/json" |
23 |
], |
24 |
"responses": { |
25 |
"200": { |
26 |
"description": "A list of patrons", |
27 |
"schema": { |
28 |
"type": "array", |
29 |
"items": { |
30 |
"$ref": "#/definitions/patron" |
31 |
} |
32 |
} |
33 |
}, |
34 |
"403": { |
35 |
"description": "Access forbidden", |
36 |
"schema": { |
37 |
"$ref": "#/definitions/error" |
38 |
} |
39 |
} |
40 |
} |
41 |
} |
42 |
}, |
43 |
"/patrons/{borrowernumber}": { |
44 |
"get": { |
45 |
"operationId": "getPatron", |
46 |
"tags": ["patrons"], |
47 |
"parameters": [ |
48 |
{ |
49 |
"$ref": "#/parameters/borrowernumberPathParam" |
50 |
} |
51 |
], |
52 |
"produces": [ |
53 |
"application/json" |
54 |
], |
55 |
"responses": { |
56 |
"200": { |
57 |
"description": "A patron", |
58 |
"schema": { |
59 |
"$ref": "#/definitions/patron" |
60 |
} |
61 |
}, |
62 |
"403": { |
63 |
"description": "Access forbidden", |
64 |
"schema": { |
65 |
"$ref": "#/definitions/error" |
66 |
} |
67 |
}, |
68 |
"404": { |
69 |
"description": "Patron not found", |
70 |
"schema": { |
71 |
"$ref": "#/definitions/error" |
72 |
} |
73 |
} |
74 |
} |
75 |
} |
76 |
}, |
77 |
"/holds": { |
78 |
"get": { |
79 |
"operationId": "listHolds", |
80 |
"tags": ["borrowers", "holds"], |
81 |
"parameters": [ |
82 |
{ |
83 |
"name": "reserve_id", |
84 |
"in": "query", |
85 |
"description": "Internal reserve identifier", |
86 |
"type": "integer" |
87 |
}, |
88 |
{ |
89 |
"name": "borrowernumber", |
90 |
"in": "query", |
91 |
"description": "Internal borrower identifier", |
92 |
"type": "integer" |
93 |
}, |
94 |
{ |
95 |
"name": "reservedate", |
96 |
"in": "query", |
97 |
"description": "Reserve date", |
98 |
"type": "string" |
99 |
}, |
100 |
{ |
101 |
"name": "biblionumber", |
102 |
"in": "query", |
103 |
"description": "Internal biblio identifier", |
104 |
"type": "integer" |
105 |
}, |
106 |
{ |
107 |
"name": "branchcode", |
108 |
"in": "query", |
109 |
"description": "Branch code", |
110 |
"type": "string" |
111 |
}, |
112 |
{ |
113 |
"name": "notificationdate", |
114 |
"in": "query", |
115 |
"description": "Notification date", |
116 |
"type": "string" |
117 |
}, |
118 |
{ |
119 |
"name": "reminderdate", |
120 |
"in": "query", |
121 |
"description": "Reminder date", |
122 |
"type": "string" |
123 |
}, |
124 |
{ |
125 |
"name": "cancellationdate", |
126 |
"in": "query", |
127 |
"description": "Cancellation date", |
128 |
"type": "string" |
129 |
}, |
130 |
{ |
131 |
"name": "reservenotes", |
132 |
"in": "query", |
133 |
"description": "Reserve notes", |
134 |
"type": "string" |
135 |
}, |
136 |
{ |
137 |
"name": "priority", |
138 |
"in": "query", |
139 |
"description": "Priority", |
140 |
"type": "integer" |
141 |
}, |
142 |
{ |
143 |
"name": "found", |
144 |
"in": "query", |
145 |
"description": "Found status", |
146 |
"type": "string" |
147 |
}, |
148 |
{ |
149 |
"name": "timestamp", |
150 |
"in": "query", |
151 |
"description": "Time of latest update", |
152 |
"type": "string" |
153 |
}, |
154 |
{ |
155 |
"name": "itemnumber", |
156 |
"in": "query", |
157 |
"description": "Internal item identifier", |
158 |
"type": "integer" |
159 |
}, |
160 |
{ |
161 |
"name": "waitingdate", |
162 |
"in": "query", |
163 |
"description": "Date the item was marked as waiting for the patron", |
164 |
"type": "string" |
165 |
}, |
166 |
{ |
167 |
"name": "expirationdate", |
168 |
"in": "query", |
169 |
"description": "Date the hold expires", |
170 |
"type": "string" |
171 |
}, |
172 |
{ |
173 |
"name": "lowestPriority", |
174 |
"in": "query", |
175 |
"description": "Lowest priority", |
176 |
"type": "integer" |
177 |
}, |
178 |
{ |
179 |
"name": "suspend", |
180 |
"in": "query", |
181 |
"description": "Suspended", |
182 |
"type": "integer" |
183 |
}, |
184 |
{ |
185 |
"name": "suspend_until", |
186 |
"in": "query", |
187 |
"description": "Suspended until", |
188 |
"type": "string" |
189 |
} |
190 |
], |
191 |
"produces": ["application/json"], |
192 |
"responses": { |
193 |
"200": { |
194 |
"description": "A list of holds", |
195 |
"schema": { "$ref": "#/definitions/holds" } |
196 |
}, |
197 |
"404": { |
198 |
"description": "Borrower not found", |
199 |
"schema": { "$ref": "#/definitions/error" } |
200 |
} |
201 |
} |
202 |
}, |
203 |
"post": { |
204 |
"operationId": "addHold", |
205 |
"tags": ["borrowers", "holds"], |
206 |
"parameters": [ |
207 |
{ |
208 |
"name": "body", |
209 |
"in": "body", |
210 |
"description": "A JSON object containing informations about the new hold", |
211 |
"required": true, |
212 |
"schema": { |
213 |
"type": "object", |
214 |
"properties": { |
215 |
"borrowernumber": { |
216 |
"description": "Borrower internal identifier", |
217 |
"type": "integer" |
218 |
}, |
219 |
"biblionumber": { |
220 |
"description": "Biblio internal identifier", |
221 |
"type": "integer" |
222 |
}, |
223 |
"itemnumber": { |
224 |
"description": "Item internal identifier", |
225 |
"type": "integer" |
226 |
}, |
227 |
"branchcode": { |
228 |
"description": "Pickup location", |
229 |
"type": "string" |
230 |
}, |
231 |
"expirationdate": { |
232 |
"description": "Hold end date", |
233 |
"type": "string", |
234 |
"format": "date" |
235 |
} |
236 |
} |
237 |
} |
238 |
} |
239 |
], |
240 |
"consumes": ["application/json"], |
241 |
"produces": ["application/json"], |
242 |
"responses": { |
243 |
"201": { |
244 |
"description": "Created hold", |
245 |
"schema": { "$ref": "#/definitions/hold" } |
246 |
}, |
247 |
"400": { |
248 |
"description": "Missing or wrong parameters", |
249 |
"schema": { "$ref": "#/definitions/error" } |
250 |
}, |
251 |
"403": { |
252 |
"description": "Hold not allowed", |
253 |
"schema": { "$ref": "#/definitions/error" } |
254 |
}, |
255 |
"404": { |
256 |
"description": "Borrower not found", |
257 |
"schema": { "$ref": "#/definitions/error" } |
258 |
}, |
259 |
"500": { |
260 |
"description": "Internal error", |
261 |
"schema": { "$ref": "#/definitions/error" } |
262 |
} |
263 |
} |
264 |
} |
265 |
}, |
266 |
"/holds/{reserve_id}": { |
267 |
"put": { |
268 |
"operationId": "editHold", |
269 |
"tags": ["holds"], |
270 |
"parameters": [ |
271 |
{ "$ref": "#/parameters/holdIdPathParam" }, |
272 |
{ |
273 |
"name": "body", |
274 |
"in": "body", |
275 |
"description": "A JSON object containing fields to modify", |
276 |
"required": true, |
277 |
"schema": { |
278 |
"type": "object", |
279 |
"properties": { |
280 |
"priority": { |
281 |
"description": "Position in waiting queue", |
282 |
"type": "integer", |
283 |
"minimum": 1 |
284 |
}, |
285 |
"branchcode": { |
286 |
"description": "Pickup location", |
287 |
"type": "string" |
288 |
}, |
289 |
"suspend_until": { |
290 |
"description": "Suspend until", |
291 |
"type": "string", |
292 |
"format": "date" |
293 |
} |
294 |
} |
295 |
} |
296 |
} |
297 |
], |
298 |
"consumes": ["application/json"], |
299 |
"produces": ["application/json"], |
300 |
"responses": { |
301 |
"200": { |
302 |
"description": "Updated hold", |
303 |
"schema": { "$ref": "#/definitions/hold" } |
304 |
}, |
305 |
"400": { |
306 |
"description": "Missing or wrong parameters", |
307 |
"schema": { "$ref": "#/definitions/error" } |
308 |
}, |
309 |
"404": { |
310 |
"description": "Hold not found", |
311 |
"schema": { "$ref": "#/definitions/error" } |
312 |
} |
313 |
} |
314 |
}, |
315 |
"delete": { |
316 |
"operationId": "deleteHold", |
317 |
"tags": ["holds"], |
318 |
"parameters": [ |
319 |
{ "$ref": "#/parameters/holdIdPathParam" } |
320 |
], |
321 |
"produces": ["application/json"], |
322 |
"responses": { |
323 |
"200": { |
324 |
"description": "Successful deletion", |
325 |
"schema": { |
326 |
"type": "object" |
327 |
} |
328 |
}, |
329 |
"404": { |
330 |
"description": "Hold not found", |
331 |
"schema": { "$ref": "#/definitions/error" } |
332 |
} |
333 |
} |
334 |
} |
335 |
}, |
336 |
"/checkouts": { |
337 |
"get": { |
338 |
"operationId": "listCheckouts", |
339 |
"tags": ["borrowers", "checkouts"], |
340 |
"parameters": [ |
341 |
{ |
342 |
"name": "borrowernumber", |
343 |
"in": "query", |
344 |
"description": "Internal patron identifier", |
345 |
"required": false, |
346 |
"type": "integer" |
347 |
} |
348 |
], |
349 |
"produces": [ |
350 |
"application/json" |
351 |
], |
352 |
"responses": { |
353 |
"200": { |
354 |
"description": "A list of checkouts", |
355 |
"schema": { |
356 |
"$ref": "#/definitions/checkouts" |
357 |
} |
358 |
}, |
359 |
"403": { |
360 |
"description": "Access forbidden", |
361 |
"schema": { "$ref": "#/definitions/error" } |
362 |
}, |
363 |
"404": { |
364 |
"description": "Borrower not found", |
365 |
"schema": { |
366 |
"$ref": "#/definitions/error" |
367 |
} |
368 |
} |
369 |
} |
370 |
} |
371 |
}, |
372 |
"/checkouts/{checkout_id}": { |
373 |
"get": { |
374 |
"operationId": "getCheckout", |
375 |
"tags": ["borrowers", "checkouts"], |
376 |
"parameters": [ |
377 |
{ |
378 |
"name": "checkout_id", |
379 |
"in": "path", |
380 |
"description": "Internal checkout identifier", |
381 |
"required": true, |
382 |
"type": "integer" |
383 |
} |
384 |
], |
385 |
"produces": ["application/json"], |
386 |
"responses": { |
387 |
"200": { |
388 |
"description": "Updated borrower's checkout", |
389 |
"schema": { "$ref": "#/definitions/checkout" } |
390 |
}, |
391 |
"403": { |
392 |
"description": "Access forbidden", |
393 |
"schema": { "$ref": "#/definitions/error" } |
394 |
}, |
395 |
"404": { |
396 |
"description": "Checkout not found", |
397 |
"schema": { "$ref": "#/definitions/error" } |
398 |
} |
399 |
} |
400 |
}, |
401 |
"put": { |
402 |
"operationId": "renewCheckout", |
403 |
"tags": ["borrowers", "checkouts"], |
404 |
"parameters": [ |
405 |
{ |
406 |
"name": "checkout_id", |
407 |
"in": "path", |
408 |
"description": "Internal checkout identifier", |
409 |
"required": true, |
410 |
"type": "integer" |
411 |
} |
412 |
], |
413 |
"produces": ["application/json"], |
414 |
"responses": { |
415 |
"200": { |
416 |
"description": "Updated borrower's checkout", |
417 |
"schema": { "$ref": "#/definitions/checkout" } |
418 |
}, |
419 |
"403": { |
420 |
"description": "Cannot renew checkout", |
421 |
"schema": { "$ref": "#/definitions/error" } |
422 |
}, |
423 |
"404": { |
424 |
"description": "Checkout not found", |
425 |
"schema": { "$ref": "#/definitions/error" } |
426 |
} |
427 |
} |
428 |
} |
429 |
}, |
430 |
"/checkouts/history": { |
431 |
"get": { |
432 |
"operationId": "listhistoryCheckouts", |
433 |
"tags": ["patrons", "checkouts"], |
434 |
"parameters": [ |
435 |
{ |
436 |
"name": "borrowernumber", |
437 |
"in": "query", |
438 |
"description": "Internal patron identifier", |
439 |
"required": false, |
440 |
"type": "integer" |
441 |
} |
442 |
], |
443 |
"produces": [ |
444 |
"application/json" |
445 |
], |
446 |
"responses": { |
447 |
"200": { |
448 |
"description": "A list of checkouts history", |
449 |
"schema": { |
450 |
"$ref": "#/definitions/checkouts" |
451 |
} |
452 |
}, |
453 |
"403": { |
454 |
"description": "Access forbidden", |
455 |
"schema": { "$ref": "#/definitions/error" } |
456 |
}, |
457 |
"404": { |
458 |
"description": "Borrower not found", |
459 |
"schema": { |
460 |
"$ref": "#/definitions/error" |
461 |
} |
462 |
} |
463 |
} |
464 |
} |
465 |
}, |
466 |
"/checkouts/history/{checkout_id}": { |
467 |
"get": { |
468 |
"operationId": "gethistoryCheckout", |
469 |
"tags": ["patrons", "checkouts"], |
470 |
"parameters": [ |
471 |
{ |
472 |
"name": "checkout_id", |
473 |
"in": "path", |
474 |
"description": "Internal checkout identifier", |
475 |
"required": true, |
476 |
"type": "integer" |
477 |
} |
478 |
], |
479 |
"produces": ["application/json"], |
480 |
"responses": { |
481 |
"200": { |
482 |
"description": "Got borrower's checkout", |
483 |
"schema": { "$ref": "#/definitions/checkout" } |
484 |
}, |
485 |
"403": { |
486 |
"description": "Access forbidden", |
487 |
"schema": { "$ref": "#/definitions/error" } |
488 |
}, |
489 |
"404": { |
490 |
"description": "Checkout not found", |
491 |
"schema": { "$ref": "#/definitions/error" } |
492 |
} |
493 |
} |
494 |
} |
495 |
} |
496 |
}, |
497 |
"definitions": { |
498 |
"$ref": "./definitions/index.json" |
499 |
}, |
500 |
"parameters": { |
501 |
"borrowernumberPathParam": { |
502 |
"name": "borrowernumber", |
503 |
"in": "path", |
504 |
"description": "Internal patron identifier", |
505 |
"required": true, |
506 |
"type": "integer" |
507 |
}, |
508 |
"holdIdPathParam": { |
509 |
"name": "reserve_id", |
510 |
"in": "path", |
511 |
"description": "Internal hold identifier", |
512 |
"required": true, |
513 |
"type": "integer" |
514 |
} |
515 |
} |
516 |
} |