aboutsummaryrefslogtreecommitdiffstats
path: root/docs/cps-delta-endpoints.rst
blob: b2e4e6041b5078b4c798b633539b4467ea999c76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
.. Copyright (C) 2021 Pantheon.tech
.. Copyright (C) 2024 TechMahindra Ltd.
.. _cpsDeltaEndpoints:

.. toctree::
   :maxdepth: 1

CPS Delta Endpoints
###################

The CPS Delta feature provides 1 endpoint:

- /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/delta

Description
-----------
The following is a Get endpoint, which allows the user to find the delta between configurations stored under two anchors within the same dataspace.

Path Parameters
---------------
The endpoint takes 2 path parameters as input:
    - **dataspace-name:** name of dataspace where the 2 anchors to be used for delta generation are stored.
    - **anchor-name:** the source anchor name, the data under this anchor will be the reference data for delta report generation

Query Parameters
----------------
The endpoint takes 3 query parameters as input:
    - **target-anchor-name:** the data retrieved from target anchor gets compared against the data retrieved from source anchor
    - **xpath:** the xpath to a particular data node, Example: /bookstore/categories[@code='1']
    - **descendants:** specifies the number of descendants to query.

Sample Delta Report
-------------------

.. code-block:: json

    [
      {
        "action": "ADD",
        "xpath": "/bookstore/categories/[@code=3]",
        "target-data": {
          "code": "3,",
          "name": "kidz"
        }
      },
      {
        "action": "REMOVE",
        "xpath": "/bookstore/categories/[@code=1]",
        "source-data": {
          "code": "1,",
          "name": "Fiction"
        }
      },
      {
        "action": "UPDATE",
        "xpath": "/bookstore/categories/[@code=2]",
        "source-data": {
          "name": "Funny"
        },
        "target-data": {
          "name": "Comic"
        }
      }
    ]