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