f827e45855535a45547e54b86c49c3b90154a3fc
[cps.git] / docs / api / swagger / openapi.yml
1 openapi: 3.0.1
2 info:
3   title: ONAP Open API v3 Configuration Persistence Service
4   description: Configuration Persistence Service is a Model Driven Generic Database
5   version: 1.0.0
6   contact:
7     name: ONAP
8     url: 'https://onap.readthedocs.io'
9     email: onap-discuss@lists.onap.org
10   license:
11     name: Apache 2.0
12     url: 'http://www.apache.org/licenses/LICENSE-2.0'
13   x-planned-retirement-date: '202212'
14   x-component: Modeling
15   x-logo:
16     url: cps_logo.png
17 servers:
18   - url: '//localhost:8088'
19 tags:
20   - name: cps-admin
21     description: cps Admin
22   - name: cps-data
23     description: cps Data
24 paths:
25   /v1/dataspaces:
26     post:
27       description: Create a new dataspace
28       tags:
29         - cps-admin
30       summary: Create a dataspace
31       operationId: createDataspace
32       parameters:
33         - name: dataspace-name
34           in: query
35           description: dataspace-name
36           required: true
37           schema:
38             type: string
39       responses:
40         '201':
41           description: Created
42           content:
43             text/plain:
44               schema:
45                 type: string
46         '400':
47           description: Bad Request
48           content:
49             application/json:
50               schema:
51                 $ref: '#/components/schemas/ErrorMessage'
52         '401':
53           description: Unauthorized
54           content:
55             application/json:
56               schema:
57                 $ref: '#/components/schemas/ErrorMessage'
58         '403':
59           description: Forbidden
60           content:
61             application/json:
62               schema:
63                 $ref: '#/components/schemas/ErrorMessage'
64   '/v1/dataspaces/{dataspace-name}':
65     delete:
66       description: Delete the given dataspace - DRAFT
67       tags:
68         - cps-admin
69       summary: Delete a dataspace
70       operationId: deleteDataspace
71       parameters:
72         - name: dataspace-name
73           in: path
74           description: dataspace-name
75           required: true
76           schema:
77             type: string
78       responses:
79         '200':
80           description: OK
81           content:
82             application/json:
83               schema:
84                 type: object
85         '204':
86           description: No Content
87           content: {}
88         '400':
89           description: Bad Request
90           content:
91             application/json:
92               schema:
93                 $ref: '#/components/schemas/ErrorMessage'
94         '401':
95           description: Unauthorized
96           content:
97             application/json:
98               schema:
99                 $ref: '#/components/schemas/ErrorMessage'
100         '403':
101           description: Forbidden
102           content:
103             application/json:
104               schema:
105                 $ref: '#/components/schemas/ErrorMessage'
106   '/v1/dataspaces/{dataspace-name}/anchors':
107     get:
108       description: 'Read all anchors, given a dataspace'
109       tags:
110         - cps-admin
111       summary: Get anchors
112       operationId: getAnchors
113       parameters:
114         - name: dataspace-name
115           in: path
116           description: dataspace-name
117           required: true
118           schema:
119             type: string
120       responses:
121         '200':
122           description: OK
123           content:
124             application/json:
125               schema:
126                 type: object
127         '400':
128           description: Bad Request
129           content:
130             application/json:
131               schema:
132                 $ref: '#/components/schemas/ErrorMessage'
133         '401':
134           description: Unauthorized
135           content:
136             application/json:
137               schema:
138                 $ref: '#/components/schemas/ErrorMessage'
139         '403':
140           description: Forbidden
141           content:
142             application/json:
143               schema:
144                 $ref: '#/components/schemas/ErrorMessage'
145         '404':
146           description: The specified resource was not found
147           content:
148             application/json:
149               schema:
150                 $ref: '#/components/schemas/ErrorMessage'
151     post:
152       description: Create a new anchor in the given dataspace
153       tags:
154         - cps-admin
155       summary: Create an anchor
156       operationId: createAnchor
157       parameters:
158         - name: dataspace-name
159           in: path
160           description: dataspace-name
161           required: true
162           schema:
163             type: string
164         - name: schema-set-name
165           in: query
166           description: schema-set-name
167           required: true
168           schema:
169             type: string
170         - name: anchor-name
171           in: query
172           description: anchor-name
173           required: true
174           schema:
175             type: string
176       responses:
177         '201':
178           description: Created
179           content:
180             text/plain:
181               schema:
182                 type: string
183         '400':
184           description: Bad Request
185           content:
186             application/json:
187               schema:
188                 $ref: '#/components/schemas/ErrorMessage'
189         '401':
190           description: Unauthorized
191           content:
192             application/json:
193               schema:
194                 $ref: '#/components/schemas/ErrorMessage'
195         '403':
196           description: Forbidden
197           content:
198             application/json:
199               schema:
200                 $ref: '#/components/schemas/ErrorMessage'
201   '/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}':
202     get:
203       description: Read an anchor given an anchor name and a dataspace
204       tags:
205         - cps-admin
206       summary: Get an anchor
207       operationId: getAnchor
208       parameters:
209         - name: dataspace-name
210           in: path
211           description: dataspace-name
212           required: true
213           schema:
214             type: string
215         - name: anchor-name
216           in: path
217           description: anchor-name
218           required: true
219           schema:
220             type: string
221       responses:
222         '200':
223           description: OK
224           content:
225             application/json:
226               schema:
227                 type: object
228         '400':
229           description: Bad Request
230           content:
231             application/json:
232               schema:
233                 $ref: '#/components/schemas/ErrorMessage'
234         '401':
235           description: Unauthorized
236           content:
237             application/json:
238               schema:
239                 $ref: '#/components/schemas/ErrorMessage'
240         '403':
241           description: Forbidden
242           content:
243             application/json:
244               schema:
245                 $ref: '#/components/schemas/ErrorMessage'
246         '404':
247           description: The specified resource was not found
248           content:
249             application/json:
250               schema:
251                 $ref: '#/components/schemas/ErrorMessage'
252     delete:
253       description: Delete an anchor given an anchor name and a dataspace - DRAFT
254       tags:
255         - cps-admin
256       summary: Delete an anchor
257       operationId: deleteAnchor
258       parameters:
259         - name: dataspace-name
260           in: path
261           description: dataspace-name
262           required: true
263           schema:
264             type: string
265         - name: anchor-name
266           in: path
267           description: anchor-name
268           required: true
269           schema:
270             type: string
271       responses:
272         '200':
273           description: OK
274           content:
275             application/json:
276               schema:
277                 type: object
278         '204':
279           description: No Content
280           content: {}
281         '400':
282           description: Bad Request
283           content:
284             application/json:
285               schema:
286                 $ref: '#/components/schemas/ErrorMessage'
287         '401':
288           description: Unauthorized
289           content:
290             application/json:
291               schema:
292                 $ref: '#/components/schemas/ErrorMessage'
293         '403':
294           description: Forbidden
295           content:
296             application/json:
297               schema:
298                 $ref: '#/components/schemas/ErrorMessage'
299   '/v1/dataspaces/{dataspace-name}/schema-sets':
300     post:
301       description: Create a new schema set in the given dataspace
302       tags:
303         - cps-admin
304       summary: Create a schema set
305       operationId: createSchemaSet
306       parameters:
307         - name: dataspace-name
308           in: path
309           description: dataspace-name
310           required: true
311           schema:
312             type: string
313         - name: schema-set-name
314           in: query
315           description: schema-set-name
316           required: true
317           schema:
318             type: string
319       requestBody:
320         required: true
321         content:
322           multipart/form-data:
323             schema:
324               required:
325                 - file
326               properties:
327                 multipartFile:
328                   type: string
329                   description: multipartFile
330                   format: binary
331                   example: 'http://example.com/examples/example.yang'
332       responses:
333         '201':
334           description: Created
335           content:
336             text/plain:
337               schema:
338                 type: string
339         '400':
340           description: Bad Request
341           content:
342             application/json:
343               schema:
344                 $ref: '#/components/schemas/ErrorMessage'
345         '401':
346           description: Unauthorized
347           content:
348             application/json:
349               schema:
350                 $ref: '#/components/schemas/ErrorMessage'
351         '403':
352           description: Forbidden
353           content:
354             application/json:
355               schema:
356                 $ref: '#/components/schemas/ErrorMessage'
357   '/v1/dataspaces/{dataspace-name}/schema-sets/{schema-set-name}':
358     get:
359       description: Read a schema set given a schema set name and a dataspace
360       tags:
361         - cps-admin
362       summary: Get a schema set
363       operationId: getSchemaSet
364       parameters:
365         - name: dataspace-name
366           in: path
367           description: dataspace-name
368           required: true
369           schema:
370             type: string
371         - name: schema-set-name
372           in: path
373           description: schema-set-name
374           required: true
375           schema:
376             type: string
377       responses:
378         '200':
379           description: OK
380           content:
381             application/json:
382               schema:
383                 type: object
384         '400':
385           description: Bad Request
386           content:
387             application/json:
388               schema:
389                 $ref: '#/components/schemas/ErrorMessage'
390         '401':
391           description: Unauthorized
392           content:
393             application/json:
394               schema:
395                 $ref: '#/components/schemas/ErrorMessage'
396         '403':
397           description: Forbidden
398           content:
399             application/json:
400               schema:
401                 $ref: '#/components/schemas/ErrorMessage'
402         '404':
403           description: The specified resource was not found
404           content:
405             application/json:
406               schema:
407                 $ref: '#/components/schemas/ErrorMessage'
408     delete:
409       description: Delete a schema set given a schema set name and a dataspace
410       tags:
411         - cps-admin
412       summary: Delete a schema set
413       operationId: deleteSchemaSet
414       parameters:
415         - name: dataspace-name
416           in: path
417           description: dataspace-name
418           required: true
419           schema:
420             type: string
421         - name: schema-set-name
422           in: path
423           description: schema-set-name
424           required: true
425           schema:
426             type: string
427       responses:
428         '204':
429           description: No Content
430           content: {}
431         '400':
432           description: Bad Request
433           content:
434             application/json:
435               schema:
436                 $ref: '#/components/schemas/ErrorMessage'
437         '401':
438           description: Unauthorized
439           content:
440             application/json:
441               schema:
442                 $ref: '#/components/schemas/ErrorMessage'
443         '403':
444           description: Forbidden
445           content:
446             application/json:
447               schema:
448                 $ref: '#/components/schemas/ErrorMessage'
449         '409':
450           description: Conflict
451           content:
452             application/json:
453               schema:
454                 $ref: '#/components/schemas/ErrorMessage'
455   '/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/node':
456     get:
457       description: >-
458         Get a node with an option to retrieve all the children for a given
459         anchor and dataspace
460       tags:
461         - cps-data
462       summary: Get a node
463       operationId: getNodeByDataspaceAndAnchor
464       parameters:
465         - name: dataspace-name
466           in: path
467           description: dataspace-name
468           required: true
469           schema:
470             type: string
471         - name: anchor-name
472           in: path
473           description: anchor-name
474           required: true
475           schema:
476             type: string
477         - name: xpath
478           in: query
479           description: xpath
480           required: false
481           schema:
482             type: string
483             default: /
484         - name: include-descendants
485           in: query
486           description: include-descendants
487           required: false
488           schema:
489             type: boolean
490             default: false
491       responses:
492         '200':
493           description: OK
494           content:
495             application/json:
496               schema:
497                 type: object
498         '400':
499           description: Bad Request
500           content:
501             application/json:
502               schema:
503                 $ref: '#/components/schemas/ErrorMessage'
504         '401':
505           description: Unauthorized
506           content:
507             application/json:
508               schema:
509                 $ref: '#/components/schemas/ErrorMessage'
510         '403':
511           description: Forbidden
512           content:
513             application/json:
514               schema:
515                 $ref: '#/components/schemas/ErrorMessage'
516         '404':
517           description: The specified resource was not found
518           content:
519             application/json:
520               schema:
521                 $ref: '#/components/schemas/ErrorMessage'
522       x-codegen-request-body-name: xpath
523   '/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes':
524     post:
525       description: Create a node for a given anchor and dataspace
526       tags:
527         - cps-data
528       summary: Create a node
529       operationId: createNode
530       parameters:
531         - name: dataspace-name
532           in: path
533           description: dataspace-name
534           required: true
535           schema:
536             type: string
537         - name: anchor-name
538           in: path
539           description: anchor-name
540           required: true
541           schema:
542             type: string
543       requestBody:
544         required: true
545         content:
546           application/json:
547             schema:
548               type: string
549       responses:
550         '201':
551           description: Created
552           content:
553             text/plain:
554               schema:
555                 type: string
556         '400':
557           description: Bad Request
558           content:
559             application/json:
560               schema:
561                 $ref: '#/components/schemas/ErrorMessage'
562         '401':
563           description: Unauthorized
564           content:
565             application/json:
566               schema:
567                 $ref: '#/components/schemas/ErrorMessage'
568         '403':
569           description: Forbidden
570           content:
571             application/json:
572               schema:
573                 $ref: '#/components/schemas/ErrorMessage'
574     patch:
575       description: >-
576         Update a data node leaves for a given dataspace and anchor and a parent
577         node xpath
578       tags:
579         - cps-data
580       summary: Update node leaves
581       operationId: updateNodeLeaves
582       parameters:
583         - name: dataspace-name
584           in: path
585           description: dataspace-name
586           required: true
587           schema:
588             type: string
589         - name: anchor-name
590           in: path
591           description: anchor-name
592           required: true
593           schema:
594             type: string
595         - name: xpath
596           in: query
597           description: xpath
598           required: false
599           schema:
600             type: string
601             default: /
602       requestBody:
603         required: true
604         content:
605           application/json:
606             schema:
607               type: string
608       responses:
609         '200':
610           description: OK
611           content:
612             application/json:
613               schema:
614                 type: object
615         '400':
616           description: Bad Request
617           content:
618             application/json:
619               schema:
620                 $ref: '#/components/schemas/ErrorMessage'
621         '401':
622           description: Unauthorized
623           content:
624             application/json:
625               schema:
626                 $ref: '#/components/schemas/ErrorMessage'
627         '403':
628           description: Forbidden
629           content:
630             application/json:
631               schema:
632                 $ref: '#/components/schemas/ErrorMessage'
633     put:
634       description: >-
635         Replace a node with descendants for a given dataspace, anchor and a
636         parent node xpath
637       tags:
638         - cps-data
639       summary: Replace a node with descendants
640       operationId: replaceNode
641       parameters:
642         - name: dataspace-name
643           in: path
644           description: dataspace-name
645           required: true
646           schema:
647             type: string
648         - name: anchor-name
649           in: path
650           description: anchor-name
651           required: true
652           schema:
653             type: string
654         - name: xpath
655           in: query
656           description: xpath
657           required: false
658           schema:
659             type: string
660             default: /
661       requestBody:
662         required: true
663         content:
664           application/json:
665             schema:
666               type: string
667       responses:
668         '200':
669           description: OK
670           content:
671             application/json:
672               schema:
673                 type: object
674         '400':
675           description: Bad Request
676           content:
677             application/json:
678               schema:
679                 $ref: '#/components/schemas/ErrorMessage'
680         '401':
681           description: Unauthorized
682           content:
683             application/json:
684               schema:
685                 $ref: '#/components/schemas/ErrorMessage'
686         '403':
687           description: Forbidden
688           content:
689             application/json:
690               schema:
691                 $ref: '#/components/schemas/ErrorMessage'
692   '/v1/dataspaces/{dataspace-name}/nodes':
693     get:
694       description: >-
695         Get all nodes for a given dataspace using an xpath or schema node
696         identifier - DRAFT
697       tags:
698         - cps-data
699       summary: Get nodes
700       operationId: getNodesByDataspace
701       parameters:
702         - name: dataspace-name
703           in: path
704           description: dataspace-name
705           required: true
706           schema:
707             type: string
708       responses:
709         '200':
710           description: OK
711           content:
712             application/json:
713               schema:
714                 type: object
715         '400':
716           description: Bad Request
717           content:
718             application/json:
719               schema:
720                 $ref: '#/components/schemas/ErrorMessage'
721         '401':
722           description: Unauthorized
723           content:
724             application/json:
725               schema:
726                 $ref: '#/components/schemas/ErrorMessage'
727         '403':
728           description: Forbidden
729           content:
730             application/json:
731               schema:
732                 $ref: '#/components/schemas/ErrorMessage'
733         '404':
734           description: The specified resource was not found
735           content:
736             application/json:
737               schema:
738                 $ref: '#/components/schemas/ErrorMessage'
739       x-codegen-request-body-name: requestBody
740   '/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query':
741     get:
742       description: Query data nodes for the given dataspace and anchor using CPS path
743       tags:
744         - cps-query
745       summary: Query data nodes
746       operationId: getNodesByDataspaceAndAnchorAndCpsPath
747       parameters:
748         - name: dataspace-name
749           in: path
750           description: dataspace-name
751           required: true
752           schema:
753             type: string
754         - name: anchor-name
755           in: path
756           description: anchor-name
757           required: true
758           schema:
759             type: string
760         - name: cps-path
761           in: query
762           description: cps-path
763           required: false
764           schema:
765             type: string
766             default: /
767       responses:
768         '200':
769           description: OK
770           content:
771             application/json:
772               schema:
773                 type: object
774         '400':
775           description: Bad Request
776           content:
777             application/json:
778               schema:
779                 $ref: '#/components/schemas/ErrorMessage'
780         '401':
781           description: Unauthorized
782           content:
783             application/json:
784               schema:
785                 $ref: '#/components/schemas/ErrorMessage'
786         '403':
787           description: Forbidden
788           content:
789             application/json:
790               schema:
791                 $ref: '#/components/schemas/ErrorMessage'
792         '404':
793           description: The specified resource was not found
794           content:
795             application/json:
796               schema:
797                 $ref: '#/components/schemas/ErrorMessage'
798       x-codegen-request-body-name: xpath
799 components:
800   schemas:
801     ErrorMessage:
802       type: object
803       title: Error
804       properties:
805         status:
806           type: string
807           example: 400
808         message:
809           type: string
810           example: Dataspace not found
811         details:
812           type: string
813           example: Dataspace with name D1 does not exist.