Bug 30275: (follow-up) Rebase fixes
[koha.git] / api / v1 / swagger / swagger.yaml
1 ---
2 swagger: "2.0"
3 basePath: /api/v1
4 definitions:
5   account_line:
6     $ref: ./definitions/account_line.yaml
7   advancededitormacro:
8     $ref: ./definitions/advancededitormacro.yaml
9   allows_renewal:
10     $ref: ./definitions/allows_renewal.yaml
11   basket:
12     $ref: ./definitions/basket.yaml
13   cashup:
14     $ref: ./definitions/cashup.yaml
15   checkout:
16     $ref: ./definitions/checkout.yaml
17   checkouts:
18     $ref: ./definitions/checkouts.yaml
19   circ-rule-kind:
20     $ref: ./definitions/circ-rule-kind.yaml
21   city:
22     $ref: ./definitions/city.yaml
23   error:
24     $ref: ./definitions/error.yaml
25   fund:
26     $ref: ./definitions/fund.yaml
27   hold:
28     $ref: ./definitions/hold.yaml
29   holds:
30     $ref: ./definitions/holds.yaml
31   ill_backend:
32     $ref: ./definitions/ill_backend.yaml
33   ill_backends:
34     $ref: ./definitions/ill_backends.yaml
35   import_batch_profile:
36     $ref: ./definitions/import_batch_profile.yaml
37   import_batch_profiles:
38     $ref: ./definitions/import_batch_profiles.yaml
39   import_record_match:
40     $ref: ./definitions/import_record_match.yaml
41   invoice:
42     $ref: ./definitions/invoice.yaml
43   item:
44     $ref: ./definitions/item.yaml
45   library:
46     $ref: ./definitions/library.yaml
47   order:
48     $ref: ./definitions/order.yaml
49   patron:
50     $ref: ./definitions/patron.yaml
51   patron_account_credit:
52     $ref: ./definitions/patron_account_credit.yaml
53   patron_balance:
54     $ref: ./definitions/patron_balance.yaml
55   patron_extended_attribute:
56     $ref: ./definitions/patron_extended_attribute.yaml
57   quote:
58     $ref: ./definitions/quote.yaml
59   renewal:
60     $ref: ./definitions/renewal.yaml
61   renewals:
62     $ref: ./definitions/renewals.yaml
63   return_claim:
64     $ref: ./definitions/return_claim.yaml
65   smtp_server:
66     $ref: ./definitions/smtp_server.yaml
67   suggestion:
68     $ref: ./definitions/suggestion.yaml
69   transfer_limit:
70     $ref: ./definitions/transfer_limit.yaml
71   vendor:
72     $ref: ./definitions/vendor.yaml
73 paths:
74   /acquisitions/baskets/managers:
75     $ref: paths/acquisitions_baskets.yaml#/~1acquisitions~1baskets~1managers
76   /acquisitions/funds:
77     $ref: ./paths/acquisitions_funds.yaml#/~1acquisitions~1funds
78   /acquisitions/funds/owners:
79     $ref: paths/acquisitions_funds.yaml#/~1acquisitions~1funds~1owners
80   /acquisitions/funds/users:
81     $ref: paths/acquisitions_funds.yaml#/~1acquisitions~1funds~1users
82   /acquisitions/orders:
83     $ref: ./paths/acquisitions_orders.yaml#/~1acquisitions~1orders
84   "/acquisitions/orders/{order_id}":
85     $ref: "./paths/acquisitions_orders.yaml#/~1acquisitions~1orders~1{order_id}"
86   /acquisitions/vendors:
87     $ref: ./paths/acquisitions_vendors.yaml#/~1acquisitions~1vendors
88   "/acquisitions/vendors/{vendor_id}":
89     $ref: "./paths/acquisitions_vendors.yaml#/~1acquisitions~1vendors~1{vendor_id}"
90   /advanced_editor/macros:
91     $ref: ./paths/advancededitormacros.yaml#/~1advanced_editor~1macros
92   /advanced_editor/macros/shared:
93     $ref: ./paths/advancededitormacros.yaml#/~1advanced_editor~1macros~1shared
94   "/advanced_editor/macros/shared/{advancededitormacro_id}":
95     $ref: "./paths/advancededitormacros.yaml#/~1advanced_editor~1macros~1shared~1{advancededitormacro_id}"
96   "/advanced_editor/macros/{advancededitormacro_id}":
97     $ref: "./paths/advancededitormacros.yaml#/~1advanced_editor~1macros~1{advancededitormacro_id}"
98   "/article_requests/{article_request_id}":
99     $ref: "./paths/article_requests.yaml#/~1article_requests~1{article_request_id}"
100   "/biblios/{biblio_id}":
101     $ref: "./paths/biblios.yaml#/~1biblios~1{biblio_id}"
102   "/biblios/{biblio_id}/checkouts":
103     $ref: "./paths/biblios.yaml#/~1biblios~1{biblio_id}~1checkouts"
104   "/biblios/{biblio_id}/items":
105     $ref: "./paths/biblios.yaml#/~1biblios~1{biblio_id}~1items"
106   "/biblios/{biblio_id}/pickup_locations":
107     $ref: "./paths/biblios.yaml#/~1biblios~1{biblio_id}~1pickup_locations"
108   "/cash_registers/{cash_register_id}/cashups":
109     $ref: "./paths/cash_registers.yaml#/~1cash_registers~1{cash_register_id}~1cashups"
110   "/cashups/{cashup_id}":
111     $ref: "./paths/cash_registers.yaml#/~1cashups~1{cashup_id}"
112   /checkouts:
113     $ref: ./paths/checkouts.yaml#/~1checkouts
114   "/checkouts/{checkout_id}":
115     $ref: "./paths/checkouts.yaml#/~1checkouts~1{checkout_id}"
116   "/checkouts/{checkout_id}/allows_renewal":
117     $ref: "./paths/checkouts.yaml#/~1checkouts~1{checkout_id}~1allows_renewal"
118   "/checkouts/{checkout_id}/renewals":
119     $ref: "./paths/checkouts.yaml#/~1checkouts~1{checkout_id}~1renewals"
120   "/checkouts/{checkout_id}/renewal":
121     $ref: "./paths/checkouts.yaml#/~1checkouts~1{checkout_id}~1renewal"
122   /circulation-rules/kinds:
123     $ref: ./paths/circulation-rules.yaml#/~1circulation-rules~1kinds
124   /cities:
125     $ref: ./paths/cities.yaml#/~1cities
126   "/cities/{city_id}":
127     $ref: "./paths/cities.yaml#/~1cities~1{city_id}"
128   "/clubs/{club_id}/holds":
129     $ref: "./paths/clubs.yaml#/~1clubs~1{club_id}~1holds"
130   /config/smtp_servers:
131     $ref: ./paths/config_smtp_servers.yaml#/~1config~1smtp_servers
132   "/config/smtp_servers/{smtp_server_id}":
133     $ref: "./paths/config_smtp_servers.yaml#/~1config~1smtp_servers~1{smtp_server_id}"
134   /holds:
135     $ref: ./paths/holds.yaml#/~1holds
136   "/holds/{hold_id}":
137     $ref: "./paths/holds.yaml#/~1holds~1{hold_id}"
138   "/holds/{hold_id}/pickup_location":
139     $ref: "./paths/holds.yaml#/~1holds~1{hold_id}~1pickup_location"
140   "/holds/{hold_id}/pickup_locations":
141     $ref: "./paths/holds.yaml#/~1holds~1{hold_id}~1pickup_locations"
142   "/holds/{hold_id}/priority":
143     $ref: "./paths/holds.yaml#/~1holds~1{hold_id}~1priority"
144   "/holds/{hold_id}/suspension":
145     $ref: "./paths/holds.yaml#/~1holds~1{hold_id}~1suspension"
146   /ill_backends:
147     $ref: ./paths/ill_backends.yaml#/~1ill_backends
148   "/ill_backends/{ill_backend_id}":
149     $ref: "./paths/ill_backends.yaml#/~1ill_backends~1{ill_backend_id}"
150   /illrequests:
151     $ref: ./paths/illrequests.yaml#/~1illrequests
152   "/import_batches/{import_batch_id}/records/{import_record_id}/matches/chosen":
153     $ref: "./paths/import_batches.yaml#/~1import_batches~1{import_batch_id}~1records~1{import_record_id}~1matches~1chosen"
154   /import_batch_profiles:
155     $ref: ./paths/import_batch_profiles.yaml#/~1import_batch_profiles
156   "/import_batch_profiles/{import_batch_profile_id}":
157     $ref: "./paths/import_batch_profiles.yaml#/~1import_batch_profiles~1{import_batch_profile_id}"
158   /items:
159     $ref: ./paths/items.yaml#/~1items
160   "/items/{item_id}":
161     $ref: "./paths/items.yaml#/~1items~1{item_id}"
162   "/items/{item_id}/pickup_locations":
163     $ref: "./paths/items.yaml#/~1items~1{item_id}~1pickup_locations"
164   /libraries:
165     $ref: ./paths/libraries.yaml#/~1libraries
166   "/libraries/{library_id}":
167     $ref: "./paths/libraries.yaml#/~1libraries~1{library_id}"
168   /oauth/token:
169     $ref: ./paths/oauth.yaml#/~1oauth~1token
170   /patrons:
171     $ref: ./paths/patrons.yaml#/~1patrons
172   "/patrons/{patron_id}":
173     $ref: "./paths/patrons.yaml#/~1patrons~1{patron_id}"
174   "/patrons/{patron_id}/account":
175     $ref: "./paths/patrons_account.yaml#/~1patrons~1{patron_id}~1account"
176   "/patrons/{patron_id}/account/credits":
177     $ref: "./paths/patrons_account.yaml#/~1patrons~1{patron_id}~1account~1credits"
178   "/patrons/{patron_id}/extended_attributes":
179     $ref: "./paths/patrons_extended_attributes.yaml#/~1patrons~1{patron_id}~1extended_attributes"
180   "/patrons/{patron_id}/extended_attributes/{extended_attribute_id}":
181     $ref: "./paths/patrons_extended_attributes.yaml#/~1patrons~1{patron_id}~1extended_attributes~1{extended_attribute_id}"
182   "/patrons/{patron_id}/holds":
183     $ref: "./paths/patrons_holds.yaml#/~1patrons~1{patron_id}~1holds"
184   "/patrons/{patron_id}/password":
185     $ref: "./paths/patrons_password.yaml#/~1patrons~1{patron_id}~1password"
186   "/patrons/{patron_id}/password/expiration_date":
187     $ref: "./paths/patrons_password.yaml#/~1patrons~1{patron_id}~1password~1expiration_date"
188   "/public/biblios/{biblio_id}":
189     $ref: "./paths/biblios.yaml#/~1public~1biblios~1{biblio_id}"
190   "/public/biblios/{biblio_id}/items":
191     $ref: "./paths/biblios.yaml#/~1public~1biblios~1{biblio_id}~1items"
192   /public/libraries:
193     $ref: ./paths/libraries.yaml#/~1public~1libraries
194   "/public/libraries/{library_id}":
195     $ref: "./paths/libraries.yaml#/~1public~1libraries~1{library_id}"
196   "/public/patrons/{patron_id}/article_requests/{article_request_id}":
197     $ref: "./paths/article_requests.yaml#/~1public~1patrons~1{patron_id}~1article_requests~1{article_request_id}"
198   "/public/patrons/{patron_id}/guarantors/can_see_charges":
199     $ref: "./paths/public_patrons.yaml#/~1public~1patrons~1{patron_id}~1guarantors~1can_see_charges"
200   "/public/patrons/{patron_id}/guarantors/can_see_checkouts":
201     $ref: "./paths/public_patrons.yaml#/~1public~1patrons~1{patron_id}~1guarantors~1can_see_checkouts"
202   "/public/patrons/{patron_id}/password":
203     $ref: "./paths/public_patrons.yaml#/~1public~1patrons~1{patron_id}~1password"
204   /quotes:
205     $ref: ./paths/quotes.yaml#/~1quotes
206   "/quotes/{quote_id}":
207     $ref: "./paths/quotes.yaml#/~1quotes~1{quote_id}"
208   /return_claims:
209     $ref: ./paths/return_claims.yaml#/~1return_claims
210   "/return_claims/{claim_id}":
211     $ref: "./paths/return_claims.yaml#/~1return_claims~1{claim_id}"
212   "/return_claims/{claim_id}/notes":
213     $ref: "./paths/return_claims.yaml#/~1return_claims~1{claim_id}~1notes"
214   "/return_claims/{claim_id}/resolve":
215     $ref: "./paths/return_claims.yaml#/~1return_claims~1{claim_id}~1resolve"
216   "/rotas/{rota_id}/stages/{stage_id}/position":
217     $ref: "./paths/rotas.yaml#/~1rotas~1{rota_id}~1stages~1{stage_id}~1position"
218   /suggestions:
219     $ref: ./paths/suggestions.yaml#/~1suggestions
220   "/suggestions/{suggestion_id}":
221     $ref: "./paths/suggestions.yaml#/~1suggestions~1{suggestion_id}"
222   /suggestions/managers:
223     $ref: paths/suggestions.yaml#/~1suggestions~1managers
224   /transfer_limits:
225     $ref: ./paths/transfer_limits.yaml#/~1transfer_limits
226   /transfer_limits/batch:
227     $ref: ./paths/transfer_limits.yaml#/~1transfer_limits~1batch
228   "/transfer_limits/{limit_id}":
229     $ref: "./paths/transfer_limits.yaml#/~1transfer_limits~1{limit_id}"
230 parameters:
231   advancededitormacro_id_pp:
232     description: Advanced editor macro internal identifier
233     in: path
234     name: advancededitormacro_id
235     required: true
236     type: integer
237   biblio_id_pp:
238     description: Record internal identifier
239     in: path
240     name: biblio_id
241     required: true
242     type: integer
243   candidate_match_id_pp:
244     description: Internal import record match identifier
245     in: path
246     name: candidate_match_id
247     required: true
248     type: integer
249   cash_register_id_pp:
250     description: Cash register internal identifier
251     in: path
252     name: cash_register_id
253     required: true
254     type: integer
255   cashup_id_pp:
256     description: Cashup internal identifier
257     in: path
258     name: cashup_id
259     required: true
260     type: integer
261   checkout_id_pp:
262     description: Internal checkout identifier
263     in: path
264     name: checkout_id
265     required: true
266     type: integer
267   city_id_pp:
268     description: City internal identifier
269     in: path
270     name: city_id
271     required: true
272     type: integer
273   club_id_pp:
274     description: Internal club identifier
275     in: path
276     name: club_id
277     required: true
278     type: integer
279   fund_id_pp:
280     description: Fund id
281     in: path
282     name: fund_id
283     required: true
284     type: integer
285   hold_id_pp:
286     description: Internal hold identifier
287     in: path
288     name: hold_id
289     required: true
290     type: integer
291   import_batch_profile_id_pp:
292     description: Internal profile identifier
293     in: path
294     name: import_batch_profile_id
295     required: true
296     type: integer
297   import_record_id_pp:
298     description: Internal import record identifier
299     in: path
300     name: import_record_id
301     required: true
302     type: integer
303   item_id_pp:
304     description: Internal item identifier
305     in: path
306     name: item_id
307     required: true
308     type: integer
309   library_id_pp:
310     description: Internal library identifier
311     in: path
312     name: library_id
313     required: true
314     type: string
315   match:
316     description: Matching criteria
317     enum:
318       - contains
319       - exact
320       - starts_with
321       - ends_with
322     in: query
323     name: _match
324     required: false
325     type: string
326   order_by:
327     collectionFormat: csv
328     description: Sorting criteria
329     in: query
330     items:
331       type: string
332     name: _order_by
333     required: false
334     type: array
335   order_id_pp:
336     description: Internal order identifier
337     in: path
338     name: order_id
339     required: true
340     type: integer
341   page:
342     description: "Page number, for paginated object listing"
343     in: query
344     name: _page
345     required: false
346     type: integer
347   patron_id_pp:
348     description: Internal patron identifier
349     in: path
350     name: patron_id
351     required: true
352     type: integer
353   patron_id_qp:
354     description: Internal patron identifier
355     in: query
356     name: patron_id
357     type: integer
358   per_page:
359     description: "Page size, for paginated object listing"
360     in: query
361     name: _per_page
362     required: false
363     type: integer
364   q_body:
365     description: Query filter sent through request"s body
366     in: body
367     name: query
368     required: false
369     schema:
370       type: object
371   q_header:
372     description: Query filter sent as a request header
373     in: header
374     name: x-koha-query
375     required: false
376     type: string
377   q_param:
378     description: Query filter sent as a request parameter
379     in: query
380     name: q
381     required: false
382     type: array
383     items:
384       type: string
385     collectionFormat: multi
386   quote_id_pp:
387     description: Quote internal identifier
388     in: path
389     name: quote_id
390     required: true
391     type: integer
392   request_id_header:
393     description: Request id header
394     in: header
395     name: x-koha-request-id
396     required: false
397     type: integer
398   seen_pp:
399     description: Item was seen flag
400     in: query
401     name: seen
402     required: false
403     type: integer
404   smtp_server_id_pp:
405     description: SMTP server internal identifier
406     in: path
407     name: smtp_server_id
408     required: true
409     type: integer
410   suggestion_id_pp:
411     description: Internal suggestion identifier
412     in: path
413     name: suggestion_id
414     required: true
415     type: integer
416   transfer_limit_id_pp:
417     description: Internal transfer limit identifier
418     in: path
419     name: limit_id
420     required: true
421     type: string
422   vendor_id_pp:
423     description: Vendor id
424     in: path
425     name: vendor_id
426     required: true
427     type: integer
428 info:
429   title: Koha REST API
430   version: "1"
431   license:
432     name: "GPL v3,"
433     url: http://www.gnu.org/licenses/gpl.txt
434   contact:
435     name: Koha Development Team
436     url: https://koha-community.org/
437   description: |
438     ## Introduction
439
440     This API is documented in **OpenAPI format**.
441
442     ## Authentication
443
444     The API supports the following authentication mechanisms
445
446     * HTTP Basic authentication
447     * OAuth2 (client credentials grant)
448     * Cookie-based
449
450     Both _Basic authentication_ and the _OAuth2_ flow, need to be enabled
451     by system preferences.
452
453     ## Errors
454
455     The API uses standard HTTP status codes to indicate the success or failure
456     of the API call. The body of the response will be JSON in the following format:
457
458     ```
459     {
460       "error": "Current settings prevent the passed due date to be applied",
461       "error_code": "invalid_due_date"
462     }
463     ```
464
465     Note: Some routes might offer additional attributes in their error responses but that"s
466     subject to change and thus not documented.
467
468     ## Filtering responses
469
470     The API allows for some advanced response filtering using a JSON based query syntax. The
471     query can be added to the requests:
472
473     * as a query parameter `q=`
474     * in the request body
475     * in a special header `x-koha-query`
476
477     For simple field equality matches we can use `{ "fieldname": "value" }` where the fieldname
478     matches one of the fields as described in the particular endpoints response object.
479
480     We can refine that with more complex matching clauses by nesting a the clause into the
481     object; `{ "fieldname": { "clause": "value" } }`.
482
483     Available matching clauses include ">", "<", ">=", "<=", "-like", and "-not_like".
484
485     We can filter on multiple fields by adding them to the JSON respresentation. Adding at `HASH`
486     level will result in an "AND" query, whilst combinding them in an `ARRAY` wilth result in an
487     "OR" query: `{ "field1": "value2", "field2": "value2" }` will filter the response to only those
488     results with both field1 containing value2 AND field2 containing value2 for example.
489
490     Additionally, if you are requesting related data be embedded into the response one can query
491     on the related data using dot notation in the field names.
492
493     ### Examples
494
495     The following request would return any patron with firstname "Henry" and lastname "Acevedo";
496
497     `curl -u koha:koha --request GET "http://127.0.0.1:8081/api/v1/patrons/" --data-raw "{ "surname": "Acevedo", "firstname": "Henry" }"`
498
499     The following request would return any patron whose lastname begins with "Ace";
500
501     `curl -u koha:koha --request GET "http://127.0.0.1:8081/api/v1/patrons/" --data-raw "{ "surname": { "-like": "Ace%" }"`
502
503     The following request would return any patron whose lastname is "Acevedo" OR "Bernardo"
504
505     `curl -u koha:koha --request GET "http://127.0.0.1:8081/api/v1/patrons/" --data-raw "{ "surname": [ "Acevedo", "Bernardo" ] }"`
506
507     The following request embeds the related patron extended attributes data and filters on it.
508
509     `curl -u koha:koha =--request GET 'http://127.0.0.1:8081/api/v1/patrons/' --header 'x-koha-embed: extended_attributes' --data-raw '{ "extended_attributes.code": "internet", "extended_attributes.attribute": "1" }'`
510
511     ## Special headers
512
513     ### x-koha-embed
514
515     This optional header allows the api consumer to request additional related data
516     to be returned in the api response.  It also allows for cross referencing in the
517     queries as described above. It accepts a comma delimited list of relation names.
518
519     Relations may on occasion also support dot delimited nesting to allow traversal.
520
521     ### x-koha-library
522
523     This optional header should be passed to give your api request a library
524     context; If it is not included in the request, then the request context
525     will default to using your api comsumer"s assigned home library.
526 tags:
527   - description: "Manage article requests\n"
528     name: article_requests
529     x-displayName: Article requests
530   - description: "Manage baskets for the acquisitions module\n"
531     name: baskets
532     x-displayName: Baskets
533   - description: "Manage bibliographic records\n"
534     name: biblios
535     x-displayName: Biblios
536   - description: "Manage cash register cashups\n"
537     name: cashups
538     x-displayName: Cashups
539   - description: "Manage checkouts\n"
540     name: checkouts
541     x-displayName: Checkouts
542   - description: "Manage circulation rules\n"
543     name: circulation_rules
544     x-displayName: Circulation rules
545   - description: "Manage cities\n"
546     name: cities
547     x-displayName: Cities
548   - description: "Manage patron clubs\n"
549     name: clubs
550     x-displayName: Clubs
551   - description: "Manage funds for the acquisitions module\n"
552     name: funds
553     x-displayName: Funds
554   - description: "Manage holds\n"
555     name: holds
556     x-displayName: Holds
557   - description: "Manage ILL module backends\n"
558     name: illbackends
559     x-displayName: ILL backends
560   - description: "Manage ILL requests\n"
561     name: illrequests
562     x-displayName: ILL requests
563   - description: "Manage import batches\n"
564     name: import_batches
565     x-display-name: Import batches
566   - description: "Manage items\n"
567     name: items
568     x-displayName: Items
569   - description: "Manage libraries\n"
570     name: libraries
571     x-displayName: Libraries
572   - description: "Manage macros\n"
573     name: macros
574     x-displayName: Macros
575   - description: "Manage acquisition orders\n"
576     name: orders
577     x-displayName: Orders
578   - description: "Handle OAuth flows\n"
579     name: oauth
580     x-displayName: OAuth
581   - description: "Manage patrons\n"
582     name: patrons
583     x-displayName: Patrons
584   - description: "Manage quotes\n"
585     name: quotes
586     x-displayName: Quotes
587   - description: "Manage return claims\n"
588     name: return_claims
589     x-displayName: Return claims
590   - description: "Manage rotas\n"
591     name: rotas
592     x-displayName: Rotas
593   - description: "Manage SMTP servers configurations\n"
594     name: smtp_servers
595     x-displayName: SMTP servers
596   - description: "Manage transfer limits\n"
597     name: transfer
598     x-displayName: Transfer limits
599   - description: "Manage purchase suggestions\n"
600     name: suggestions
601     x-displayName: Purchase suggestions
602   - description: "Manage vendors for the acquisitions module\n"
603     name: vendors
604     x-displayName: Vendors
605   - description: "Manage batch import profiles\n"
606     name: batch_import_profiles
607     x-displayName: Batch import profiles