Bug 18120: Add '/acquisitions/vendors' endpoint
[koha.git] / api / v1 / swagger / paths / acquisitions_vendors.json
1 {
2   "/acquisitions/vendors": {
3     "get": {
4       "x-mojo-to": "Acquisitions::Vendors#list_vendors",
5       "operationId": "listVendors",
6       "tags": ["acquisitions","vendors"],
7       "produces": [
8         "application/json"
9       ],
10       "parameters": [{
11         "name": "name",
12         "in": "query",
13         "description": "Case insensitive search on vendor name",
14         "required": false,
15         "type": "string"
16       }, {
17         "name": "accountnumber",
18         "in": "query",
19         "description": "Case insensitive search on vendor's account number",
20         "required": false,
21         "type": "string"
22       }],
23       "responses": {
24         "200": {
25           "description": "A list of vendors",
26           "schema": {
27             "type": "array",
28             "items": {
29               "$ref": "../definitions.json#/vendor"
30             }
31           }
32         },
33         "401": {
34           "description": "Authentication required",
35           "schema": {
36             "$ref": "../definitions.json#/error"
37           }
38         },
39         "403": {
40           "description": "Access forbidden",
41           "schema": {
42             "$ref": "../definitions.json#/error"
43           }
44         },
45         "404": {
46           "description": "Vendor not found",
47           "schema": {
48             "$ref": "../definitions.json#/error"
49           }
50         },
51         "500": {
52           "description": "Internal server error",
53           "schema": {
54             "$ref": "../definitions.json#/error"
55           }
56         },
57         "503": {
58           "description": "Under maintenance",
59           "schema": {
60             "$ref": "../definitions.json#/error"
61           }
62         }
63       },
64       "x-koha-authorization": {
65         "permissions": {
66           "acquisition": "1"
67         }
68       }
69     },
70     "post": {
71       "x-mojo-to": "Acquisitions::Vendors#add_vendor",
72       "operationId": "addVendor",
73       "tags": ["acquisitions","vendors"],
74       "parameters": [{
75         "name": "body",
76         "in": "body",
77         "description": "A JSON object representing a vendor",
78         "required": true,
79         "schema": {
80           "$ref": "../definitions.json#/vendor"
81         }
82       }],
83       "produces": [
84         "application/json"
85       ],
86       "responses": {
87         "200": {
88           "description": "Vendor added",
89           "schema": {
90             "$ref": "../definitions.json#/vendor"
91           }
92         },
93         "401": {
94           "description": "Authentication required",
95           "schema": {
96             "$ref": "../definitions.json#/error"
97           }
98         },
99         "403": {
100           "description": "Access forbidden",
101           "schema": {
102             "$ref": "../definitions.json#/error"
103           }
104         },
105         "404": {
106           "description": "Vendor not found",
107           "schema": {
108             "$ref": "../definitions.json#/error"
109           }
110         },
111         "500": {
112           "description": "Internal server error",
113           "schema": {
114             "$ref": "../definitions.json#/error"
115           }
116         },
117         "503": {
118           "description": "Under maintenance",
119           "schema": {
120             "$ref": "../definitions.json#/error"
121           }
122         }
123       },
124       "x-koha-authorization": {
125         "permissions": {
126           "acquisition": "vendors_manage"
127         }
128       }
129     }
130   },
131   "/acquisitions/vendors/{vendor_id}": {
132     "get": {
133       "x-mojo-to": "Acquisitions::Vendors#get_vendor",
134       "operationId": "getVendor",
135       "tags": ["acquisitions","vendors"],
136       "parameters": [{
137         "$ref": "../parameters.json#/vendoridPathParam"
138       }],
139       "produces": [
140         "application/json"
141       ],
142       "responses": {
143         "200": {
144           "description": "A vendor",
145           "schema": {
146             "$ref": "../definitions.json#/vendor"
147           }
148         },
149         "401": {
150           "description": "Authentication required",
151           "schema": {
152             "$ref": "../definitions.json#/error"
153           }
154         },
155         "403": {
156           "description": "Access forbidden",
157           "schema": {
158             "$ref": "../definitions.json#/error"
159           }
160         },
161         "404": {
162           "description": "Vendor not found",
163           "schema": {
164             "$ref": "../definitions.json#/error"
165           }
166         },
167         "500": {
168           "description": "Internal server error",
169           "schema": {
170             "$ref": "../definitions.json#/error"
171           }
172         },
173         "503": {
174           "description": "Under maintenance",
175           "schema": {
176             "$ref": "../definitions.json#/error"
177           }
178         }
179       },
180       "x-koha-authorization": {
181         "permissions": {
182           "acquisition": "1"
183         }
184       }
185     },
186     "put": {
187       "x-mojo-to": "Acquisitions::Vendors#update_vendor",
188       "operationId": "updateVendor",
189       "tags": ["acquisitions","vendors"],
190       "parameters": [{
191         "$ref": "../parameters.json#/vendoridPathParam"
192       }, {
193         "name": "body",
194         "in": "body",
195         "description": "A JSON object representing a vendor",
196         "required": true,
197         "schema": {
198           "$ref": "../definitions.json#/vendor"
199         }
200       }],
201       "produces": [
202         "application/json"
203       ],
204       "responses": {
205         "200": {
206           "description": "A vendor",
207           "schema": {
208             "$ref": "../definitions.json#/vendor"
209           }
210         },
211         "401": {
212           "description": "Authentication required",
213           "schema": {
214             "$ref": "../definitions.json#/error"
215           }
216         },
217         "403": {
218           "description": "Access forbidden",
219           "schema": {
220             "$ref": "../definitions.json#/error"
221           }
222         },
223         "404": {
224           "description": "Vendor not found",
225           "schema": {
226             "$ref": "../definitions.json#/error"
227           }
228         },
229         "500": {
230           "description": "Internal server error",
231           "schema": {
232             "$ref": "../definitions.json#/error"
233           }
234         },
235         "503": {
236           "description": "Under maintenance",
237           "schema": {
238             "$ref": "../definitions.json#/error"
239           }
240         }
241       },
242       "x-koha-authorization": {
243         "permissions": {
244           "acquisition": "1"
245         }
246       }
247     },
248     "delete": {
249       "x-mojo-to": "Acquisitions::Vendors#delete_vendor",
250       "operationId": "deleteVendor",
251       "tags": ["acquisitions","vendors"],
252       "parameters": [{
253         "$ref": "../parameters.json#/vendoridPathParam"
254       }],
255       "produces": [
256         "application/json"
257       ],
258       "responses": {
259         "200": {
260           "description": "Vendor deleted",
261           "schema": {
262             "type": "string"
263           }
264         },
265         "401": {
266           "description": "Authentication required",
267           "schema": {
268             "$ref": "../definitions.json#/error"
269           }
270         },
271         "403": {
272           "description": "Access forbidden",
273           "schema": {
274             "$ref": "../definitions.json#/error"
275           }
276         },
277         "404": {
278           "description": "Vendor not found",
279           "schema": {
280             "$ref": "../definitions.json#/error"
281           }
282         },
283         "500": {
284           "description": "Internal server error",
285           "schema": {
286             "$ref": "../definitions.json#/error"
287           }
288         },
289         "503": {
290           "description": "Under maintenance",
291           "schema": {
292             "$ref": "../definitions.json#/error"
293           }
294         }
295       },
296       "x-koha-authorization": {
297         "permissions": {
298           "acquisition": "1"
299         }
300       }
301     }
302   }
303 }