Bug 14697: (follow-up) Rely on the UNIQUE constraint and return 409 for issue_id
[koha.git] / api / v1 / swagger / paths / return_claims.json
1 {
2   "/return_claims": {
3     "post": {
4       "x-mojo-to": "ReturnClaims#claim_returned",
5       "operationId": "claimReturned",
6       "tags": [
7         "claims",
8         "returned",
9         "return",
10         "claim"
11       ],
12       "parameters": [
13         {
14           "name": "body",
15           "in": "body",
16           "description": "A JSON object containing fields to modify",
17           "required": true,
18           "schema": {
19             "type": "object",
20             "properties": {
21               "item_id" : {
22                 "description": "Internal item id to claim as returned",
23                 "type": "integer"
24               },
25               "notes": {
26                 "description": "Notes about this return claim",
27                 "type": "string"
28               },
29               "created_by": {
30                 "description": "User id for the librarian submitting this claim",
31                 "type": "string"
32               },
33               "charge_lost_fee": {
34                 "description": "Charge a lost fee if true and Koha is set to allow a choice. Ignored otherwise.",
35                 "type": "boolean"
36               }
37             }
38           }
39         }
40       ],
41       "produces": [
42         "application/json"
43       ],
44       "responses": {
45         "201": {
46           "description": "Created claim",
47           "schema": {
48             "$ref": "../definitions.json#/return_claim"
49           }
50         },
51         "400": {
52           "description": "Bad request",
53           "schema": {
54             "$ref": "../definitions.json#/error"
55           }
56         },
57         "401": {
58           "description": "Authentication required",
59           "schema": {
60             "$ref": "../definitions.json#/error"
61           }
62         },
63         "403": {
64           "description": "Access forbidden",
65           "schema": {
66             "$ref": "../definitions.json#/error"
67           }
68         },
69         "404": {
70             "description": "Checkout not found",
71             "schema": {
72                 "$ref": "../definitions.json#/error"
73             }
74         },
75         "409": {
76             "description": "Conflict creating the resource",
77             "schema": {
78                 "$ref": "../definitions.json#/error"
79             }
80         },
81         "500": {
82           "description": "Internal server error",
83           "schema": {
84             "$ref": "../definitions.json#/error"
85           }
86         },
87         "503": {
88           "description": "Under maintenance",
89           "schema": {
90             "$ref": "../definitions.json#/error"
91           }
92         }
93       },
94       "x-koha-authorization": {
95         "permissions": {
96           "circulate": "circulate_remaining_permissions"
97         }
98       }
99     }
100   },
101   "/return_claims/{claim_id}/notes": {
102     "put": {
103       "x-mojo-to": "ReturnClaims#update_notes",
104       "operationId": "updateClaimNotes",
105       "tags": [
106         "claims",
107         "returned",
108         "return",
109         "claim",
110         "notes"
111       ],
112       "parameters": [
113         {
114           "name": "claim_id",
115           "in": "path",
116           "required": true,
117           "description": "Unique identifier for the claim whose notes are to be updated",
118           "type": "integer"
119         },
120         {
121           "name": "body",
122           "in": "body",
123           "description": "A JSON object containing fields to modify",
124           "required": true,
125           "schema": {
126             "type": "object",
127             "properties": {
128               "notes": {
129                 "description": "Notes about this return claim",
130                 "type": "string"
131               },
132               "updated_by": {
133                 "description": "User id for the librarian updating the claim notes",
134                 "type": "string"
135               }
136             }
137           }
138         }
139       ],
140       "produces": [
141         "application/json"
142       ],
143       "responses": {
144         "200": {
145           "description": "Claim notes updated",
146           "schema": {
147             "$ref": "../definitions.json#/return_claim"
148           }
149         },
150         "400": {
151           "description": "Bad request",
152           "schema": {
153             "$ref": "../definitions.json#/error"
154           }
155         },
156         "401": {
157           "description": "Authentication required",
158           "schema": {
159             "$ref": "../definitions.json#/error"
160           }
161         },
162         "403": {
163           "description": "Access forbidden",
164           "schema": {
165             "$ref": "../definitions.json#/error"
166           }
167         },
168         "404": {
169           "description": "Claim not found",
170           "schema": {
171             "$ref": "../definitions.json#/error"
172           }
173         },
174         "500": {
175           "description": "Internal server error",
176           "schema": {
177             "$ref": "../definitions.json#/error"
178           }
179         },
180         "503": {
181           "description": "Under maintenance",
182           "schema": {
183             "$ref": "../definitions.json#/error"
184           }
185         }
186       },
187       "x-koha-authorization": {
188         "permissions": {
189           "circulate": "circulate_remaining_permissions"
190         }
191       }
192     }
193   },
194   "/return_claims/{claim_id}": {
195     "delete": {
196       "x-mojo-to": "ReturnClaims#delete_claim",
197       "operationId": "deletedClaim",
198       "tags": [
199         "claims",
200         "returned",
201         "return",
202         "claim",
203         "delete"
204       ],
205       "parameters": [
206         {
207           "name": "claim_id",
208           "in": "path",
209           "required": true,
210           "description": "Unique identifier for the claim to be deleted",
211           "type": "integer"
212         }
213       ],
214       "produces": [
215         "application/json"
216       ],
217       "responses": {
218         "200": {
219           "description": "Claim deleted",
220           "schema": {
221             "$ref": "../definitions.json#/return_claim"
222           }
223         },
224         "400": {
225           "description": "Bad request",
226           "schema": {
227             "$ref": "../definitions.json#/error"
228           }
229         },
230         "401": {
231           "description": "Authentication required",
232           "schema": {
233             "$ref": "../definitions.json#/error"
234           }
235         },
236         "403": {
237           "description": "Access forbidden",
238           "schema": {
239             "$ref": "../definitions.json#/error"
240           }
241         },
242         "404": {
243           "description": "Claim not found",
244           "schema": {
245             "$ref": "../definitions.json#/error"
246           }
247         },
248         "500": {
249           "description": "Internal server error",
250           "schema": {
251             "$ref": "../definitions.json#/error"
252           }
253         },
254         "503": {
255           "description": "Under maintenance",
256           "schema": {
257             "$ref": "../definitions.json#/error"
258           }
259         }
260       },
261       "x-koha-authorization": {
262         "permissions": {
263           "circulate": "circulate_remaining_permissions"
264         }
265       }
266     }
267   },
268   "/return_claims/{claim_id}/resolve": {
269     "put": {
270       "x-mojo-to": "ReturnClaims#resolve_claim",
271       "operationId": "updateClaimResolve",
272       "tags": [
273         "claims",
274         "returned",
275         "return",
276         "claim",
277         "notes"
278       ],
279       "parameters": [
280         {
281           "name": "claim_id",
282           "in": "path",
283           "required": true,
284           "description": "Unique identifier for the claim to be resolved",
285           "type": "integer"
286         },
287         {
288           "name": "body",
289           "in": "body",
290           "description": "A JSON object containing fields to modify",
291           "required": true,
292           "schema": {
293             "type": "object",
294             "properties": {
295               "resolution": {
296                 "description": "The RETURN_CLAIM_RESOLUTION code to be used to resolve the calim",
297                 "type": "string"
298               },
299               "resolved_by": {
300                 "description": "User id for the librarian resolving the claim",
301                 "type": "string"
302               }
303             }
304           }
305         }
306       ],
307       "produces": [
308         "application/json"
309       ],
310       "responses": {
311         "200": {
312           "description": "Claim resolved",
313           "schema": {
314             "$ref": "../definitions.json#/return_claim"
315           }
316         },
317         "400": {
318           "description": "Bad request",
319           "schema": {
320             "$ref": "../definitions.json#/error"
321           }
322         },
323         "401": {
324           "description": "Authentication required",
325           "schema": {
326             "$ref": "../definitions.json#/error"
327           }
328         },
329         "403": {
330           "description": "Access forbidden",
331           "schema": {
332             "$ref": "../definitions.json#/error"
333           }
334         },
335         "404": {
336           "description": "Claim not found",
337           "schema": {
338             "$ref": "../definitions.json#/error"
339           }
340         },
341         "500": {
342           "description": "Internal server error",
343           "schema": {
344             "$ref": "../definitions.json#/error"
345           }
346         },
347         "503": {
348           "description": "Under maintenance",
349           "schema": {
350             "$ref": "../definitions.json#/error"
351           }
352         }
353       },
354       "x-koha-authorization": {
355         "permissions": {
356           "circulate": "circulate_remaining_permissions"
357         }
358       }
359     }
360   }
361 }