Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Assuming the following data is in the database

...

Code Block
titleData Example
collapsetrue
{
  "int:interface-A": {

...


    "interface": [

...


      {

...


        "name": "Interface-A",

...


        "address": "10.10.10.200",

...


        "enabled": true,

...


        "subnet-mask": "255.255.255.0"

...


      },

...



      {

...


        "name": "Interface-B",

...


        "address": "10.10.10.200",

...


        "enabled": true,

...


        "subnet-mask": "255.255.255.0"

...


      }

...


    ]

...


  }

...


}

When performing update operation on the list data node

Code Block
titlePatch operation
collapsetrue
curl --location --request PATCH 'http://localhost:8080/cps/api/v1/dataspaces/testDataspace/anchors/sample/nodes?xpath=%2Finterface-A' --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' --header 'Cookie: JSESSIONID=node01ejoiyh1brii5zx8z9mk2r39l1.node0' \

...


--data '{

...


  "int:interface-A": {

...


    "interface": [

...


      {

...


        "name": "Interface-A",

...


        "address": "10.10.10.0",        //value to be updated

...


        "enabled": false,               //value to be updated

...


        "subnet-mask": "255.255.255.0"

...


      },              

...



      {

...


        "name": "Interface-B",

...


        "address": "1.1.1.1",          //value to be updated

...


        "enabled": false,              //value to be updated

...


        "subnet-mask": "255.255.255.0"

...


      }

...



    ]

...


  }

...


}'

Status 200 OK is returned, but on performing the Get operation it is noticed only the first item in the list node gets updated and second one remains as it is.

Code Block
titleData After Update
collapsetrue
{

...


  "int:interface-A": {

...


    "interface": [

...


      {

...


        "name": "Interface-A",

...


        "address": "10.10.10.0",        //changed value

...


        "enabled": false,                  //changed value

...


        "subnet-mask": "255.255.255.0"

...


      },              

...



      {

...


        "name": "Interface-B",

...


        "address": "10.10.10.200",       //unchanged value

...


        "enabled": true,                //unchanged value

...


        "subnet-mask": "255.255.255.0"

...


      }

...



    ]

...


  }

...


}

Impact of CPS-1526 on this issue

...

New sub endpoint: PATCH http://{IP}:{PORT}/cps/api/v1/dataspaces/{dataspace-name}/anchor/{anchor-name}/list-nodes?xpath


Parameters:
Parameter nameInisRequired
dataspace-namepathYes
anchor-namepathYes
xpathqueryYes
observed-timestampqueryYes

...