...
Currently after multiple data trees are stored in CPS DB. On performing the GET operation on the same data, with xpath set as root "/", the first data tree is returned by the Get Data Node API. This data tree is returned in form of a JSON Object as follows:
- CURL Request to get all data nodes under an anchor:
Code Block |
---|
curl --location 'http://localhost:8080/cps/api/v1/dataspaces/testDataspace/anchors/sample/node?xpath=%2F' \
--header 'Accept: application/json' \
--header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' |
...
Code Block |
---|
title | Current JSON response body |
---|
collapse | true |
---|
|
{
"multiple-data-tree:first-container": {
"a-leaf": "a-Value"
}
} |
- CURL Request to get individual data tree(with xPath= /first-container) under an anchor:
Code Block |
---|
curl --location 'http://localhost:8080/cps/api/v1/dataspaces/testDataspace/anchors/multipleDataTree/node?xpath=%2Ffirst-container' \
--header 'Accept: application/json' \
--header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' |
...
Code Block |
---|
title | Current JSON response body |
---|
collapse | true |
---|
|
{
"multiple-data-tree:first-container": {
"a-leaf": "a-Value"
}
} |
- CURL Request to get individual data tree(with xPath= /last-container) under an anchor:
Code Block |
---|
curl --location 'http://localhost:8080/cps/api/v1/dataspaces/testDataspace/anchors/sample/node?xpath=%2Flast-container' \
--header 'Accept: application/json' \
--header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' |
...
Data returned as a
JSON array, with the array containing individual data trees (This approach was finalized to be implemented in V2 of get API) Code Block |
---|
title | Get all the data trees in a JSON Array |
---|
collapse | true |
---|
|
//JSON Array
[
{
"multiple-data-tree:first-container": { //Data Tree 1
"a-leaf": "a-Value"
}
},
{
"multiple-data-tree:last-container": { //Data Tree 2
"x-leaf": "x-value"
}
}
] |
Data Returned as a JSON object, with all data trees in a single object
Code Block |
---|
title | Get all the data trees as JSON Objects |
---|
collapse | true |
---|
|
{
"multiple-data-tree:first-container": {
"a-leaf": "a-Value"
},
"multiple-data-tree:last-container": {
"x-leaf": "x-value"
}
} |
Impact on CPS-NCMP_DMI plugin
The CPS NCMP DMI plugin internally calls the getDataNode method in order to fetch the configuration data for NCMP-DMI plugin, As of now it expects only a single DataNode to be returned by the getDataNode method and with the updated GET API we are now getting a collection of one or more data nodes from the getDtaNode method.
A couple of things to be checked here are:
- Will there be any Impact of multiple data nodes on the functionality of NCMP plugin
- Appropriate approach to bring in support for multiple data nodes into NCMP