Bug 17314: OpenAPI spec
[koha.git] / api / v1 / swagger / paths / suggestions.yaml
1 ---
2 /suggestions:
3   get:
4     x-mojo-to: Suggestions#list
5     operationId: listSuggestions
6     description: This resource returns a list of purchase suggestions
7     summary: List purchase suggestions
8     tags:
9       - suggestions
10     parameters:
11       - $ref: ../parameters.json#/match
12       - $ref: ../parameters.json#/order_by
13       - $ref: ../parameters.json#/page
14       - $ref: ../parameters.json#/per_page
15       - $ref: ../parameters.json#/q_param
16       - $ref: ../parameters.json#/q_body
17       - $ref: ../parameters.json#/q_header
18     produces:
19       - application/json
20     responses:
21       "200":
22         description: A list of suggestions
23         schema:
24           type: array
25           items:
26             $ref: ../definitions.json#/suggestion
27       "403":
28         description: Access forbidden
29         schema:
30           $ref: ../definitions.json#/error
31       "500":
32         description: Internal error
33         schema:
34           $ref: ../definitions.json#/error
35       "503":
36         description: Under maintenance
37         schema:
38           $ref: ../definitions.json#/error
39     x-koha-authorization:
40       permissions:
41         suggestions: suggestions_manage
42   post:
43     x-mojo-to: Suggestions#add
44     operationId: addSuggestions
45     description: This resource accepts a new purchase suggestion and creates it
46     summary: Add a purchase suggestion
47     tags:
48       - suggestions
49     parameters:
50       - name: body
51         in: body
52         description: A JSON object containing informations about the new suggestion
53         required: true
54         schema:
55           $ref: ../definitions.json#/suggestion
56     produces:
57       - application/json
58     responses:
59       "201":
60         description: Suggestion added
61         schema:
62           $ref: ../definitions.json#/suggestion
63       "400":
64         description: Bad request
65         schema:
66           $ref: ../definitions.json#/error
67       "403":
68         description: Access forbidden
69         schema:
70           $ref: ../definitions.json#/error
71       "500":
72         description: Internal error
73         schema:
74           $ref: ../definitions.json#/error
75       "503":
76         description: Under maintenance
77         schema:
78           $ref: ../definitions.json#/error
79     x-koha-authorization:
80       permissions:
81         suggestions: suggestions_manage
82 "/suggestions/{suggestion_id}":
83   get:
84     x-mojo-to: Suggestions#get
85     operationId: getSuggestion
86     description: This resource gives access to a specific purchase suggestion
87     summary: Get purchase suggestion
88     tags:
89       - suggestions
90     parameters:
91       - $ref: ../parameters.json#/suggestion_id_pp
92     produces:
93       - application/json
94     responses:
95       "200":
96         description: A suggestion
97         schema:
98           $ref: ../definitions.json#/suggestion
99       "403":
100         description: Access forbidden
101         schema:
102           $ref: ../definitions.json#/error
103       "404":
104         description: Suggestion not found
105         schema:
106           $ref: ../definitions.json#/error
107       "500":
108         description: Internal error
109         schema:
110           $ref: ../definitions.json#/error
111       "503":
112         description: Under maintenance
113         schema:
114           $ref: ../definitions.json#/error
115     x-koha-authorization:
116       permissions:
117         suggestions: suggestions_manage
118   put:
119     x-mojo-to: Suggestions#update
120     operationId: updateSuggestion
121     description: This resource allows updating an existing purchase suggestion
122     summary: Update purchase suggestion
123     tags:
124       - suggestions
125     parameters:
126       - $ref: ../parameters.json#/suggestion_id_pp
127       - name: body
128         in: body
129         description: A JSON object containing informations about the new hold
130         required: true
131         schema:
132           $ref: ../definitions.json#/suggestion
133     produces:
134       - application/json
135     responses:
136       "200":
137         description: A suggestion
138         schema:
139           $ref: ../definitions.json#/suggestion
140       "400":
141         description: Bad request
142         schema:
143           $ref: ../definitions.json#/error
144       "403":
145         description: Access forbidden
146         schema:
147           $ref: ../definitions.json#/error
148       "404":
149         description: Suggestion not found
150         schema:
151           $ref: ../definitions.json#/error
152       "500":
153         description: Internal error
154         schema:
155           $ref: ../definitions.json#/error
156       "503":
157         description: Under maintenance
158         schema:
159           $ref: ../definitions.json#/error
160     x-koha-authorization:
161       permissions:
162         suggestions: suggestions_manage
163   delete:
164     x-mojo-to: Suggestions#delete
165     operationId: deleteSuggestion
166     description: This resource deletes an existing purchase suggestion
167     summary: Delete purchase suggestion
168     tags:
169       - suggestions
170     parameters:
171       - $ref: ../parameters.json#/suggestion_id_pp
172     produces:
173       - application/json
174     responses:
175       "204":
176         description: Suggestion deleted
177         schema:
178           type: string
179       "401":
180         description: Authentication required
181         schema:
182           $ref: ../definitions.json#/error
183       "403":
184         description: Access forbidden
185         schema:
186           $ref: ../definitions.json#/error
187       "404":
188         description: Suggestion not found
189         schema:
190           $ref: ../definitions.json#/error
191       "500":
192         description: Internal error
193         schema:
194           $ref: ../definitions.json#/error
195       "503":
196         description: Under maintenance
197         schema:
198           $ref: ../definitions.json#/error
199     x-koha-authorization:
200       permissions:
201         suggestions: suggestions_manage