-
Story
-
Resolution: Done
-
Medium
-
None
-
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": "Right",
"nest":
}
]
}
}
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