blob: b2e4e6041b5078b4c798b633539b4467ea999c76 [file] [log] [blame]
Arpit Singhc45db422024-01-30 10:51:28 +05301.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2.. http://creativecommons.org/licenses/by/4.0
3.. Copyright (C) 2021 Pantheon.tech
4.. Copyright (C) 2024 TechMahindra Ltd.
5.. _cpsDeltaEndpoints:
6
7.. toctree::
8 :maxdepth: 1
9
10CPS Delta Endpoints
11###################
12
13The CPS Delta feature provides 1 endpoint:
14
15- /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/delta
16
17Description
18-----------
19The following is a Get endpoint, which allows the user to find the delta between configurations stored under two anchors within the same dataspace.
20
21Path Parameters
22---------------
23The endpoint takes 2 path parameters as input:
24 - **dataspace-name:** name of dataspace where the 2 anchors to be used for delta generation are stored.
25 - **anchor-name:** the source anchor name, the data under this anchor will be the reference data for delta report generation
26
27Query Parameters
28----------------
29The endpoint takes 3 query parameters as input:
30 - **target-anchor-name:** the data retrieved from target anchor gets compared against the data retrieved from source anchor
31 - **xpath:** the xpath to a particular data node, Example: /bookstore/categories[@code='1']
32 - **descendants:** specifies the number of descendants to query.
33
34Sample Delta Report
35-------------------
36
37.. code-block:: json
38
39 [
40 {
41 "action": "ADD",
42 "xpath": "/bookstore/categories/[@code=3]",
43 "target-data": {
44 "code": "3,",
45 "name": "kidz"
46 }
47 },
48 {
49 "action": "REMOVE",
50 "xpath": "/bookstore/categories/[@code=1]",
51 "source-data": {
52 "code": "1,",
53 "name": "Fiction"
54 }
55 },
56 {
57 "action": "UPDATE",
58 "xpath": "/bookstore/categories/[@code=2]",
59 "source-data": {
60 "name": "Funny"
61 },
62 "target-data": {
63 "name": "Comic"
64 }
65 }
66 ]