Bug 16212 - Generate initial swagger.min.json file
[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         "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   },
337   "definitions": {
338     "$ref": "./definitions/index.json"
339   },
340   "parameters": {
341     "borrowernumberPathParam": {
342       "name": "borrowernumber",
343       "in": "path",
344       "description": "Internal patron identifier",
345       "required": true,
346       "type": "integer"
347     },
348     "holdIdPathParam": {
349       "name": "reserve_id",
350       "in": "path",
351       "description": "Internal hold identifier",
352       "required": true,
353       "type": "integer"
354     }
355   }
356 }