blob: ecb7550f443a8a89d417d98c9385ff64e81b7283 [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 {
Arpit Singh3c8539c2024-09-04 11:02:06 +053041 "action": "create",
Arpit Singhc45db422024-01-30 10:51:28 +053042 "xpath": "/bookstore/categories/[@code=3]",
43 "target-data": {
44 "code": "3,",
45 "name": "kidz"
46 }
47 },
48 {
Arpit Singh3c8539c2024-09-04 11:02:06 +053049 "action": "remove",
Arpit Singhc45db422024-01-30 10:51:28 +053050 "xpath": "/bookstore/categories/[@code=1]",
51 "source-data": {
52 "code": "1,",
53 "name": "Fiction"
54 }
55 },
56 {
Arpit Singh3c8539c2024-09-04 11:02:06 +053057 "action": "replace",
Arpit Singhc45db422024-01-30 10:51:28 +053058 "xpath": "/bookstore/categories/[@code=2]",
59 "source-data": {
60 "name": "Funny"
61 },
62 "target-data": {
63 "name": "Comic"
64 }
65 }
66 ]