Bug 23666: Add PATCH /patron/:patron_id/extended_attributes/:extended_attribute_id
[koha.git] / api / v1 / swagger / paths / patrons_extended_attributes.json
1 {
2   "/patrons/{patron_id}/extended_attributes": {
3     "get": {
4       "x-mojo-to": "Patrons::Attributes#list_patron_attributes",
5       "operationId": "getPatronAttributes",
6       "tags": [
7         "patrons",
8         "extended_attributes"
9       ],
10       "parameters": [
11         {
12           "$ref": "../parameters.json#/patron_id_pp"
13         },
14         {
15           "$ref": "../parameters.json#/match"
16         },
17         {
18           "$ref": "../parameters.json#/order_by"
19         },
20         {
21           "$ref": "../parameters.json#/page"
22         },
23         {
24           "$ref": "../parameters.json#/per_page"
25         },
26         {
27           "$ref": "../parameters.json#/q_param"
28         },
29         {
30           "$ref": "../parameters.json#/q_body"
31         },
32         {
33           "$ref": "../parameters.json#/q_header"
34         }
35       ],
36       "produces": [
37         "application/json"
38       ],
39       "responses": {
40         "200": {
41           "description": "The patron extended attributes",
42           "schema": {
43             "type": "array",
44             "items": {
45               "$ref": "../definitions.json#/patron_extended_attribute"
46             }
47           }
48         },
49         "401": {
50           "description": "Authentication required",
51           "schema": {
52             "$ref": "../definitions.json#/error"
53           }
54         },
55         "403": {
56           "description": "Access forbidden",
57           "schema": {
58             "$ref": "../definitions.json#/error"
59           }
60         },
61         "404": {
62           "description": "Patron not found",
63           "schema": {
64             "$ref": "../definitions.json#/error"
65           }
66         },
67         "500": {
68           "description": "Internal server error",
69           "schema": {
70             "$ref": "../definitions.json#/error"
71           }
72         },
73         "503": {
74           "description": "Under maintenance",
75           "schema": {
76             "$ref": "../definitions.json#/error"
77           }
78         }
79       },
80       "x-koha-authorization": {
81         "permissions": {
82           "borrowers": "edit_borrowers"
83         }
84       }
85     },
86     "post": {
87       "x-mojo-to": "Patrons::Attributes#add",
88       "operationId": "addPatronAttribute",
89       "tags": [
90         "patrons",
91         "extended_attributes"
92       ],
93       "parameters": [
94         {
95           "$ref": "../parameters.json#/patron_id_pp"
96         },
97         {
98           "name": "body",
99           "in": "body",
100           "description": "A JSON representation of the patron extended attribute",
101           "required": true,
102           "schema": {
103             "$ref": "../definitions.json#/patron_extended_attribute"
104           }
105         }
106       ],
107       "produces": [
108         "application/json"
109       ],
110       "responses": {
111         "201": {
112           "description": "A successfully created patron extended attribute",
113           "schema": {
114             "$ref": "../definitions.json#/patron_extended_attribute"
115           }
116         },
117         "400": {
118           "description": "Bad parameter",
119           "schema": {
120             "$ref": "../definitions.json#/error"
121           }
122         },
123         "401": {
124           "description": "Authentication required",
125           "schema": {
126             "$ref": "../definitions.json#/error"
127           }
128         },
129         "403": {
130           "description": "Access forbidden",
131           "schema": {
132             "$ref": "../definitions.json#/error"
133           }
134         },
135         "404": {
136           "description": "Patron not found",
137           "schema": {
138             "$ref": "../definitions.json#/error"
139           }
140         },
141         "409": {
142           "description": "Conflict in creating resource",
143           "schema": {
144             "$ref": "../definitions.json#/error"
145           }
146         },
147         "500": {
148           "description": "Internal server error",
149           "schema": {
150             "$ref": "../definitions.json#/error"
151           }
152         },
153         "503": {
154           "description": "Under maintenance",
155           "schema": {
156             "$ref": "../definitions.json#/error"
157           }
158         }
159       },
160       "x-koha-authorization": {
161         "permissions": {
162           "borrowers": "edit_borrowers"
163         }
164       }
165     },
166     "put": {
167       "x-mojo-to": "Patrons::Attributes#overwrite",
168       "operationId": "overwritePatronAttributes",
169       "tags": [
170         "patrons",
171         "extended_attributes"
172       ],
173       "parameters": [
174         {
175           "$ref": "../parameters.json#/patron_id_pp"
176         },
177         {
178           "name": "body",
179           "in": "body",
180           "description": "A JSON representation of the patron extended attribute",
181           "required": true,
182           "schema": {
183             "type": "array",
184             "items": {
185               "$ref": "../definitions.json#/patron_extended_attribute"
186             }
187           }
188         }
189       ],
190       "produces": [
191         "application/json"
192       ],
193       "responses": {
194         "200": {
195           "description": "The successfully created patron extended attributes",
196           "schema": {
197             "type": "array",
198             "items": {
199               "$ref": "../definitions.json#/patron_extended_attribute"
200             }
201           }
202         },
203         "400": {
204           "description": "Bad parameters",
205           "schema": {
206             "$ref": "../definitions.json#/error"
207           }
208         },
209         "401": {
210           "description": "Authentication required",
211           "schema": {
212             "$ref": "../definitions.json#/error"
213           }
214         },
215         "403": {
216           "description": "Access forbidden",
217           "schema": {
218             "$ref": "../definitions.json#/error"
219           }
220         },
221         "404": {
222           "description": "Patron not found",
223           "schema": {
224             "$ref": "../definitions.json#/error"
225           }
226         },
227         "409": {
228           "description": "Conflict in creating resource",
229           "schema": {
230             "$ref": "../definitions.json#/error"
231           }
232         },
233         "500": {
234           "description": "Internal server error",
235           "schema": {
236             "$ref": "../definitions.json#/error"
237           }
238         },
239         "503": {
240           "description": "Under maintenance",
241           "schema": {
242             "$ref": "../definitions.json#/error"
243           }
244         }
245       },
246       "x-koha-authorization": {
247         "permissions": {
248           "borrowers": "edit_borrowers"
249         }
250       }
251     }
252   },
253   "/patrons/{patron_id}/extended_attributes/{extended_attribute_id}": {
254     "patch": {
255       "x-mojo-to": "Patrons::Attributes#update",
256       "operationId": "updatePatronAttribute",
257       "tags": [
258         "patrons",
259         "extended_attributes"
260       ],
261       "parameters": [
262         {
263           "$ref": "../parameters.json#/patron_id_pp"
264         },
265         {
266           "name": "extended_attribute_id",
267           "in": "path",
268           "description": "Internal patron extended attribute identifier",
269           "type": "integer",
270           "required": true
271         },
272         {
273           "name": "body",
274           "in": "body",
275           "description": "An object containing the updated values for the patron extended attribute",
276           "required": true,
277           "schema": {
278             "type": "object",
279             "properties": {
280               "value": {
281                 "description": "Extended attribute value",
282                 "type": "string"
283               }
284             }
285           }
286         }
287       ],
288       "produces": [
289         "application/json"
290       ],
291       "responses": {
292         "200": {
293           "description": "A successfully updated patron extended attribute",
294           "schema": {
295             "$ref": "../definitions.json#/patron_extended_attribute"
296           }
297         },
298         "400": {
299           "description": "Bad parameter",
300           "schema": {
301             "$ref": "../definitions.json#/error"
302           }
303         },
304         "401": {
305           "description": "Authentication required",
306           "schema": {
307             "$ref": "../definitions.json#/error"
308           }
309         },
310         "403": {
311           "description": "Access forbidden",
312           "schema": {
313             "$ref": "../definitions.json#/error"
314           }
315         },
316         "404": {
317           "description": "Object not found",
318           "schema": {
319             "$ref": "../definitions.json#/error"
320           }
321         },
322         "409": {
323           "description": "Conflict in updating resource",
324           "schema": {
325             "$ref": "../definitions.json#/error"
326           }
327         },
328         "500": {
329           "description": "Internal server error",
330           "schema": {
331             "$ref": "../definitions.json#/error"
332           }
333         },
334         "503": {
335           "description": "Under maintenance",
336           "schema": {
337             "$ref": "../definitions.json#/error"
338           }
339         }
340       },
341       "x-koha-authorization": {
342         "permissions": {
343           "borrowers": "edit_borrowers"
344         }
345       }
346     },
347     "delete": {
348       "x-mojo-to": "Patrons::Attributes#delete",
349       "operationId": "deletePatronAttribute",
350       "tags": [
351         "patrons",
352         "extended_attributes"
353       ],
354       "parameters": [
355         {
356           "$ref": "../parameters.json#/patron_id_pp"
357         },
358         {
359           "name": "extended_attribute_id",
360           "in": "path",
361           "description": "Internal patron extended attribute identifier",
362           "type": "integer",
363           "required": true
364         }
365       ],
366       "produces": [
367         "application/json"
368       ],
369       "responses": {
370         "204": {
371           "description": "Extended patron attribute deleted"
372         },
373         "401": {
374           "description": "Authentication required",
375           "schema": {
376             "$ref": "../definitions.json#/error"
377           }
378         },
379         "403": {
380           "description": "Access forbidden",
381           "schema": {
382             "$ref": "../definitions.json#/error"
383           }
384         },
385         "404": {
386           "description": "Patron not found",
387           "schema": {
388             "$ref": "../definitions.json#/error"
389           }
390         },
391         "500": {
392           "description": "Internal server error",
393           "schema": {
394             "$ref": "../definitions.json#/error"
395           }
396         },
397         "503": {
398           "description": "Under maintenance",
399           "schema": {
400             "$ref": "../definitions.json#/error"
401           }
402         }
403       },
404       "x-koha-authorization": {
405         "permissions": {
406           "borrowers": "edit_borrowers"
407         }
408       }
409     }
410   }
411 }