0a032e4be0f441b75a54874b2f883a9ac8d5efcd
[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-2023 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 listElementByDataspaceAndAnchor:
23   post:
24     description: Add list element(s) to a list for a given anchor and dataspace
25     tags:
26       - cps-data
27     summary: Add list element(s)
28     operationId: addListElements
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/requiredXpathInQuery'
34       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
35     requestBody:
36       required: true
37       content:
38         application/json:
39           schema:
40             type: object
41           examples:
42             dataSample:
43               $ref: 'components.yml#/components/examples/dataSample'
44     responses:
45       '201':
46         $ref: 'components.yml#/components/responses/Created'
47       '400':
48         $ref: 'components.yml#/components/responses/BadRequest'
49       '401':
50         $ref: 'components.yml#/components/responses/Unauthorized'
51       '403':
52         $ref: 'components.yml#/components/responses/Forbidden'
53       '500':
54         $ref: 'components.yml#/components/responses/InternalServerError'
55   put:
56     description: Replace list content under a given parent, anchor and dataspace
57     tags:
58       - cps-data
59     summary: Replace list content
60     operationId: replaceListContent
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       '200':
78         $ref: 'components.yml#/components/responses/Ok'
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
88 nodesByDataspaceAndAnchor:
89   post:
90     description: Create a node for a given anchor and dataspace
91     tags:
92       - cps-data
93     summary: Create a node
94     operationId: createNode
95     parameters:
96       - $ref: 'components.yml#/components/parameters/apiVersionInPath'
97       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
98       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
99       - $ref: 'components.yml#/components/parameters/xpathInQuery'
100       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
101       - $ref: 'components.yml#/components/parameters/contentTypeHeader'
102     requestBody:
103       required: true
104       content:
105         application/json:
106           schema:
107             type: string
108           examples:
109             dataSample:
110               $ref: 'components.yml#/components/examples/dataSample'
111         application/xml:
112           schema:
113             type: object   # Workaround to show example
114             xml:
115               name: stores
116           examples:
117             dataSample:
118               $ref: 'components.yml#/components/examples/dataSampleXml'
119
120     responses:
121       '201':
122         $ref: 'components.yml#/components/responses/Created'
123       '400':
124         $ref: 'components.yml#/components/responses/BadRequest'
125       '401':
126         $ref: 'components.yml#/components/responses/Unauthorized'
127       '403':
128         $ref: 'components.yml#/components/responses/Forbidden'
129       '409':
130         $ref: 'components.yml#/components/responses/Conflict'
131       '500':
132         $ref: 'components.yml#/components/responses/InternalServerError'
133   patch:
134     description: Update a data node leaves for a given dataspace and anchor and a parent node xpath. This operation
135                   is currently supported for one top level data node only.
136     tags:
137       - cps-data
138     summary: Update node leaves
139     operationId: updateNodeLeaves
140     parameters:
141       - $ref: 'components.yml#/components/parameters/apiVersionInPath'
142       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
143       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
144       - $ref: 'components.yml#/components/parameters/xpathInQuery'
145       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
146     requestBody:
147       required: true
148       content:
149         application/json:
150           schema:
151             type: object
152           examples:
153             dataSample:
154               $ref: 'components.yml#/components/examples/dataSample'
155     responses:
156       '200':
157         $ref: 'components.yml#/components/responses/Ok'
158       '400':
159         $ref: 'components.yml#/components/responses/BadRequest'
160       '401':
161         $ref: 'components.yml#/components/responses/Unauthorized'
162       '403':
163         $ref: 'components.yml#/components/responses/Forbidden'
164       '500':
165         $ref: 'components.yml#/components/responses/InternalServerError'
166   delete:
167     description: Delete a datanode for a given dataspace and anchor given a node xpath.
168     tags:
169       - cps-data
170     summary: Delete a data node
171     operationId: deleteDataNode
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     responses:
179       '204':
180         $ref: 'components.yml#/components/responses/NoContent'
181       '400':
182         $ref: 'components.yml#/components/responses/BadRequest'
183       '401':
184         $ref: 'components.yml#/components/responses/Unauthorized'
185       '403':
186         $ref: 'components.yml#/components/responses/Forbidden'
187       '500':
188         $ref: 'components.yml#/components/responses/InternalServerError'
189   put:
190     description: Replace a node with descendants for a given dataspace, anchor and a parent node xpath
191     tags:
192       - cps-data
193     summary: Replace a node with descendants
194     operationId: replaceNode
195     parameters:
196       - $ref: 'components.yml#/components/parameters/apiVersionInPath'
197       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
198       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
199       - $ref: 'components.yml#/components/parameters/xpathInQuery'
200       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
201     requestBody:
202       required: true
203       content:
204         application/json:
205           schema:
206             type: object
207           examples:
208             dataSample:
209               $ref: 'components.yml#/components/examples/dataSample'
210     responses:
211       '200':
212         $ref: 'components.yml#/components/responses/Ok'
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'