Bug 22216: Make GET /patrons/{patron_id} staff only
[koha.git] / api / v1 / swagger / paths / patrons.json
1 {
2   "/patrons": {
3     "get": {
4       "x-mojo-to": "Patrons#list",
5       "operationId": "listPatrons",
6       "tags": ["patrons"],
7       "produces": [
8           "application/json"
9       ],
10       "parameters": [{
11         "name": "patron_id",
12         "in": "query",
13         "description": "Search on patron_id",
14         "required": false,
15         "type": "string"
16       }, {
17         "name": "cardnumber",
18         "in": "query",
19         "description": "Case insensitive search on cardnumber",
20         "required": false,
21         "type": "string"
22       }, {
23         "name": "surname",
24         "in": "query",
25         "description": "Case insensitive search on surname",
26         "required": false,
27         "type": "string"
28       }, {
29         "name": "firstname",
30         "in": "query",
31         "description": "Case insensitive search on firstname",
32         "required": false,
33         "type": "string"
34       }, {
35         "name": "title",
36         "in": "query",
37         "description": "Case insensitive search on title",
38         "required": false,
39         "type": "string"
40       }, {
41         "name": "other_name",
42         "in": "query",
43         "description": "Case insensitive search on othernames",
44         "required": false,
45         "type": "string"
46       }, {
47         "name": "initials",
48         "in": "query",
49         "description": "Case insensitive search on initials",
50         "required": false,
51         "type": "string"
52       }, {
53         "name": "street_number",
54         "in": "query",
55         "description": "Case insensitive search on streetnumber",
56         "required": false,
57         "type": "string"
58       }, {
59         "name": "street_type",
60         "in": "query",
61         "description": "Case insensitive search on streettype",
62         "required": false,
63         "type": "string"
64       }, {
65         "name": "address",
66         "in": "query",
67         "description": "Case insensitive search on address",
68         "required": false,
69         "type": "string"
70       }, {
71         "name": "address2",
72         "in": "query",
73         "description": "Case insensitive search on address2",
74         "required": false,
75         "type": "string"
76       }, {
77         "name": "city",
78         "in": "query",
79         "description": "Case insensitive search on city",
80         "required": false,
81         "type": "string"
82       }, {
83         "name": "state",
84         "in": "query",
85         "description": "Case insensitive search on state",
86         "required": false,
87         "type": "string"
88       }, {
89         "name": "postal_code",
90         "in": "query",
91         "description": "Case insensitive search on zipcode",
92         "required": false,
93         "type": "string"
94       }, {
95         "name": "country",
96         "in": "query",
97         "description": "Case insensitive search on country",
98         "required": false,
99         "type": "string"
100       }, {
101         "name": "email",
102         "in": "query",
103         "description": "Case insensitive search on email",
104         "required": false,
105         "type": "string"
106       }, {
107         "name": "phone",
108         "in": "query",
109         "description": "Case insensitive search on phone",
110         "required": false,
111         "type": "string"
112       }, {
113         "name": "mobile",
114         "in": "query",
115         "description": "Case insensitive search on mobile",
116         "required": false,
117         "type": "string"
118       }, {
119         "name": "fax",
120         "in": "query",
121         "description": "Case insensitive search on fax",
122         "required": false,
123         "type": "string"
124       }, {
125         "name": "secondary_email",
126         "in": "query",
127         "description": "Case insensitive search on secondary_email",
128         "required": false,
129         "type": "string"
130       }, {
131         "name": "secondary_phone",
132         "in": "query",
133         "description": "Case insensitive search on secondary_phone",
134         "required": false,
135         "type": "string"
136       }, {
137         "name": "altaddress_street_number",
138         "in": "query",
139         "description": "Case insensitive search on altaddress_street_number",
140         "required": false,
141         "type": "string"
142       }, {
143         "name": "altaddress_street_type",
144         "in": "query",
145         "description": "Case insensitive search on altaddress_street_type",
146         "required": false,
147         "type": "string"
148       }, {
149         "name": "altaddress_address",
150         "in": "query",
151         "description": "Case insensitive search on altaddress_address",
152         "required": false,
153         "type": "string"
154       }, {
155         "name": "altaddress_address2",
156         "in": "query",
157         "description": "Case insensitive search on altaddress_address2",
158         "required": false,
159         "type": "string"
160       }, {
161         "name": "altaddress_city",
162         "in": "query",
163         "description": "Case insensitive search on altaddress_city",
164         "required": false,
165         "type": "string"
166       }, {
167         "name": "altaddress_state",
168         "in": "query",
169         "description": "Case insensitive search on altaddress_state",
170         "required": false,
171         "type": "string"
172       }, {
173         "name": "altaddress_postal_code",
174         "in": "query",
175         "description": "Case insensitive search on altaddress_postal_code",
176         "required": false,
177         "type": "string"
178       }, {
179         "name": "altaddress_country",
180         "in": "query",
181         "description": "Case insensitive search on altaddress_country",
182         "required": false,
183         "type": "string"
184       }, {
185         "name": "altaddress_email",
186         "in": "query",
187         "description": "Case insensitive search on altaddress_email",
188         "required": false,
189         "type": "string"
190       }, {
191         "name": "altaddress_phone",
192         "in": "query",
193         "description": "Case insensitive search on altaddress_phone",
194         "required": false,
195         "type": "string"
196       }, {
197         "name": "date_of_birth",
198         "in": "query",
199         "description": "Case insensitive search on date_of_birth",
200         "required": false,
201         "type": "string"
202       }, {
203         "name": "library_id",
204         "in": "query",
205         "description": "Case insensitive search on library_id",
206         "required": false,
207         "type": "string"
208       }, {
209         "name": "category_id",
210         "in": "query",
211         "description": "Case insensitive search on category_id",
212         "required": false,
213         "type": "string"
214       }, {
215         "name": "date_enrolled",
216         "in": "query",
217         "description": "Case insensitive search on date_enrolled",
218         "required": false,
219         "type": "string"
220       }, {
221         "name": "expiry_date",
222         "in": "query",
223         "description": "Case insensitive search on expiry_date",
224         "required": false,
225         "type": "string"
226       }, {
227         "name": "incorrect_address",
228         "in": "query",
229         "description": "Search on incorrect_address",
230         "required": false,
231         "type": "boolean"
232       }, {
233         "name": "patron_card_lost",
234         "in": "query",
235         "description": "Search on patron_card_lost",
236         "required": false,
237         "type": "boolean"
238       }, {
239         "name": "restricted",
240         "in": "query",
241         "description": "Filter search by restricted",
242         "required": false,
243         "type": "boolean"
244       }, {
245         "name": "guarantor_id",
246         "in": "query",
247         "description": "Search on guarantor_id",
248         "required": false,
249         "type": "string"
250       }, {
251         "name": "staff_notes",
252         "in": "query",
253         "description": "Case insensitive search on staff_notes",
254         "required": false,
255         "type": "string"
256       }, {
257         "name": "relationship_type",
258         "in": "query",
259         "description": "Case insensitive search on relationship_type",
260         "required": false,
261         "type": "string"
262       }, {
263         "name": "gender",
264         "in": "query",
265         "description": "Case insensitive search on gender",
266         "required": false,
267         "type": "string"
268       }, {
269         "name": "userid",
270         "in": "query",
271         "description": "Case insensitive search on userid",
272         "required": false,
273         "type": "string"
274       }, {
275         "name": "opac_notes",
276         "in": "query",
277         "description": "Case insensitive search on opac_notes",
278         "required": false,
279         "type": "string"
280       }, {
281         "name": "altaddress_notes",
282         "in": "query",
283         "description": "Case insensitive search on altaddress_notes",
284         "required": false,
285         "type": "string"
286       }, {
287         "name": "statistics_1",
288         "in": "query",
289         "description": "Case insensitive search on statistics_1",
290         "required": false,
291         "type": "string"
292       }, {
293         "name": "statistics_2",
294         "in": "query",
295         "description": "Case insensitive search on statistics_2",
296         "required": false,
297         "type": "string"
298       }, {
299         "name": "altcontact_firstname",
300         "in": "query",
301         "description": "Case insensitive search on altcontact_firstname",
302         "required": false,
303         "type": "string"
304       }, {
305         "name": "altcontact_surname",
306         "in": "query",
307         "description": "Case insensitive search on altcontact_surname",
308         "required": false,
309         "type": "string"
310       }, {
311         "name": "altcontact_address",
312         "in": "query",
313         "description": "Case insensitive search on altcontact_address",
314         "required": false,
315         "type": "string"
316       }, {
317         "name": "altcontact_address2",
318         "in": "query",
319         "description": "Case insensitive search on altcontact_address2",
320         "required": false,
321         "type": "string"
322       }, {
323         "name": "altcontact_city",
324         "in": "query",
325         "description": "Case insensitive search on altcontact_city",
326         "required": false,
327         "type": "string"
328       }, {
329         "name": "altcontact_state",
330         "in": "query",
331         "description": "Case insensitive search on altcontact_state",
332         "required": false,
333         "type": "string"
334       }, {
335         "name": "altcontact_postal_code",
336         "in": "query",
337         "description": "Case insensitive search on altcontact_postal_code",
338         "required": false,
339         "type": "string"
340       }, {
341         "name": "altcontact_country",
342         "in": "query",
343         "description": "Case insensitive search on altcontact_country",
344         "required": false,
345         "type": "string"
346       }, {
347         "name": "altcontact_phone",
348         "in": "query",
349         "description": "Case insensitive search on altcontact_phone",
350         "required": false,
351         "type": "string"
352       }, {
353         "name": "sms_number",
354         "in": "query",
355         "description": "Case insensitive search on sms_number",
356         "required": false,
357         "type": "string"
358       }, {
359         "name": "sms_provider_id",
360         "in": "query",
361         "description": "Case insensitive search on sms_provider_id",
362         "required": false,
363         "type": "string"
364       }, {
365         "name": "privacy",
366         "in": "query",
367         "description": "Search on privacy",
368         "required": false,
369         "type": "string"
370       }, {
371         "name": "privacy_guarantor_checkouts",
372         "in": "query",
373         "description": "Search on privacy_guarantor_checkouts",
374         "required": false,
375         "type": "string"
376       }, {
377         "name": "check_previous_checkout",
378         "in": "query",
379         "description": "Case insensitive search on check_previous_checkout",
380         "required": false,
381         "type": "string"
382       }, {
383         "name": "updated_on",
384         "in": "query",
385         "description": "Search on updated_on",
386         "required": false,
387         "type": "string"
388       }, {
389         "name": "last_seen",
390         "in": "query",
391         "description": "Case insensitive search on last_seen",
392         "required": false,
393         "type": "string"
394       }, {
395         "name": "lang",
396         "in": "query",
397         "description": "Case insensitive search on lang",
398         "required": false,
399         "type": "string"
400       }, {
401         "name": "login_attempts",
402         "in": "query",
403         "description": "Search on login_attempts",
404         "required": false,
405         "type": "string"
406       }, {
407         "$ref": "../parameters.json#/match"
408       }, {
409         "$ref": "../parameters.json#/order_by"
410       }, {
411         "$ref": "../parameters.json#/page"
412       }, {
413         "$ref": "../parameters.json#/per_page"
414       }],
415       "responses": {
416         "200": {
417           "description": "A list of patrons",
418           "schema": {
419             "type": "array",
420             "items": {
421               "$ref": "../definitions.json#/patron"
422             }
423           }
424         },
425         "401": {
426           "description": "Authentication required",
427           "schema": {
428             "$ref": "../definitions.json#/error"
429           }
430         },
431         "403": {
432           "description": "Access forbidden",
433           "schema": {
434             "$ref": "../definitions.json#/error"
435           }
436         },
437         "500": {
438           "description": "Internal server error",
439           "schema": {
440             "$ref": "../definitions.json#/error"
441           }
442         }
443       },
444       "x-koha-authorization": {
445         "permissions": {
446           "borrowers": "1"
447         }
448       }
449     },
450     "post": {
451       "x-mojo-to": "Patrons#add",
452       "operationId": "addPatron",
453       "tags": ["patrons"],
454       "parameters": [{
455         "name": "body",
456         "in": "body",
457         "description": "A JSON object containing information about the new patron",
458         "required": true,
459         "schema": {
460           "$ref": "../definitions.json#/patron"
461         }
462       }],
463       "consumes": ["application/json"],
464       "produces": ["application/json"],
465       "responses": {
466         "201": {
467           "description": "A successfully created patron",
468           "schema": {
469             "items": {
470               "$ref": "../definitions.json#/patron"
471             }
472           }
473         },
474         "400": {
475           "description": "Bad parameter",
476           "schema": {
477             "$ref": "../definitions.json#/error"
478           }
479         },
480         "401": {
481           "description": "Authentication required",
482           "schema": {
483             "$ref": "../definitions.json#/error"
484           }
485         },
486         "403": {
487           "description": "Access forbidden",
488           "schema": {
489             "$ref": "../definitions.json#/error"
490           }
491         },
492         "404": {
493           "description": "Resource not found",
494           "schema": {
495             "$ref": "../definitions.json#/error"
496           }
497         },
498         "409": {
499           "description": "Conflict in creating resource",
500           "schema": {
501             "$ref": "../definitions.json#/error"
502           }
503         },
504         "500": {
505           "description": "Internal server error",
506           "schema": {
507             "$ref": "../definitions.json#/error"
508           }
509         },
510         "503": {
511           "description": "Under maintenance",
512           "schema": {
513             "$ref": "../definitions.json#/error"
514           }
515         }
516       },
517       "x-koha-authorization": {
518         "permissions": {
519           "borrowers": "edit_borrowers"
520         }
521       }
522     }
523   },
524   "/patrons/{patron_id}": {
525     "get": {
526       "x-mojo-to": "Patrons#get",
527       "operationId": "getPatron",
528       "tags": ["patrons"],
529       "parameters": [{
530           "$ref": "../parameters.json#/patron_id_pp"
531       }],
532       "produces": [
533         "application/json"
534       ],
535       "responses": {
536         "200": {
537           "description": "A patron",
538           "schema": {
539             "$ref": "../definitions.json#/patron"
540           }
541         },
542         "401": {
543           "description": "Authentication required",
544           "schema": {
545             "$ref": "../definitions.json#/error"
546           }
547         },
548         "403": {
549           "description": "Access forbidden",
550           "schema": {
551             "$ref": "../definitions.json#/error"
552           }
553         },
554         "404": {
555           "description": "Patron not found",
556           "schema": {
557             "$ref": "../definitions.json#/error"
558           }
559         },
560         "500": {
561           "description": "Internal server error",
562           "schema": {
563             "$ref": "../definitions.json#/error"
564           }
565         },
566         "503": {
567           "description": "Under maintenance",
568           "schema": {
569             "$ref": "../definitions.json#/error"
570           }
571         }
572       },
573       "x-koha-authorization": {
574         "permissions": {
575           "borrowers": "edit_borrowers"
576         }
577       }
578     },
579     "put": {
580       "x-mojo-to": "Patrons#update",
581       "operationId": "updatePatron",
582       "tags": ["patrons"],
583       "parameters": [
584         {
585           "$ref": "../parameters.json#/patron_id_pp"
586         },
587         {
588           "name": "body",
589           "in": "body",
590           "description": "A JSON object containing new information about existing patron",
591           "required": true,
592           "schema": {
593             "$ref": "../definitions.json#/patron"
594           }
595         }
596       ],
597       "consumes": ["application/json"],
598       "produces": ["application/json"],
599       "responses": {
600         "200": {
601           "description": "A successfully updated patron",
602           "schema": {
603             "items": {
604               "$ref": "../definitions.json#/patron"
605             }
606           }
607         },
608         "202": {
609           "description": "Accepted and waiting for librarian verification",
610           "schema": {
611             "type": "object"
612           }
613         },
614         "204": {
615           "description": "No Content",
616           "schema": {
617             "type": "object"
618           }
619         },
620         "400": {
621           "description": "Bad parameter",
622           "schema": {
623             "$ref": "../definitions.json#/error"
624           }
625         },
626         "403": {
627           "description": "Access forbidden",
628           "schema": {
629             "$ref": "../definitions.json#/error"
630           }
631         },
632         "404": {
633           "description": "Resource not found",
634           "schema": {
635             "$ref": "../definitions.json#/error"
636           }
637         },
638         "409": {
639           "description": "Conflict in updating resource",
640           "schema": {
641             "$ref": "../definitions.json#/error"
642           }
643         },
644         "500": {
645           "description": "Internal server error",
646           "schema": {
647             "$ref": "../definitions.json#/error"
648           }
649         }
650       },
651       "x-koha-authorization": {
652         "permissions": {
653           "borrowers": "1"
654         }
655       }
656     },
657     "delete": {
658       "x-mojo-to": "Patrons#delete",
659       "operationId": "deletePatron",
660       "tags": ["patrons"],
661       "parameters": [{
662         "$ref": "../parameters.json#/patron_id_pp"
663       }],
664       "produces": ["application/json"],
665       "responses": {
666         "200": {
667           "description": "Patron deleted successfully",
668           "schema": {
669             "type": "object"
670           }
671         },
672         "400": {
673           "description": "Patron deletion failed",
674           "schema": {
675             "$ref": "../definitions.json#/error"
676           }
677         },
678         "401": {
679           "description": "Authentication required",
680           "schema": {
681             "$ref": "../definitions.json#/error"
682           }
683         },
684         "403": {
685           "description": "Access forbidden",
686           "schema": {
687             "$ref": "../definitions.json#/error"
688           }
689         },
690         "404": {
691           "description": "Patron not found",
692           "schema": {
693             "$ref": "../definitions.json#/error"
694           }
695         }
696       },
697       "x-koha-authorization": {
698         "permissions": {
699           "borrowers": "1"
700         }
701       }
702     }
703   }
704 }