Bug 31795: (QA follow-up) Use x-koha-override header
[koha.git] / api / v1 / swagger / paths / authorities.yaml
1 ---
2 "/authorities":
3   post:
4     x-mojo-to: Authorities#add
5     operationId: addAuthority
6     tags:
7       - authorities
8     summary: Add authority
9     description: |
10       Add an authority record to Koha. An optional `x-authority-type`
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/authority_type_header"
23       - name: x-koha-override
24         in: header
25         required: false
26         description: Overrides list sent as a request header
27         type: array
28         items:
29           type: string
30           enum:
31             - any
32             - duplicate
33         collectionFormat: csv
34     responses:
35       "201":
36         description: An authority
37       "400":
38         description: Bad request.
39         schema:
40           $ref: "../swagger.yaml#/definitions/error"
41       "401":
42         description: Authentication required
43         schema:
44           $ref: "../swagger.yaml#/definitions/error"
45       "403":
46         description: Access forbidden
47         schema:
48           $ref: "../swagger.yaml#/definitions/error"
49       "406":
50         description: Not acceptable
51         schema:
52           type: array
53           description: Accepted content-types
54           items:
55             type: string
56       "409":
57         description: |
58           Conflict creating the resource. Possible `error_code` attribute values:
59
60           * `duplicate`
61         schema:
62           $ref: "../swagger.yaml#/definitions/error"
63       "500":
64         description: |
65           Internal server error. Possible `error_code` attribute values:
66
67           * `internal_server_error`
68         schema:
69           $ref: "../swagger.yaml#/definitions/error"
70       "503":
71         description: Under maintenance
72         schema:
73           $ref: "../swagger.yaml#/definitions/error"
74     x-koha-authorization:
75       permissions:
76         editcatalogue: edit_catalogue
77 "/authorities/{authority_id}":
78   get:
79     x-mojo-to: Authorities#get
80     operationId: getAuthority
81     tags:
82       - authorities
83     summary: Get authority
84     parameters:
85       - $ref: "../swagger.yaml#/parameters/authority_id_pp"
86     produces:
87       - application/json
88       - application/marcxml+xml
89       - application/marc-in-json
90       - application/marc
91       - text/plain
92     responses:
93       "200":
94         description: An authority
95       "401":
96         description: Authentication required
97         schema:
98           $ref: "../swagger.yaml#/definitions/error"
99       "403":
100         description: Access forbidden
101         schema:
102           $ref: "../swagger.yaml#/definitions/error"
103       "404":
104         description: Authority not found
105         schema:
106           $ref: "../swagger.yaml#/definitions/error"
107       "406":
108         description: Not acceptable
109         schema:
110           type: array
111           description: Accepted content-types
112           items:
113             type: string
114       "500":
115         description: |
116           Internal server error. Possible `error_code` attribute values:
117
118           * `internal_server_error`
119         schema:
120           $ref: "../swagger.yaml#/definitions/error"
121       "503":
122         description: Under maintenance
123         schema:
124           $ref: "../swagger.yaml#/definitions/error"
125     x-koha-authorization:
126       permissions:
127         catalogue: "1"
128   delete:
129     x-mojo-to: Authorities#delete
130     operationId: deleteAuthority
131     tags:
132       - authorities
133     summary: Delete authority
134     parameters:
135       - $ref: "../swagger.yaml#/parameters/authority_id_pp"
136     produces:
137       - application/json
138     responses:
139       "204":
140         description: Authority deleted
141         schema:
142           type: string
143       "401":
144         description: Authentication required
145         schema:
146           $ref: "../swagger.yaml#/definitions/error"
147       "403":
148         description: Access forbidden
149         schema:
150           $ref: "../swagger.yaml#/definitions/error"
151       "404":
152         description: Authority not found
153         schema:
154           $ref: "../swagger.yaml#/definitions/error"
155       "500":
156         description: Internal error
157         schema:
158           $ref: "../swagger.yaml#/definitions/error"
159       "503":
160         description: Under maintenance
161         schema:
162           $ref: "../swagger.yaml#/definitions/error"
163     x-koha-authorization:
164       permissions:
165         editauthorities: "1"