Versions Compared

Key

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

...

So, if there is a list data node with multiple list items, and the user tries to update multiple list items at once as in the example above, the system now returns a 400 Bad Request, with the error message that the operation is unsupported because the user is basically updating multiple data nodes under a list, earlier this response was a 200 OK with a partial Patch operation taking place in the background.

Assuming the following data is in the DB

Code Block
titleData Example
collapsetrue
[
    {
        "int:interface-A": {
            "interface": [
                {
                    "name": "Interface-A-2",
                    "address": "1.1.1.70",
                    "enabled": false,
                    "subnet-mask": "0.0.0.0"
                },
                {
                    "name": "Interface-A",
                    "address": "10.10.10.18",
                    "enabled": false,
                    "subnet-mask": "255.255.0.0"
                }
            ]
        }
    }
]

Updating multiple items in a list data node

Code Block
titlePatch Operation
collapsetrue
curl --location --request PATCH 'http://localhost:8080/cps/api/v1/dataspaces/testDataspace/anchors/MultipleDataTree/nodes?xpath=%2Finterface-A&observed-timestamp=2021-03-21T00%3A10%3A34.030-0100' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' \
--header 'Cookie: JSESSIONID=node01oja2kuolgg6dtfvnzzqf4bwk0.node0' \
--data '{
        
            "interface": [
                
                {
                    "name": "Interface-A-2",
                    "address": "1.1.1.1",		//value to be updated
                    "enabled": true,			//value to be updated
                    "subnet-mask": "0.0.0.0"
                },
                {
                    "name": "Interface-A",
                    "address": "10.10.10.10",	//value to be updated
                    "enabled": true,			//value to be updated
                    "subnet-mask": "0.0.0.0"
                }
            ]
        
    }'

Response received after CPS 1526

...