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