Uploaded image for project: 'Configuration Persistence Service'
  1. Configuration Persistence Service
  2. CPS-510

CPS TBDMT - Support for Multiple xpath queries in single api query

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Done
    • Icon: Medium Medium
    • Istanbul Release
    • None
    • CPS-TBDMT
    • None

      Transform result to make multiple xpath queries(https://wiki.onap.org/display/DW/CPS-TBDMT+Templates+for+CPS+APIs)

      Example result with no transformation:

      {
      "test-tree": {
      "branch": [
      {
      "name": "Left",
      "nest":

      { "name": "Small", "birds": [ "Sparrow", "Robin", "Finch" ] }

      },
      {
      "name": "Right",
      "nest":

      { "name": "Big", "birds": [ "Owl", "Raven", "Crow" ] }

      }
      ]
      }
      }

       

      Request to create Template(using transformation):

      curl --location --request POST 'http://localhost:8080/templates' --header 'Content-Type: application/json' --data-raw '

      { "templateId": "get-all-data", "model": "CSIT-SchemaSet", "requestType": "get", "xpathTemplate": "/test-tree", "includeDescendants": true, "transformParam":"branch,name" }

      ' -i

      The expected transformed result after executing template:

      ["Left","Right"]

       

      Use the above transformed result to do a multiple query.

      (Branch name obtained from above result to be filled in the below template)

      curl --location --request POST 'http://localhost:8080/templates' --header 'Content-Type: application/json' --data-raw '{
      "templateId": "get-branch",
      "model": "CSIT-SchemaSet",
      "requestType": "get",
      "xpathTemplate": "/test-tree/branch[@name='\''\{{name}}'\'']/nest",
      "includeDescendants": true,
      "multipleQueryTemplateId":"get-all-data",
      "transformParam":"birds"
      }' -i

       

       

       

       

            niranjana niranjana
            krishnaa96 krishnaa96
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: