Bug 31791: Add x-record-source-id header to POST /biblios
[koha.git] / api / v1 / swagger / paths / biblios.yaml
1 ---
2 "/biblios":
3   post:
4     x-mojo-to: Biblios#add
5     operationId: addBiblio
6     tags:
7       - biblios
8     summary: Add biblio
9     description: |
10       Add a bibliographic record to Koha. An optional `x-framework-id`
11       may be passed to specify the cataloguing framework to be used (instead
12       of the default).
13
14       The request body is expected to contain a MARC record in the format specified in
15       the `Content-type` header you pass. Possible values for this header and the corresponding
16       record formats expected are listed below:
17
18       * application/marcxml+xml: MARCXML
19       * application/marc-in-json: MARC-in-JSON
20       * application/marc: Raw USMARC binary data
21     parameters:
22       - $ref: "../swagger.yaml#/parameters/framework_id_header"
23       - $ref: "../swagger.yaml#/parameters/marc_schema_header"
24       - $ref: "../swagger.yaml#/parameters/confirm_not_duplicate_header"
25       - $ref: "../swagger.yaml#/parameters/record_source_id_header"
26     produces:
27       - application/json
28     responses:
29       "200":
30         description: A biblio
31       "400":
32         description: Bad request
33         schema:
34           $ref: "../swagger.yaml#/definitions/error"
35       "401":
36         description: Authentication required
37         schema:
38           $ref: "../swagger.yaml#/definitions/error"
39       "403":
40         description: Access forbidden
41         schema:
42           $ref: "../swagger.yaml#/definitions/error"
43       "406":
44         description: Not acceptable
45         schema:
46           type: array
47           description: Accepted content-types
48           items:
49             type: string
50       "500":
51         description: |
52           Internal server error. Possible `error_code` attribute values:
53
54           * `internal_server_error`
55         schema:
56           $ref: "../swagger.yaml#/definitions/error"
57       "503":
58         description: Under maintenance
59         schema:
60           $ref: "../swagger.yaml#/definitions/error"
61     x-koha-authorization:
62       permissions:
63         editcatalogue: edit_catalogue
64   get:
65     x-mojo-to: Biblios#list
66     operationId: listBiblio
67     tags:
68       - biblios
69     summary: List biblios
70     parameters:
71       - $ref: "../swagger.yaml#/parameters/page"
72       - $ref: "../swagger.yaml#/parameters/per_page"
73       - $ref: "../swagger.yaml#/parameters/match"
74       - $ref: "../swagger.yaml#/parameters/order_by"
75       - $ref: "../swagger.yaml#/parameters/q_param"
76       - $ref: "../swagger.yaml#/parameters/q_body"
77       - $ref: "../swagger.yaml#/parameters/request_id_header"
78     produces:
79       - application/json
80       - application/marcxml+xml
81       - application/marc-in-json
82       - application/marc
83       - text/plain
84     responses:
85       "200":
86         description: A list of biblios
87       "401":
88         description: Authentication required
89         schema:
90           $ref: "../swagger.yaml#/definitions/error"
91       "403":
92         description: Access forbidden
93         schema:
94           $ref: "../swagger.yaml#/definitions/error"
95       "404":
96         description: Biblio not found
97         schema:
98           $ref: "../swagger.yaml#/definitions/error"
99       "406":
100         description: Not acceptable
101         schema:
102           type: array
103           description: Accepted content-types
104           items:
105             type: string
106       "500":
107         description: |
108           Internal server error. Possible `error_code` attribute values:
109
110           * `internal_server_error`
111         schema:
112           $ref: "../swagger.yaml#/definitions/error"
113       "503":
114         description: Under maintenance
115         schema:
116           $ref: "../swagger.yaml#/definitions/error"
117     x-koha-authorization:
118       permissions:
119         catalogue: "1"
120 "/biblios/{biblio_id}":
121   get:
122     x-mojo-to: Biblios#get
123     operationId: getBiblio
124     tags:
125       - biblios
126     summary: Get biblio
127     parameters:
128       - $ref: "../swagger.yaml#/parameters/biblio_id_pp"
129     produces:
130       - application/json
131       - application/marcxml+xml
132       - application/marc-in-json
133       - application/marc
134       - text/plain
135     responses:
136       "200":
137         description: A biblio
138       "401":
139         description: Authentication required
140         schema:
141           $ref: "../swagger.yaml#/definitions/error"
142       "403":
143         description: Access forbidden
144         schema:
145           $ref: "../swagger.yaml#/definitions/error"
146       "404":
147         description: Biblio not found
148         schema:
149           $ref: "../swagger.yaml#/definitions/error"
150       "406":
151         description: Not acceptable
152         schema:
153           type: array
154           description: Accepted content-types
155           items:
156             type: string
157       "500":
158         description: |
159           Internal server error. Possible `error_code` attribute values:
160
161           * `internal_server_error`
162         schema:
163           $ref: "../swagger.yaml#/definitions/error"
164       "503":
165         description: Under maintenance
166         schema:
167           $ref: "../swagger.yaml#/definitions/error"
168     x-koha-authorization:
169       permissions:
170         catalogue: "1"
171   delete:
172     x-mojo-to: Biblios#delete
173     operationId: deleteBiblio
174     tags:
175       - biblios
176     summary: Delete biblio
177     parameters:
178       - $ref: "../swagger.yaml#/parameters/biblio_id_pp"
179     produces:
180       - application/json
181     responses:
182       "204":
183         description: Biblio deleted
184         schema:
185           type: string
186       "401":
187         description: Authentication required
188         schema:
189           $ref: "../swagger.yaml#/definitions/error"
190       "403":
191         description: Access forbidden
192         schema:
193           $ref: "../swagger.yaml#/definitions/error"
194       "404":
195         description: Biblio not found
196         schema:
197           $ref: "../swagger.yaml#/definitions/error"
198       "409":
199         description: Unable to perform action on biblio
200         schema:
201           $ref: "../swagger.yaml#/definitions/error"
202       "500":
203         description: Internal error
204         schema:
205           $ref: "../swagger.yaml#/definitions/error"
206       "503":
207         description: Under maintenance
208         schema:
209           $ref: "../swagger.yaml#/definitions/error"
210     x-koha-authorization:
211       permissions:
212         editcatalogue: edit_catalogue
213   put:
214     x-mojo-to: Biblios#update
215     operationId: updateBiblio
216     tags:
217       - biblios
218     summary: Update biblio
219     description: |
220       Updates a bibliographic record to Koha. An optional `x-framework-id`
221       may be passed, to specify the cataloguing framework to be used (instead
222       of the default).
223
224       The request body is expected to contain a MARC record in the format specified by
225       the `Content-type` header passed. Possible values for this headers and the corresponding
226       record formats expected are listed below:
227
228       * application/marcxml+xml: MARCXML
229       * application/marc-in-json: MARC-in-JSON
230       * application/marc: Raw USMARC binary data
231     parameters:
232       - $ref: "../swagger.yaml#/parameters/biblio_id_pp"
233       - $ref: "../swagger.yaml#/parameters/framework_id_header"
234       - $ref: "../swagger.yaml#/parameters/marc_schema_header"
235       - $ref: "../swagger.yaml#/parameters/confirm_not_duplicate_header"
236     produces:
237       - application/json
238     responses:
239       "200":
240         description: A biblio
241       "400":
242         description: Bad request
243         schema:
244           $ref: "../swagger.yaml#/definitions/error"
245       "401":
246         description: Authentication required
247         schema:
248           $ref: "../swagger.yaml#/definitions/error"
249       "403":
250         description: Access forbidden
251         schema:
252           $ref: "../swagger.yaml#/definitions/error"
253       "404":
254         description: Biblio not found
255         schema:
256           $ref: "../swagger.yaml#/definitions/error"
257       "406":
258         description: Not acceptable
259         schema:
260           type: array
261           description: Accepted content-types
262           items:
263             type: string
264       "500":
265         description: |
266           Internal server error. Possible `error_code` attribute values:
267
268           * `internal_server_error`
269         schema:
270           $ref: "../swagger.yaml#/definitions/error"
271       "503":
272         description: Under maintenance
273         schema:
274           $ref: "../swagger.yaml#/definitions/error"
275     x-koha-authorization:
276       permissions:
277         editcatalogue: edit_catalogue
278 "/biblios/{biblio_id}/bookings":
279   get:
280     x-mojo-to: Biblios#get_bookings
281     operationId: getBiblioBookings
282     tags:
283       - bookings
284     summary: Get bookings for a biblio
285     parameters:
286       - $ref: "../swagger.yaml#/parameters/biblio_id_pp"
287       - $ref: "../swagger.yaml#/parameters/match"
288       - $ref: "../swagger.yaml#/parameters/order_by"
289       - $ref: "../swagger.yaml#/parameters/page"
290       - $ref: "../swagger.yaml#/parameters/per_page"
291       - $ref: "../swagger.yaml#/parameters/q_param"
292       - $ref: "../swagger.yaml#/parameters/q_body"
293       - name: x-koha-embed
294         in: header
295         required: false
296         description: Embed list sent as a request header
297         type: array
298         items:
299           type: string
300           enum:
301             - item
302             - patron
303         collectionFormat: csv
304     consumes:
305       - application/json
306     produces:
307       - application/json
308     responses:
309       "200":
310         description: A list of the bookings attached to the record
311         schema:
312           type: array
313           items:
314             $ref: ../swagger.yaml#/definitions/booking
315       "401":
316         description: Authentication required
317         schema:
318           $ref: ../swagger.yaml#/definitions/error
319       "403":
320         description: Access forbidden
321         schema:
322           $ref: ../swagger.yaml#/definitions/error
323       "404":
324         description: Biblio not found
325         schema:
326           $ref: ../swagger.yaml#/definitions/error
327       "406":
328         description: Not acceptable
329         schema:
330           type: array
331           description: Accepted content-types
332           items:
333             type: string
334       "500":
335         description: Internal server error
336         schema:
337           $ref: ../swagger.yaml#/definitions/error
338       "503":
339         description: Under maintenance
340         schema:
341           $ref: ../swagger.yaml#/definitions/error
342     x-koha-authorization:
343       permissions:
344         circulate: "manage_bookings"
345 "/biblios/{biblio_id}/checkouts":
346   get:
347     x-mojo-to: Biblios#get_checkouts
348     operationId: listBiblioCheckouts
349     tags:
350       - checkouts
351     summary: List checkouts for a biblio
352     parameters:
353       - $ref: "../swagger.yaml#/parameters/biblio_id_pp"
354       - $ref: "../swagger.yaml#/parameters/page"
355       - $ref: "../swagger.yaml#/parameters/per_page"
356       - $ref: "../swagger.yaml#/parameters/match"
357       - $ref: "../swagger.yaml#/parameters/order_by"
358       - $ref: "../swagger.yaml#/parameters/q_param"
359       - $ref: "../swagger.yaml#/parameters/q_body"
360       - $ref: "../swagger.yaml#/parameters/request_id_header"
361       - name: x-koha-embed
362         in: header
363         required: false
364         description: Embed list sent as a request header
365         type: array
366         items:
367           type: string
368           enum:
369             - issuer
370             - item
371             - patron
372             - library
373         collectionFormat: csv
374       - name: checked_in
375         in: query
376         description: By default, current checkouts are returned, when this is true then
377           checked in checkouts are returned as result.
378         type: boolean
379     produces:
380       - application/json
381     responses:
382       "200":
383         description: A list of checkouts
384         schema:
385           $ref: "../swagger.yaml#/definitions/checkouts"
386       "403":
387         description: Access forbidden
388         schema:
389           $ref: "../swagger.yaml#/definitions/error"
390       "404":
391         description: Biblio not found
392         schema:
393           $ref: "../swagger.yaml#/definitions/error"
394       "500":
395         description: |
396           Internal server error. Possible `error_code` attribute values:
397
398           * `internal_server_error`
399         schema:
400           $ref: "../swagger.yaml#/definitions/error"
401       "503":
402         description: Under maintenance
403         schema:
404           $ref: "../swagger.yaml#/definitions/error"
405     x-koha-authorization:
406       permissions:
407         - circulate: circulate_remaining_permissions
408         - circulate: manage_bookings
409 "/biblios/{biblio_id}/items":
410   get:
411     x-mojo-to: Biblios#get_items
412     operationId: getBiblioItems
413     tags:
414       - biblios
415     summary: Get items for a biblio
416     parameters:
417       - $ref: "../swagger.yaml#/parameters/biblio_id_pp"
418       - name: x-koha-embed
419         in: header
420         required: false
421         description: Embed list sent as a request header
422         type: array
423         items:
424           type: string
425           enum:
426             - +strings
427             - home_library
428             - holding_library
429             - biblio.title
430             - checkout
431             - checkout.patron
432             - transfer
433             - transfer+strings
434             - first_hold
435             - first_hold+strings
436             - first_hold.patron
437             - first_hold.desk
438             - recall
439             - recall+strings
440             - recall.patron
441             - item_type
442             - in_bundle
443             - bundle_host
444             - bundle_items_lost+count
445             - bundle_items_not_lost+count
446             - course_item.course_reserves.course
447             - analytics_count
448             - cover_image_ids
449             - item_group_item.item_group.description
450             - serial_item.serial
451         collectionFormat: csv
452       - $ref: "../swagger.yaml#/parameters/match"
453       - $ref: "../swagger.yaml#/parameters/order_by"
454       - $ref: "../swagger.yaml#/parameters/page"
455       - $ref: "../swagger.yaml#/parameters/per_page"
456       - $ref: "../swagger.yaml#/parameters/q_param"
457       - $ref: "../swagger.yaml#/parameters/q_body"
458       - $ref: "../swagger.yaml#/parameters/request_id_header"
459       - name: bookable
460         in: query
461         description: Limit to items that are bookable
462         required: false
463         type: boolean
464     consumes:
465       - application/json
466     produces:
467       - application/json
468     responses:
469       "200":
470         description: A list of the items attached to the record
471         schema:
472           type: array
473           items:
474             $ref: "../swagger.yaml#/definitions/item"
475       "401":
476         description: Authentication required
477         schema:
478           $ref: "../swagger.yaml#/definitions/error"
479       "403":
480         description: Access forbidden
481         schema:
482           $ref: "../swagger.yaml#/definitions/error"
483       "404":
484         description: Biblio not found
485         schema:
486           $ref: "../swagger.yaml#/definitions/error"
487       "406":
488         description: Not acceptable
489         schema:
490           type: array
491           description: Accepted content-types
492           items:
493             type: string
494       "500":
495         description: |
496           Internal server error. Possible `error_code` attribute values:
497
498           * `internal_server_error`
499         schema:
500           $ref: "../swagger.yaml#/definitions/error"
501       "503":
502         description: Under maintenance
503         schema:
504           $ref: "../swagger.yaml#/definitions/error"
505     x-koha-authorization:
506       permissions:
507         catalogue: "1"
508   post:
509     x-mojo-to: Biblios#add_item
510     operationId: addBiblioItem
511     tags:
512       - biblios
513     summary: Add an item for a biblio
514     parameters:
515       - $ref: "../swagger.yaml#/parameters/biblio_id_pp"
516       - name: body
517         in: body
518         description: A JSON object containing information about the new item
519         required: true
520         schema:
521           $ref: "../swagger.yaml#/definitions/item"
522     produces:
523       - application/json
524     responses:
525       "201":
526         description: Item added
527         schema:
528           $ref: "../swagger.yaml#/definitions/item"
529       "400":
530         description: Bad request
531         schema:
532           $ref: "../swagger.yaml#/definitions/error"
533       "401":
534         description: Authentication required
535         schema:
536           $ref: "../swagger.yaml#/definitions/error"
537       "403":
538         description: Access forbidden
539         schema:
540           $ref: "../swagger.yaml#/definitions/error"
541       "404":
542         description: Not found
543         schema:
544           $ref: "../swagger.yaml#/definitions/error"
545       "409":
546         description: Conflict
547         schema:
548           $ref: "../swagger.yaml#/definitions/error"
549       "500":
550         description: |
551           Internal server error. Possible `error_code` attribute values:
552
553           * `internal_server_error`
554         schema:
555           $ref: "../swagger.yaml#/definitions/error"
556       "503":
557         description: Under maintenance
558         schema:
559           $ref: "../swagger.yaml#/definitions/error"
560     x-koha-authorization:
561       permissions:
562         editcatalogue: edit_catalogue
563 "/biblios/{biblio_id}/items/{item_id}":
564   put:
565     x-mojo-to: Biblios#update_item
566     operationId: updateBiblioItem
567     tags:
568       - biblios
569     summary: Update an item for a biblio
570     parameters:
571       - $ref: "../swagger.yaml#/parameters/biblio_id_pp"
572       - $ref: "../swagger.yaml#/parameters/item_id_pp"
573       - name: body
574         in: body
575         description: A JSON object containing information about the item
576         required: true
577         schema:
578           $ref: "../swagger.yaml#/definitions/item"
579     produces:
580       - application/json
581     responses:
582       "200":
583         description: Item updated
584         schema:
585           $ref: "../swagger.yaml#/definitions/item"
586       "400":
587         description: Bad request
588         schema:
589           $ref: "../swagger.yaml#/definitions/error"
590       "401":
591         description: Authentication required
592         schema:
593           $ref: "../swagger.yaml#/definitions/error"
594       "403":
595         description: Access forbidden
596         schema:
597           $ref: "../swagger.yaml#/definitions/error"
598       "404":
599         description: Not found
600         schema:
601           $ref: "../swagger.yaml#/definitions/error"
602       "409":
603         description: Conflict
604         schema:
605           $ref: "../swagger.yaml#/definitions/error"
606       "500":
607         description: |
608           Internal server error. Possible `error_code` attribute values:
609
610           * `internal_server_error`
611         schema:
612           $ref: "../swagger.yaml#/definitions/error"
613       "503":
614         description: Under maintenance
615         schema:
616           $ref: "../swagger.yaml#/definitions/error"
617     x-koha-authorization:
618       permissions:
619         editcatalogue: edit_catalogue
620 "/biblios/{biblio_id}/pickup_locations":
621   get:
622     x-mojo-to: Biblios#pickup_locations
623     operationId: getBiblioPickupLocations
624     tags:
625       - biblios
626     summary: Get valid pickup locations for a biblio
627     parameters:
628       - $ref: "../swagger.yaml#/parameters/biblio_id_pp"
629       - name: patron_id
630         in: query
631         description: Internal patron identifier
632         required: true
633         type: integer
634       - $ref: "../swagger.yaml#/parameters/match"
635       - $ref: "../swagger.yaml#/parameters/order_by"
636       - $ref: "../swagger.yaml#/parameters/page"
637       - $ref: "../swagger.yaml#/parameters/per_page"
638       - $ref: "../swagger.yaml#/parameters/q_param"
639       - $ref: "../swagger.yaml#/parameters/q_body"
640     consumes:
641       - application/json
642     produces:
643       - application/json
644     responses:
645       "200":
646         description: Biblio pickup locations
647         schema:
648           type: array
649           items:
650             $ref: "../swagger.yaml#/definitions/library"
651       "400":
652         description: Missing or wrong parameters
653         schema:
654           $ref: "../swagger.yaml#/definitions/error"
655       "401":
656         description: Authentication required
657         schema:
658           $ref: "../swagger.yaml#/definitions/error"
659       "403":
660         description: Access forbidden
661         schema:
662           $ref: "../swagger.yaml#/definitions/error"
663       "404":
664         description: Biblio not found
665         schema:
666           $ref: "../swagger.yaml#/definitions/error"
667       "500":
668         description: |
669           Internal server error. Possible `error_code` attribute values:
670
671           * `internal_server_error`
672         schema:
673           $ref: "../swagger.yaml#/definitions/error"
674       "503":
675         description: Under maintenance
676         schema:
677           $ref: "../swagger.yaml#/definitions/error"
678     x-koha-authorization:
679       permissions:
680         reserveforothers: place_holds
681 "/public/biblios/{biblio_id}":
682   get:
683     x-mojo-to: Biblios#get_public
684     operationId: getBiblioPublic
685     tags:
686       - biblios
687     summary: Get biblio (public)
688     parameters:
689       - $ref: "../swagger.yaml#/parameters/biblio_id_pp"
690     produces:
691       - application/marcxml+xml
692       - application/marc-in-json
693       - application/marc
694       - text/plain
695     responses:
696       "200":
697         description: A biblio
698       "401":
699         description: Authentication required
700         schema:
701           $ref: "../swagger.yaml#/definitions/error"
702       "403":
703         description: Access forbidden
704         schema:
705           $ref: "../swagger.yaml#/definitions/error"
706       "404":
707         description: Biblio not found
708         schema:
709           $ref: "../swagger.yaml#/definitions/error"
710       "406":
711         description: Not acceptable
712         schema:
713           type: array
714           description: Accepted content-types
715           items:
716             type: string
717       "500":
718         description: |
719           Internal server error. Possible `error_code` attribute values:
720
721           * `internal_server_error`
722         schema:
723           $ref: "../swagger.yaml#/definitions/error"
724       "503":
725         description: Under maintenance
726         schema:
727           $ref: "../swagger.yaml#/definitions/error"
728 "/public/biblios/{biblio_id}/items":
729   get:
730     x-mojo-to: Biblios#get_items_public
731     operationId: getBiblioItemsPublic
732     tags:
733       - biblios
734       - items
735     parameters:
736       - $ref: "../swagger.yaml#/parameters/biblio_id_pp"
737       - $ref: "../swagger.yaml#/parameters/match"
738       - $ref: "../swagger.yaml#/parameters/order_by"
739       - $ref: "../swagger.yaml#/parameters/page"
740       - $ref: "../swagger.yaml#/parameters/per_page"
741       - $ref: "../swagger.yaml#/parameters/q_param"
742       - $ref: "../swagger.yaml#/parameters/q_body"
743       - name: x-koha-embed
744         in: header
745         required: false
746         description: Embed list sent as a request header
747         type: array
748         items:
749           type: string
750           enum:
751             - +strings
752         collectionFormat: csv
753     consumes:
754       - application/json
755     produces:
756       - application/json
757     responses:
758       "200":
759         description: A list of the items attached to the record
760         schema:
761           type: array
762           items:
763             $ref: "../swagger.yaml#/definitions/item"
764       "401":
765         description: Authentication required
766         schema:
767           $ref: "../swagger.yaml#/definitions/error"
768       "403":
769         description: Access forbidden
770         schema:
771           $ref: "../swagger.yaml#/definitions/error"
772       "404":
773         description: Biblio not found
774         schema:
775           $ref: "../swagger.yaml#/definitions/error"
776       "406":
777         description: Not acceptable
778         schema:
779           type: array
780           description: Accepted content-types
781           items:
782             type: string
783       "500":
784         description: |
785           Internal server error. Possible `error_code` attribute values:
786
787           * `internal_server_error`
788         schema:
789           $ref: "../swagger.yaml#/definitions/error"
790       "503":
791         description: Under maintenance
792         schema:
793           $ref: "../swagger.yaml#/definitions/error"
794 "/public/biblios/{biblio_id}/ratings":
795   post:
796     x-mojo-to: Biblios#set_rating
797     operationId: setBiblioRating
798     tags:
799       - biblios
800     summary: set biblio rating (public)
801     parameters:
802       - $ref: "../swagger.yaml#/parameters/biblio_id_pp"
803       - name: body
804         in: body
805         description: A JSON object containing rating information
806         schema:
807           type: object
808           properties:
809             rating:
810               description: the rating
811               type:
812                 - integer
813                 - "null"
814           required:
815               - rating
816           additionalProperties: false
817     produces:
818       - application/json
819     responses:
820       "200":
821         description: Rating set
822         schema:
823           type: object
824           properties:
825             rating:
826               description: user's rating
827               type:
828                 - number
829                 - "null"
830             average:
831               description: average rating
832               type: number
833             count:
834               description: number of ratings
835               type: integer
836           additionalProperties: false
837       "401":
838         description: Authentication required
839         schema:
840           $ref: "../swagger.yaml#/definitions/error"
841       "403":
842         description: Access forbidden
843         schema:
844           $ref: "../swagger.yaml#/definitions/error"
845       "404":
846         description: Biblio not found
847         schema:
848           $ref: "../swagger.yaml#/definitions/error"
849       "500":
850         description: |
851           Internal server error. Possible `error_code` attribute values:
852
853           * `internal_server_error`
854         schema:
855           $ref: "../swagger.yaml#/definitions/error"
856       "503":
857         description: Under maintenance
858         schema:
859           $ref: "../swagger.yaml#/definitions/error"