Merge "500 Error Reponse on NCMP inventory cmhandle search"
[cps.git] / docs / api / swagger / cps / openapi.yaml
index 80766cc..b5a5332 100644 (file)
@@ -16,6 +16,8 @@ info:
     url: cps_logo.png
 servers:
 - url: /cps/api
+security:
+- basicAuth: []
 tags:
 - name: cps-admin
   description: cps Admin
@@ -29,7 +31,6 @@ paths:
       summary: Create a dataspace
       description: Create a new dataspace
       operationId: createDataspace
-      deprecated: true
       parameters:
       - name: dataspace-name
         in: query
@@ -96,14 +97,25 @@ paths:
                 status: 500
                 message: Internal Server Error
                 details: Internal Server Error occurred
-  /v2/dataspaces:
-    post:
+      deprecated: true
+  /{apiVersion}/dataspaces:
+    delete:
       tags:
       - cps-admin
-      summary: Create a dataspace
-      description: Create a new dataspace
-      operationId: createDataspaceV2
+      summary: Delete a dataspace
+      description: Delete a dataspace
+      operationId: deleteDataspace
       parameters:
+      - name: apiVersion
+        in: path
+        description: apiVersion
+        required: true
+        schema:
+          type: string
+          default: v2
+          enum:
+          - v1
+          - v2
       - name: dataspace-name
         in: query
         description: dataspace-name
@@ -112,8 +124,9 @@ paths:
           type: string
           example: my-dataspace
       responses:
-        "201":
-          description: Created
+        "204":
+          description: No Content
+          content: {}
         "400":
           description: Bad Request
           content:
@@ -164,15 +177,14 @@ paths:
                 status: 500
                 message: Internal Server Error
                 details: Internal Server Error occurred
-  /{apiVersion}/dataspaces:
-    delete:
+  /v2/dataspaces:
+    post:
       tags:
       - cps-admin
-      summary: Delete a dataspace
-      description: Delete a dataspace
-      operationId: deleteDataspace
+      summary: Create a dataspace
+      description: Create a new dataspace
+      operationId: createDataspaceV2
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
       - name: dataspace-name
         in: query
         description: dataspace-name
@@ -181,9 +193,8 @@ paths:
           type: string
           example: my-dataspace
       responses:
-        "204":
-          description: No Content
-          content: {}
+        "201":
+          description: Created without response body
         "400":
           description: Bad Request
           content:
@@ -238,11 +249,20 @@ paths:
     get:
       tags:
       - cps-admin
-      summary: Get dataspaces
-      description: "Read all dataspaces"
+      summary: Get all dataspaces
+      description: Read all dataspaces
       operationId: getAllDataspaces
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
+      - name: apiVersion
+        in: path
+        description: apiVersion
+        required: true
+        schema:
+          type: string
+          default: v2
+          enum:
+          - v1
+          - v2
       responses:
         "200":
           description: OK
@@ -297,10 +317,19 @@ paths:
       tags:
       - cps-admin
       summary: Get a dataspace
-      description: Read an dataspace given a dataspace name
+      description: Read a dataspace given a dataspace name
       operationId: getDataspace
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
+      - name: apiVersion
+        in: path
+        description: apiVersion
+        required: true
+        schema:
+          type: string
+          default: v2
+          enum:
+          - v1
+          - v2
       - name: dataspace-name
         in: path
         description: dataspace-name
@@ -355,15 +384,14 @@ paths:
                 status: 500
                 message: Internal Server Error
                 details: Internal Server Error occurred
-  /{apiVersion}/dataspaces/{dataspace-name}/anchors:
-    get:
+  /v1/dataspaces/{dataspace-name}/anchors:
+    post:
       tags:
       - cps-admin
-      summary: Get anchors
-      description: "Read all anchors, given a dataspace"
-      operationId: getAnchors
+      summary: Create an anchor
+      description: Create a new anchor in the given dataspace
+      operationId: createAnchor
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
       - name: dataspace-name
         in: path
         description: dataspace-name
@@ -371,15 +399,28 @@ paths:
         schema:
           type: string
           example: my-dataspace
+      - name: schema-set-name
+        in: query
+        description: schema-set-name
+        required: true
+        schema:
+          type: string
+          example: my-schema-set
+      - name: anchor-name
+        in: query
+        description: anchor-name
+        required: true
+        schema:
+          type: string
+          example: my-anchor
       responses:
-        "200":
-          description: OK
+        "201":
+          description: Created
           content:
-            application/json:
+            text/plain:
               schema:
-                type: array
-                items:
-                  $ref: '#/components/schemas/AnchorDetails'
+                type: string
+                example: my-resource
         "400":
           description: Bad Request
           content:
@@ -410,6 +451,16 @@ paths:
                 status: 403
                 message: Request Forbidden
                 details: This request is forbidden
+        "409":
+          description: Conflict
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorMessage'
+              example:
+                status: 409
+                message: Conflicting request
+                details: The request cannot be processed as the resource is in use.
         "500":
           description: Internal Server Error
           content:
@@ -420,14 +471,14 @@ paths:
                 status: 500
                 message: Internal Server Error
                 details: Internal Server Error occurred
-  /v1/dataspaces/{dataspace-name}/anchors:
+      deprecated: true
+  /v2/dataspaces/{dataspace-name}/anchors:
     post:
       tags:
       - cps-admin
       summary: Create an anchor
-      deprecated: true
       description: Create a new anchor in the given dataspace
-      operationId: createAnchor
+      operationId: createAnchorV2
       parameters:
       - name: dataspace-name
         in: path
@@ -452,12 +503,7 @@ paths:
           example: my-anchor
       responses:
         "201":
-          description: Created
-          content:
-            text/plain:
-              schema:
-                type: string
-                example: my-resource
+          description: Created without response body
         "400":
           description: Bad Request
           content:
@@ -508,38 +554,40 @@ paths:
                 status: 500
                 message: Internal Server Error
                 details: Internal Server Error occurred
-  /v2/dataspaces/{dataspace-name}/anchors:
-    post:
+  /{apiVersion}/dataspaces/{dataspace-name}/anchors:
+    get:
       tags:
       - cps-admin
-      summary: Create an anchor
-      description: Create a new anchor in the given dataspace
-      operationId: createAnchorV2
+      summary: Get anchors
+      description: "Read all anchors, given a dataspace"
+      operationId: getAnchors
       parameters:
-      - name: dataspace-name
+      - name: apiVersion
         in: path
-        description: dataspace-name
-        required: true
-        schema:
-          type: string
-          example: my-dataspace
-      - name: schema-set-name
-        in: query
-        description: schema-set-name
+        description: apiVersion
         required: true
         schema:
           type: string
-          example: my-schema-set
-      - name: anchor-name
-        in: query
-        description: anchor-name
+          default: v2
+          enum:
+          - v1
+          - v2
+      - name: dataspace-name
+        in: path
+        description: dataspace-name
         required: true
         schema:
           type: string
-          example: my-anchor
+          example: my-dataspace
       responses:
-        "201":
-          description: Created
+        "200":
+          description: OK
+          content:
+            application/json:
+              schema:
+                type: array
+                items:
+                  $ref: '#/components/schemas/AnchorDetails'
         "400":
           description: Bad Request
           content:
@@ -570,16 +618,6 @@ paths:
                 status: 403
                 message: Request Forbidden
                 details: This request is forbidden
-        "409":
-          description: Conflict
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorMessage'
-              example:
-                status: 409
-                message: Conflicting request
-                details: The request cannot be processed as the resource is in use.
         "500":
           description: Internal Server Error
           content:
@@ -598,7 +636,16 @@ paths:
       description: Read an anchor given an anchor name and a dataspace
       operationId: getAnchor
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
+      - name: apiVersion
+        in: path
+        description: apiVersion
+        required: true
+        schema:
+          type: string
+          default: v2
+          enum:
+          - v1
+          - v2
       - name: dataspace-name
         in: path
         description: dataspace-name
@@ -667,7 +714,16 @@ paths:
       description: Delete an anchor given an anchor name and a dataspace
       operationId: deleteAnchor
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
+      - name: apiVersion
+        in: path
+        description: apiVersion
+        required: true
+        schema:
+          type: string
+          default: v2
+          enum:
+          - v1
+          - v2
       - name: dataspace-name
         in: path
         description: dataspace-name
@@ -812,6 +868,7 @@ paths:
                 status: 500
                 message: Internal Server Error
                 details: Internal Server Error occurred
+      deprecated: true
   /v2/dataspaces/{dataspace-name}/schema-sets:
     post:
       tags:
@@ -842,7 +899,7 @@ paths:
         required: true
       responses:
         "201":
-          description: Created
+          description: Created without response body
         "400":
           description: Bad Request
           content:
@@ -897,11 +954,20 @@ paths:
     get:
       tags:
       - cps-admin
-      summary: Get schema sets for a given dataspace
-      description: "Read schema sets for a given dataspace"
+      summary: Get schema sets
+      description: "Read all schema sets, given a dataspace"
       operationId: getSchemaSets
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
+      - name: apiVersion
+        in: path
+        description: apiVersion
+        required: true
+        schema:
+          type: string
+          default: v2
+          enum:
+          - v1
+          - v2
       - name: dataspace-name
         in: path
         description: dataspace-name
@@ -966,7 +1032,16 @@ paths:
       description: Read a schema set given a schema set name and a dataspace
       operationId: getSchemaSet
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
+      - name: apiVersion
+        in: path
+        description: apiVersion
+        required: true
+        schema:
+          type: string
+          default: v2
+          enum:
+          - v1
+          - v2
       - name: dataspace-name
         in: path
         description: dataspace-name
@@ -1035,7 +1110,16 @@ paths:
       description: Delete a schema set given a schema set name and a dataspace
       operationId: deleteSchemaSet
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
+      - name: apiVersion
+        in: path
+        description: apiVersion
+        required: true
+        schema:
+          type: string
+          default: v2
+          enum:
+          - v1
+          - v2
       - name: dataspace-name
         in: path
         description: dataspace-name
@@ -1111,7 +1195,6 @@ paths:
       summary: Get a node
       description: Get a node with an option to retrieve all the children for a given
         anchor and dataspace
-      deprecated: true
       operationId: getNodeByDataspaceAndAnchor
       parameters:
       - name: dataspace-name
@@ -1198,6 +1281,7 @@ paths:
                 status: 500
                 message: Internal Server Error
                 details: Internal Server Error occurred
+      deprecated: true
       x-codegen-request-body-name: xpath
   /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/node:
     get:
@@ -1236,13 +1320,13 @@ paths:
             value: "/shops/bookstore/categories[@code=1]"
       - name: descendants
         in: query
-        description: descendants
+        description: "Number of descendants to query. Allowed values are 'none', 'all',\
+          \ -1 (for all), 0 (for none) and any positive number."
         required: false
         schema:
           type: string
-          example: 3
+          example: "3"
           default: none
-                 pattern: '^all$|^none$|^[0-9]+$|^-1$'
       responses:
         "200":
           description: OK
@@ -1303,7 +1387,16 @@ paths:
         \ and a parent node xpath"
       operationId: replaceNode
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
+      - name: apiVersion
+        in: path
+        description: apiVersion
+        required: true
+        schema:
+          type: string
+          default: v2
+          enum:
+          - v1
+          - v2
       - name: dataspace-name
         in: path
         description: dataspace-name
@@ -1403,7 +1496,16 @@ paths:
       description: Create a node for a given anchor and dataspace
       operationId: createNode
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
+      - name: apiVersion
+        in: path
+        description: apiVersion
+        required: true
+        schema:
+          type: string
+          default: v2
+          enum:
+          - v1
+          - v2
       - name: dataspace-name
         in: path
         description: dataspace-name
@@ -1437,14 +1539,29 @@ paths:
         schema:
           type: string
           example: 2021-03-21T00:10:34.030-0100
+      - name: Content-Type
+        in: header
+        description: Content type header
+        required: true
+        schema:
+          type: string
+          example: application/json
       requestBody:
         content:
           application/json:
             schema:
-              type: object
+              type: string
             examples:
               dataSample:
                 $ref: '#/components/examples/dataSample'
+          application/xml:
+            schema:
+              type: object
+              xml:
+                name: stores
+            examples:
+              dataSample:
+                $ref: '#/components/examples/dataSampleXml'
         required: true
       responses:
         "201":
@@ -1512,7 +1629,16 @@ paths:
         xpath.
       operationId: deleteDataNode
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
+      - name: apiVersion
+        in: path
+        description: apiVersion
+        required: true
+        schema:
+          type: string
+          default: v2
+          enum:
+          - v1
+          - v2
       - name: dataspace-name
         in: path
         description: dataspace-name
@@ -1595,10 +1721,20 @@ paths:
       - cps-data
       summary: Update node leaves
       description: Update a data node leaves for a given dataspace and anchor and
-        a parent node xpath
+        a parent node xpath. This operation is currently supported for one top level
+        data node only.
       operationId: updateNodeLeaves
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
+      - name: apiVersion
+        in: path
+        description: apiVersion
+        required: true
+        schema:
+          type: string
+          default: v2
+          enum:
+          - v1
+          - v2
       - name: dataspace-name
         in: path
         description: dataspace-name
@@ -1691,6 +1827,91 @@ paths:
                 status: 500
                 message: Internal Server Error
                 details: Internal Server Error occurred
+  /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-nodes:
+    delete:
+      tags:
+      - cps-data
+      summary: Delete one or all list element(s)
+      description: Delete one or all list element(s) for a given anchor and dataspace
+      operationId: deleteListOrListElement
+      parameters:
+      - name: dataspace-name
+        in: path
+        description: dataspace-name
+        required: true
+        schema:
+          type: string
+          example: my-dataspace
+      - name: anchor-name
+        in: path
+        description: anchor-name
+        required: true
+        schema:
+          type: string
+          example: my-anchor
+      - name: xpath
+        in: query
+        description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html"
+        required: true
+        schema:
+          type: string
+        examples:
+          container xpath:
+            value: /shops/bookstore
+          list attributes xpath:
+            value: "/shops/bookstore/categories[@code=1]"
+      - name: observed-timestamp
+        in: query
+        description: observed-timestamp
+        required: false
+        schema:
+          type: string
+          example: 2021-03-21T00:10:34.030-0100
+      responses:
+        "204":
+          description: No Content
+          content: {}
+        "400":
+          description: Bad Request
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorMessage'
+              example:
+                status: 400
+                message: Bad Request
+                details: The provided request is not valid
+        "401":
+          description: Unauthorized
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorMessage'
+              example:
+                status: 401
+                message: Unauthorized request
+                details: This request is unauthorized
+        "403":
+          description: Forbidden
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorMessage'
+              example:
+                status: 403
+                message: Request Forbidden
+                details: This request is forbidden
+        "500":
+          description: Internal Server Error
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorMessage'
+              example:
+                status: 500
+                message: Internal Server Error
+                details: Internal Server Error occurred
+      deprecated: true
   /{apiVersion}/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-nodes:
     put:
       tags:
@@ -1699,7 +1920,16 @@ paths:
       description: "Replace list content under a given parent, anchor and dataspace"
       operationId: replaceListContent
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
+      - name: apiVersion
+        in: path
+        description: apiVersion
+        required: true
+        schema:
+          type: string
+          default: v2
+          enum:
+          - v1
+          - v2
       - name: dataspace-name
         in: path
         description: dataspace-name
@@ -1798,7 +2028,16 @@ paths:
       description: Add list element(s) to a list for a given anchor and dataspace
       operationId: addListElements
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
+      - name: apiVersion
+        in: path
+        description: apiVersion
+        required: true
+        schema:
+          type: string
+          default: v2
+          enum:
+          - v1
+          - v2
       - name: dataspace-name
         in: path
         description: dataspace-name
@@ -1888,14 +2127,14 @@ paths:
                 status: 500
                 message: Internal Server Error
                 details: Internal Server Error occurred
-    delete:
+  /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query:
+    get:
       tags:
-      - cps-data
-      summary: Delete one or all list element(s)
-      description: Delete one or all list element(s) for a given anchor and dataspace
-      operationId: deleteListOrListElement
+      - cps-query
+      summary: Query data nodes
+      description: Query data nodes for the given dataspace and anchor using CPS path
+      operationId: getNodesByDataspaceAndAnchorAndCpsPath
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
       - name: dataspace-name
         in: path
         description: dataspace-name
@@ -1910,28 +2149,36 @@ paths:
         schema:
           type: string
           example: my-anchor
-      - name: xpath
+      - name: cps-path
         in: query
-        description: "For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html"
-        required: true
+        description: "For more details on cps path, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html"
+        required: false
         schema:
           type: string
+          default: /
         examples:
-          container xpath:
-            value: /shops/bookstore
-          list attributes xpath:
-            value: "/shops/bookstore/categories[@code=1]"
-      - name: observed-timestamp
+          container cps path:
+            value: //bookstore
+          list attributes cps path:
+            value: "//categories[@code=1]"
+      - name: include-descendants
         in: query
-        description: observed-timestamp
+        description: include-descendants
         required: false
         schema:
-          type: string
-          example: 2021-03-21T00:10:34.030-0100
+          type: boolean
+          example: false
+          default: false
       responses:
-        "204":
-          description: No Content
-          content: {}
+        "200":
+          description: OK
+          content:
+            application/json:
+              schema:
+                type: object
+              examples:
+                dataSample:
+                  $ref: '#/components/examples/dataSample'
         "400":
           description: Bad Request
           content:
@@ -1973,15 +2220,15 @@ paths:
                 message: Internal Server Error
                 details: Internal Server Error occurred
       deprecated: true
-  /{apiVersion}/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query:
+      x-codegen-request-body-name: xpath
+  /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query:
     get:
       tags:
       - cps-query
       summary: Query data nodes
       description: Query data nodes for the given dataspace and anchor using CPS path
-      operationId: getNodesByDataspaceAndAnchorAndCpsPath
+      operationId: getNodesByDataspaceAndAnchorAndCpsPathV2
       parameters:
-      - $ref: '#/components/parameters/apiVersionInPath'
       - name: dataspace-name
         in: path
         description: dataspace-name
@@ -2008,14 +2255,15 @@ paths:
             value: //bookstore
           list attributes cps path:
             value: "//categories[@code=1]"
-      - name: include-descendants
+      - name: descendants
         in: query
-        description: include-descendants
+        description: "Number of descendants to query. Allowed values are 'none', 'all',\
+          \ -1 (for all), 0 (for none) and any positive number."
         required: false
         schema:
-          type: boolean
-          example: false
-          default: false
+          type: string
+          example: "3"
+          default: none
       responses:
         "200":
           description: OK
@@ -2067,13 +2315,14 @@ paths:
                 message: Internal Server Error
                 details: Internal Server Error occurred
       x-codegen-request-body-name: xpath
-  /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query:
+  /v2/dataspaces/{dataspace-name}/nodes/query:
     get:
       tags:
       - cps-query
       summary: Query data nodes
-      description: Query data nodes for the given dataspace and anchor using CPS path
-      operationId: getNodesByDataspaceAndAnchorAndCpsPathV2
+      description: Query data nodes for the given dataspace across anchors using CPS
+        path
+      operationId: getNodesByDataspaceAndCpsPath
       parameters:
       - name: dataspace-name
         in: path
@@ -2082,13 +2331,6 @@ paths:
         schema:
           type: string
           example: my-dataspace
-      - name: anchor-name
-        in: path
-        description: anchor-name
-        required: true
-        schema:
-          type: string
-          example: my-anchor
       - name: cps-path
         in: query
         description: "For more details on cps path, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html"
@@ -2103,14 +2345,13 @@ paths:
             value: "//categories[@code=1]"
       - name: descendants
         in: query
-        description: descendants
+        description: "Number of descendants to query. Allowed values are 'none', 'all',\
+          \ -1 (for all), 0 (for none) and any positive number."
         required: false
         schema:
           type: string
-                 pattern: '^all$|^none$|^[0-9]+$|^-1$'
-          example: false
+          example: "3"
           default: none
-                 example: 3
       responses:
         "200":
           description: OK
@@ -2120,7 +2361,7 @@ paths:
                 type: object
               examples:
                 dataSample:
-                  $ref: '#/components/examples/dataSample'
+                  $ref: '#/components/examples/dataSampleAcrossAnchors'
         "400":
           description: Bad Request
           content:
@@ -2163,20 +2404,6 @@ paths:
                 details: Internal Server Error occurred
       x-codegen-request-body-name: xpath
 components:
-  parameters:
-    apiVersionInPath:
-      name: apiVersion
-      in: path
-      description: apiVersion
-      required: true
-      schema:
-        type: string
-        enum: [v1, v2]
-        default: v2
-  securitySchemes:
-    basicAuth:
-      type: http
-      scheme: basic
   schemas:
     ErrorMessage:
       title: Error
@@ -2188,6 +2415,13 @@ components:
           type: string
         details:
           type: string
+    DataspaceDetails:
+      title: Dataspace details by dataspace Name
+      type: object
+      properties:
+        name:
+          type: string
+          example: my-dataspace
     AnchorDetails:
       title: Anchor details by anchor Name
       type: object
@@ -2201,13 +2435,6 @@ components:
         schemaSetName:
           type: string
           example: my-schema-set
-    DataspaceDetails:
-      title: Dataspace details by dataspace Name
-      type: object
-      properties:
-        name:
-          type: string
-          example: my-dataspace
     MultipartFile:
       required:
       - file
@@ -2256,6 +2483,31 @@ components:
             name: SciFi
           - code: 2
             name: kids
-
-security:
-  - basicAuth: []
+    dataSampleXml:
+      value: <stores xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <bookstore xmlns="org:onap:ccsdk:sample">
+        <bookstore-name>Chapters</bookstore-name> <categories> <code>1</code> <name>SciFi</name>
+        </categories> </bookstore> </stores>
+    dataSampleAcrossAnchors:
+      value:
+      - anchorName: bookstore1
+        dataNode:
+          test:bookstore:
+            bookstore-name: Chapters
+            categories:
+            - code: 1
+              name: SciFi
+            - code: 2
+              name: kids
+      - anchorName: bookstore2
+        dataNode:
+          test:bookstore:
+            bookstore-name: Chapters
+            categories:
+            - code: 1
+              name: SciFi
+            - code: 2
+              name: kids
+  securitySchemes:
+    basicAuth:
+      type: http
+      scheme: basic