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