Bug 13799: Add types for patron's fields in Swagger spec
[koha.git] / api / v1 / swagger.json
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         "x-mojo-controller": "Koha::REST::V1::Patrons",
20         "operationId": "listPatrons",
21         "tags": ["patrons"],
22         "produces": [
23           "application/json"
24         ],
25         "responses": {
26           "200": {
27             "description": "A list of patrons",
28             "schema": {
29               "type": "array",
30               "items": {
31                 "$ref": "#/definitions/patron"
32               }
33             }
34           },
35           "403": {
36             "description": "Access forbidden",
37             "schema": {
38               "$ref": "#/definitions/error"
39             }
40           }
41         }
42       }
43     },
44     "/patrons/{borrowernumber}": {
45       "get": {
46         "x-mojo-controller": "Koha::REST::V1::Patrons",
47         "operationId": "getPatron",
48         "tags": ["patrons"],
49         "parameters": [
50           {
51             "$ref": "#/parameters/borrowernumberPathParam"
52           }
53         ],
54         "produces": [
55           "application/json"
56         ],
57         "responses": {
58           "200": {
59             "description": "A patron",
60             "schema": {
61               "$ref": "#/definitions/patron"
62             }
63           },
64           "403": {
65             "description": "Access forbidden",
66             "schema": {
67               "$ref": "#/definitions/error"
68             }
69           },
70           "404": {
71             "description": "Patron not found",
72             "schema": {
73               "$ref": "#/definitions/error"
74             }
75           }
76         }
77       }
78     }
79   },
80   "definitions": {
81     "patron": {
82       "type": "object",
83       "properties": {
84         "borrowernumber": {
85           "$ref": "#/definitions/borrowernumber"
86         },
87         "cardnumber": {
88           "description": "library assigned ID number for patrons",
89           "type": ["string", "null"]
90         },
91         "surname": {
92           "description": "patron's last name",
93           "type": ["string", "null"]
94         },
95         "firstname": {
96           "description": "patron's first name",
97           "type": ["string", "null"]
98         },
99         "title": {
100           "description": "patron's title",
101           "type": ["string", "null"]
102         },
103         "othernames": {
104           "description": "any other names associated with the patron",
105           "type": ["string", "null"]
106         },
107         "initials": {
108           "description": "initials of the patron",
109           "type": ["string", "null"]
110         },
111         "streetnumber": {
112           "description": "street number of patron's primary address",
113           "type": ["string", "null"]
114         },
115         "streettype": {
116           "description": "street type of patron's primary address",
117           "type": ["string", "null"]
118         },
119         "address": {
120           "description": "first address line of patron's primary address",
121           "type": ["string", "null"]
122         },
123         "address2": {
124           "description": "second address line of patron's primary address",
125           "type": ["string", "null"]
126         },
127         "city": {
128           "description": "city or town of patron's primary address",
129           "type": ["string", "null"]
130         },
131         "state": {
132           "description": "state or province of patron's primary address",
133           "type": ["string", "null"]
134         },
135         "zipcode": {
136           "description": "zip or postal code of patron's primary address",
137           "type": ["string", "null"]
138         },
139         "country": {
140           "description": "country of patron's primary address",
141           "type": ["string", "null"]
142         },
143         "email": {
144           "description": "primary email address for patron's primary address",
145           "type": ["string", "null"]
146         },
147         "phone": {
148           "description": "primary phone number for patron's primary address",
149           "type": ["string", "null"]
150         },
151         "mobile": {
152           "description": "the other phone number for patron's primary address",
153           "type": ["string", "null"]
154         },
155         "fax": {
156           "description": "fax number for patron's primary address",
157           "type": ["string", "null"]
158         },
159         "emailpro": {
160           "description": "secondary email address for patron's primary address",
161           "type": ["string", "null"]
162         },
163         "phonepro": {
164           "description": "secondary phone number for patron's primary address",
165           "type": ["string", "null"]
166         },
167         "B_streetnumber": {
168           "description": "street number of patron's alternate address",
169           "type": ["string", "null"]
170         },
171         "B_streettype": {
172           "description": "street type of patron's alternate address",
173           "type": ["string", "null"]
174         },
175         "B_address": {
176           "description": "first address line of patron's alternate address",
177           "type": ["string", "null"]
178         },
179         "B_address2": {
180           "description": "second address line of patron's alternate address",
181           "type": ["string", "null"]
182         },
183         "B_city": {
184           "description": "city or town of patron's alternate address",
185           "type": ["string", "null"]
186         },
187         "B_state": {
188           "description": "state or province of patron's alternate address",
189           "type": ["string", "null"]
190         },
191         "B_zipcode": {
192           "description": "zip or postal code of patron's alternate address",
193           "type": ["string", "null"]
194         },
195         "B_country": {
196           "description": "country of patron's alternate address",
197           "type": ["string", "null"]
198         },
199         "B_email": {
200           "description": "email address for patron's alternate address",
201           "type": ["string", "null"]
202         },
203         "B_phone": {
204           "description": "phone number for patron's alternate address",
205           "type": ["string", "null"]
206         },
207         "dateofbirth": {
208           "description": "patron's date of birth",
209           "type": ["string", "null"]
210         },
211         "branchcode": {
212           "description": "code of patron's home branch",
213           "type": ["string", "null"]
214         },
215         "categorycode": {
216           "description": "code of patron's category",
217           "type": ["string", "null"]
218         },
219         "dateenrolled": {
220           "description": "date the patron was added to Koha",
221           "type": ["string", "null"]
222         },
223         "dateexpiry": {
224           "description": "date the patron's card is set to expire",
225           "type": ["string", "null"]
226         },
227         "gonenoaddress": {
228           "description": "set to 1 if library marked this patron as having an unconfirmed address",
229           "type": ["string", "null"]
230         },
231         "lost": {
232           "description": "set to 1 if library marked this patron as having lost his card",
233           "type": ["string", "null"]
234         },
235         "debarred": {
236           "description": "until this date the patron can only check-in",
237           "type": ["string", "null"]
238         },
239         "debarredcomment": {
240           "description": "comment on the stop of the patron",
241           "type": ["string", "null"]
242         },
243         "contactname": {
244           "description": "used for children and professionals to include surname or last name of guarantor or organization name",
245           "type": ["string", "null"]
246         },
247         "contactfirstname": {
248           "description": "used for children to include first name of guarantor",
249           "type": ["string", "null"]
250         },
251         "contacttitle": {
252           "description": "used for children to include title of guarantor",
253           "type": ["string", "null"]
254         },
255         "guarantorid": {
256           "description": "borrowernumber used for children or professionals to link them to guarantor or organizations",
257           "type": ["string", "null"]
258         },
259         "borrowernotes": {
260           "description": "a note on the patron's account",
261           "type": ["string", "null"]
262         },
263         "relationship": {
264           "description": "used for children to include the relationship to their guarantor",
265           "type": ["string", "null"]
266         },
267         "ethnicity": {
268           "description": "unused",
269           "type": ["string", "null"]
270         },
271         "ethnotes": {
272           "description": "unused",
273           "type": ["string", "null"]
274         },
275         "sex": {
276           "description": "patron's gender",
277           "type": ["string", "null"]
278         },
279         "password": {
280           "description": "patron's encrypted password",
281           "type": ["string", "null"]
282         },
283         "flags": {
284           "description": "a number associated with the patron's permissions",
285           "type": ["string", "null"]
286         },
287         "userid": {
288           "description": "patron's login",
289           "type": ["string", "null"]
290         },
291         "opacnote": {
292           "description": "a note on the patron's account visible in OPAC and staff client",
293           "type": ["string", "null"]
294         },
295         "contactnote": {
296           "description": "a note related to patron's alternate address",
297           "type": ["string", "null"]
298         },
299         "sort1": {
300           "description": "a field that can be used for any information unique to the library",
301           "type": ["string", "null"]
302         },
303         "sort2": {
304           "description": "a field that can be used for any information unique to the library",
305           "type": ["string", "null"]
306         },
307         "altcontactfirstname": {
308           "description": "first name of alternate contact for the patron",
309           "type": ["string", "null"]
310         },
311         "altcontactsurname": {
312           "description": "surname or last name of the alternate contact for the patron",
313           "type": ["string", "null"]
314         },
315         "altcontactaddress1": {
316           "description": "the first address line for the alternate contact for the patron",
317           "type": ["string", "null"]
318         },
319         "altcontactaddress2": {
320           "description": "the second address line for the alternate contact for the patron",
321           "type": ["string", "null"]
322         },
323         "altcontactaddress3": {
324           "description": "the city for the alternate contact for the patron",
325           "type": ["string", "null"]
326         },
327         "altcontactstate": {
328           "description": "the state for the alternate contact for the patron",
329           "type": ["string", "null"]
330         },
331         "altcontactzipcode": {
332           "description": "the zipcode for the alternate contact for the patron",
333           "type": ["string", "null"]
334         },
335         "altcontactcountry": {
336           "description": "the country for the alternate contact for the patron",
337           "type": ["string", "null"]
338         },
339         "altcontactphone": {
340           "description": "the phone number for the alternate contact for the patron",
341           "type": ["string", "null"]
342         },
343         "smsalertnumber": {
344           "description": "the mobile phone number where the patron would like to receive notices (if SMS turned on)",
345           "type": ["string", "null"]
346         },
347         "privacy": {
348           "description": "patron's privacy settings related to their reading history",
349           "type": ["string", "null"]
350         }
351       }
352     },
353     "borrowernumber": {
354       "description": "Patron internal identifier"
355     },
356     "error": {
357       "type": "object",
358       "properties": {
359         "error": {
360           "description": "Error message",
361           "type": "string"
362         }
363       }
364     }
365   },
366   "parameters": {
367     "borrowernumberPathParam": {
368       "name": "borrowernumber",
369       "in": "path",
370       "description": "Internal patron identifier",
371       "required": true,
372       "type": "integer"
373     }
374   }
375 }