Bug 26633: Add REST API for managing transfer limits
[koha.git] / api / v1 / swagger / paths / transfer_limits.yaml
1 ---
2 "/transfer_limits":
3   get:
4     x-mojo-to: TransferLimits#list
5     operationId: listTransferLimits
6     tags:
7     - transfer
8     parameters:
9     - name: to_library_id
10       in: query
11       description: Search on to_library_id
12       required: false
13       type: string
14     - name: from_library_id
15       in: query
16       description: Search on from_library_id
17       required: false
18       type: string
19     - name: item_type
20       in: query
21       description: Search on item_type
22       required: false
23       type: string
24     - name: collection_code
25       in: query
26       description: Search on collection_code
27       required: false
28       type: string
29     - "$ref": "../parameters.json#/match"
30     - "$ref": "../parameters.json#/order_by"
31     - "$ref": "../parameters.json#/page"
32     - "$ref": "../parameters.json#/per_page"
33     - "$ref": "../parameters.json#/q_param"
34     - "$ref": "../parameters.json#/q_body"
35     - "$ref": "../parameters.json#/q_header"
36     produces:
37     - application/json
38     responses:
39       '200':
40         description: A list of transfer limits
41         schema:
42           type: array
43           items:
44             "$ref": "../definitions.json#/transfer_limit"
45       '500':
46         description: Internal error
47         schema:
48           "$ref": "../definitions.json#/error"
49       '503':
50         description: Under maintenance
51         schema:
52           "$ref": "../definitions.json#/error"
53     x-koha-authorization:
54       permissions:
55         parameters: manage_transfers
56   post:
57     x-mojo-to: TransferLimits#add
58     operationId: addTransferLimit
59     tags:
60     - transfer
61     parameters:
62     - name: body
63       in: body
64       description: A JSON object containing information about a new transfer limit
65       required: true
66       schema:
67         "$ref": "../definitions.json#/transfer_limit"
68     produces:
69     - application/json
70     responses:
71       '201':
72         description: Transfer limit added
73         schema:
74           "$ref": "../definitions.json#/transfer_limit"
75       '400':
76         description: Bad request
77         schema:
78           "$ref": "../definitions.json#/error"
79       '401':
80         description: Authentication required
81         schema:
82           "$ref": "../definitions.json#/error"
83       '403':
84         description: Access forbidden
85         schema:
86           "$ref": "../definitions.json#/error"
87       '409':
88         description: Conflict in creating resource
89         schema:
90           "$ref": "../definitions.json#/error"
91       '500':
92         description: Internal error
93         schema:
94           "$ref": "../definitions.json#/error"
95       '503':
96         description: Under maintenance
97         schema:
98           "$ref": "../definitions.json#/error"
99     x-koha-authorization:
100       permissions:
101         parameters: manage_transfers
102 "/transfer_limits/{limit_id}":
103   delete:
104     x-mojo-to: TransferLimits#delete
105     operationId: deleteTransferLimit
106     tags:
107     - transfer
108     parameters:
109     - "$ref": "../parameters.json#/transfer_limit_id_pp"
110     produces:
111     - application/json
112     responses:
113       '204':
114         description: Transfer limit deleted
115         schema:
116           type: string
117       '401':
118         description: Authentication required
119         schema:
120           "$ref": "../definitions.json#/error"
121       '403':
122         description: Access forbidden
123         schema:
124           "$ref": "../definitions.json#/error"
125       '404':
126         description: Library not found
127         schema:
128           "$ref": "../definitions.json#/error"
129       '500':
130         description: Internal error
131         schema:
132           "$ref": "../definitions.json#/error"
133       '503':
134         description: Under maintenance
135         schema:
136           "$ref": "../definitions.json#/error"
137     x-koha-authorization:
138       permissions:
139         parameters: manage_transfers
140 "/transfer_limits/batch":
141   post:
142     x-mojo-to: TransferLimits#batch_add
143     operationId: batchAddTransferLimits
144     tags:
145     - transfer
146     parameters:
147     - name: body
148       in: body
149       description: A JSON object containing information about new transfer limits.
150       required: true
151       schema:
152         type: object
153         properties:
154           to_library_id:
155             type: string
156             description: Internal library id for which library the item is going to
157           from_library_id:
158             type: string
159             description: Internal library id for which library the item is coming
160               from
161           item_type:
162             type:
163             - string
164             - 'null'
165             description: Itemtype defining the type for this limi
166           collection_code:
167             type:
168             - string
169             - 'null'
170             description: Authorized value for the collection code associated with
171               this limit
172         additionalProperties: false
173     produces:
174     - application/json
175     responses:
176       '201':
177         description: A list of transfer limits
178         schema:
179           type: array
180           items:
181             "$ref": "../definitions.json#/transfer_limit"
182       '500':
183         description: Internal error
184         schema:
185           "$ref": "../definitions.json#/error"
186       '503':
187         description: Under maintenance
188         schema:
189           "$ref": "../definitions.json#/error"
190     x-koha-authorization:
191       permissions:
192         parameters: manage_transfers
193   delete:
194     x-mojo-to: TransferLimits#batch_delete
195     operationId: batchDeleteTransferLimits
196     tags:
197     - transfer
198     parameters:
199     - name: body
200       in: body
201       description: A JSON object containing information about new transfer limits.
202       required: true
203       schema:
204         type: object
205         properties:
206           to_library_id:
207             type: string
208             description: Internal library id for which library the item is going to
209           from_library_id:
210             type: string
211             description: Internal library id for which library the item is coming
212               from
213           item_type:
214             type:
215             - string
216             - 'null'
217             description: Itemtype defining the type for this limi
218           collection_code:
219             type:
220             - string
221             - 'null'
222             description: Authorized value for the collection code associated with
223               this limit
224         additionalProperties: false
225     produces:
226     - application/json
227     responses:
228       '204':
229         description: Transfer limits deleted
230         schema:
231           type: string
232       '401':
233         description: Authentication required
234         schema:
235           "$ref": "../definitions.json#/error"
236       '403':
237         description: Access forbidden
238         schema:
239           "$ref": "../definitions.json#/error"
240       '404':
241         description: Library not found
242         schema:
243           "$ref": "../definitions.json#/error"
244       '500':
245         description: Internal error
246         schema:
247           "$ref": "../definitions.json#/error"
248       '503':
249         description: Under maintenance
250         schema:
251           "$ref": "../definitions.json#/error"
252     x-koha-authorization:
253       permissions:
254         parameters: manage_transfers