[TECHDEBT] Align CPS Core REST API Specification and Implementation
[cps.git] / cps-rest / docs / openapi / cpsData.yml
1 # ============LICENSE_START=======================================================
2 # Copyright (c) 2021 Bell Canada.
3 # Modifications Copyright (C) 2021-2022 Nordix Foundation
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
19
20 nodeByDataspaceAndAnchor:
21   get:
22     description: Get a node with an option to retrieve all the children for a given anchor and dataspace
23     tags:
24       - cps-data
25     summary: Get a node
26     operationId: getNodeByDataspaceAndAnchor
27     parameters:
28       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
29       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
30       - $ref: 'components.yml#/components/parameters/xpathInQuery'
31       - $ref: 'components.yml#/components/parameters/includeDescendantsOptionInQuery'
32     responses:
33       '200':
34         description: OK
35         content:
36           application/json:
37             schema:
38               type: object
39             examples:
40               dataSampleResponse:
41                 $ref: 'components.yml#/components/examples/dataSampleResponse'
42       '400':
43         $ref: 'components.yml#/components/responses/BadRequest'
44       '401':
45         $ref: 'components.yml#/components/responses/Unauthorized'
46       '403':
47         $ref: 'components.yml#/components/responses/Forbidden'
48       '500':
49         $ref: 'components.yml#/components/responses/InternalServerError'
50     x-codegen-request-body-name: xpath
51
52 listElementByDataspaceAndAnchor:
53   post:
54     description: Add list element(s) to a list for a given anchor and dataspace
55     tags:
56       - cps-data
57     summary: Add list element(s)
58     operationId: addListElements
59     parameters:
60       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
61       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
62       - $ref: 'components.yml#/components/parameters/requiredXpathInQuery'
63       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
64     requestBody:
65       required: true
66       content:
67         application/json:
68           schema:
69             type: object
70           examples:
71             dataSampleRequest:
72               $ref: 'components.yml#/components/examples/dataSampleRequest'
73     responses:
74       '201':
75         $ref: 'components.yml#/components/responses/Created'
76       '400':
77         $ref: 'components.yml#/components/responses/BadRequest'
78       '401':
79         $ref: 'components.yml#/components/responses/Unauthorized'
80       '403':
81         $ref: 'components.yml#/components/responses/Forbidden'
82       '500':
83         $ref: 'components.yml#/components/responses/InternalServerError'
84   put:
85     description: Replace list content under a given parent, anchor and dataspace
86     tags:
87       - cps-data
88     summary: Replace list content
89     operationId: replaceListContent
90     parameters:
91       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
92       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
93       - $ref: 'components.yml#/components/parameters/requiredXpathInQuery'
94       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
95     requestBody:
96       required: true
97       content:
98         application/json:
99           schema:
100             type: object
101           examples:
102             dataSampleRequest:
103               $ref: 'components.yml#/components/examples/dataSampleRequest'
104     responses:
105       '200':
106         $ref: 'components.yml#/components/responses/Ok'
107       '400':
108         $ref: 'components.yml#/components/responses/BadRequest'
109       '401':
110         $ref: 'components.yml#/components/responses/Unauthorized'
111       '403':
112         $ref: 'components.yml#/components/responses/Forbidden'
113       '500':
114         $ref: 'components.yml#/components/responses/InternalServerError'
115   delete:
116     description: Delete one or all list element(s) for a given anchor and dataspace
117     deprecated: true
118     tags:
119       - cps-data
120     summary: Delete one or all list element(s)
121     operationId: deleteListOrListElement
122     parameters:
123       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
124       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
125       - $ref: 'components.yml#/components/parameters/requiredXpathInQuery'
126       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
127     responses:
128       '204':
129         $ref: 'components.yml#/components/responses/NoContent'
130       '400':
131         $ref: 'components.yml#/components/responses/BadRequest'
132       '401':
133         $ref: 'components.yml#/components/responses/Unauthorized'
134       '403':
135         $ref: 'components.yml#/components/responses/Forbidden'
136       '500':
137         $ref: 'components.yml#/components/responses/InternalServerError'
138
139 nodesByDataspaceAndAnchor:
140   post:
141     description: Create a node for a given anchor and dataspace
142     tags:
143       - cps-data
144     summary: Create a node
145     operationId: createNode
146     parameters:
147       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
148       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
149       - $ref: 'components.yml#/components/parameters/xpathInQuery'
150       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
151     requestBody:
152       required: true
153       content:
154         application/json:
155           schema:
156             type: object
157           examples:
158             dataSampleRequest:
159               $ref: 'components.yml#/components/examples/dataSampleRequest'
160     responses:
161       '201':
162         $ref: 'components.yml#/components/responses/Created'
163       '400':
164         $ref: 'components.yml#/components/responses/BadRequest'
165       '401':
166         $ref: 'components.yml#/components/responses/Unauthorized'
167       '403':
168         $ref: 'components.yml#/components/responses/Forbidden'
169       '409':
170         $ref: 'components.yml#/components/responses/Conflict'
171       '500':
172         $ref: 'components.yml#/components/responses/InternalServerError'
173   patch:
174     description: Update a data node leaves for a given dataspace and anchor and a parent node xpath
175     tags:
176       - cps-data
177     summary: Update node leaves
178     operationId: updateNodeLeaves
179     parameters:
180       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
181       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
182       - $ref: 'components.yml#/components/parameters/xpathInQuery'
183       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
184     requestBody:
185       required: true
186       content:
187         application/json:
188           schema:
189             type: object
190           examples:
191             dataSampleRequest:
192               $ref: 'components.yml#/components/examples/dataSampleRequest'
193     responses:
194       '200':
195         $ref: 'components.yml#/components/responses/Ok'
196       '400':
197         $ref: 'components.yml#/components/responses/BadRequest'
198       '401':
199         $ref: 'components.yml#/components/responses/Unauthorized'
200       '403':
201         $ref: 'components.yml#/components/responses/Forbidden'
202       '500':
203         $ref: 'components.yml#/components/responses/InternalServerError'
204   delete:
205     description: Delete a datanode for a given dataspace and anchor given a node xpath.
206     tags:
207       - cps-data
208     summary: Delete a data node
209     operationId: deleteDataNode
210     parameters:
211       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
212       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
213       - $ref: 'components.yml#/components/parameters/xpathInQuery'
214       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
215     responses:
216       '204':
217         $ref: 'components.yml#/components/responses/NoContent'
218       '400':
219         $ref: 'components.yml#/components/responses/BadRequest'
220       '401':
221         $ref: 'components.yml#/components/responses/Unauthorized'
222       '403':
223         $ref: 'components.yml#/components/responses/Forbidden'
224       '500':
225         $ref: 'components.yml#/components/responses/InternalServerError'
226   put:
227     description: Replace a node with descendants for a given dataspace, anchor and a parent node xpath
228     tags:
229       - cps-data
230     summary: Replace a node with descendants
231     operationId: replaceNode
232     parameters:
233       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
234       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
235       - $ref: 'components.yml#/components/parameters/xpathInQuery'
236       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
237     requestBody:
238       required: true
239       content:
240         application/json:
241           schema:
242             type: object
243           examples:
244             dataSampleRequest:
245               $ref: 'components.yml#/components/examples/dataSampleRequest'
246     responses:
247       '200':
248         $ref: 'components.yml#/components/responses/Ok'
249       '400':
250         $ref: 'components.yml#/components/responses/BadRequest'
251       '401':
252         $ref: 'components.yml#/components/responses/Unauthorized'
253       '403':
254         $ref: 'components.yml#/components/responses/Forbidden'
255       '500':
256         $ref: 'components.yml#/components/responses/InternalServerError'