me='generator' content='cgit 1.2.3-korg'/>
summaryrefslogtreecommitdiffstats
path: root/docs/cps-delta-endpoints.rst
blob: ecb7550f443a8a89d417d98c9385ff64e81b7283 (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": "create",
        "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": "replace",
        "xpath": "/bookstore/categories/[@code=2]",
        "source-data": {
          "name": "Funny"
        },
        "target-data": {
          "name": "Comic"
        }
      }
    ]