Arpit Singh | c45db42 | 2024-01-30 10:51:28 +0530 | [diff] [blame] | 1 | .. 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 | |
| 10 | CPS Delta Endpoints |
| 11 | ################### |
| 12 | |
| 13 | The CPS Delta feature provides 1 endpoint: |
| 14 | |
| 15 | - /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/delta |
| 16 | |
| 17 | Description |
| 18 | ----------- |
| 19 | The following is a Get endpoint, which allows the user to find the delta between configurations stored under two anchors within the same dataspace. |
| 20 | |
| 21 | Path Parameters |
| 22 | --------------- |
| 23 | The 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 | |
| 27 | Query Parameters |
| 28 | ---------------- |
| 29 | The 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 | |
| 34 | Sample Delta Report |
| 35 | ------------------- |
| 36 | |
| 37 | .. code-block:: json |
| 38 | |
| 39 | [ |
| 40 | { |
Arpit Singh | 3c8539c | 2024-09-04 11:02:06 +0530 | [diff] [blame] | 41 | "action": "create", |
Arpit Singh | c45db42 | 2024-01-30 10:51:28 +0530 | [diff] [blame] | 42 | "xpath": "/bookstore/categories/[@code=3]", |
| 43 | "target-data": { |
| 44 | "code": "3,", |
| 45 | "name": "kidz" |
| 46 | } |
| 47 | }, |
| 48 | { |
Arpit Singh | 3c8539c | 2024-09-04 11:02:06 +0530 | [diff] [blame] | 49 | "action": "remove", |
Arpit Singh | c45db42 | 2024-01-30 10:51:28 +0530 | [diff] [blame] | 50 | "xpath": "/bookstore/categories/[@code=1]", |
| 51 | "source-data": { |
| 52 | "code": "1,", |
| 53 | "name": "Fiction" |
| 54 | } |
| 55 | }, |
| 56 | { |
Arpit Singh | 3c8539c | 2024-09-04 11:02:06 +0530 | [diff] [blame] | 57 | "action": "replace", |
Arpit Singh | c45db42 | 2024-01-30 10:51:28 +0530 | [diff] [blame] | 58 | "xpath": "/bookstore/categories/[@code=2]", |
| 59 | "source-data": { |
| 60 | "name": "Funny" |
| 61 | }, |
| 62 | "target-data": { |
| 63 | "name": "Comic" |
| 64 | } |
| 65 | } |
| 66 | ] |