Table of Contents |
---|
Overview
The second API proposed under the Delta feature is to generate a delta between configuration stored under an Anchor and JSON payload provided by the user. All the responses and exceptions thrown by this API will be similar to the API to generate delta between 2 anchors to maintain consistency between the API's.
Issues & Decisions
Questions/Issues | Decisions/Answers |
---|---|
HTTP response codes for Delta between Anchor and Payload API
Proposed API
The proposed API will be part of the CPS Data Interface. This API takes multipart form data as request body, using this the user can provide the JSON payload and its corresponding Schema Context in form of a Yang or ZIP file. This file will only be used to generate the data nodes from the JSON payload and will not be persisted in CPS DB. The following response codes will be returned by the API:
# | Sub Interface | Method | Scenario | HTTP Response codes to be implemented | Notes |
---|---|---|---|---|---|
1 | Data | Proposed API: POST- /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/deltaByPayload?xpath={xpath} Proposed method name: CpsDataApi.getDeltaByDataspaceAnchorAndPayload()
| Generate a delta report between an anchor and JSON payload |
|
Request parameters:
Parameter name | In | Required | Description |
---|---|---|---|
dataspace-name | Path | Yes | Dataspace name |
anchor | Path | Yes | Anchor Name/Reference Anchor |
xpath | Query | Yes | xpath of the node |
descendants | Query | No | Level of descendants for delta comparison. Set to INCLUDE_ALL_DESCENDANTS by default. |
Request body:
Content-Type: multipart/form-data
...
Code Block | ||||
---|---|---|---|---|
| ||||
[ { "action": "ADD", "xpath": "/bookstore/categories/[@code=3]", "target-data": { "code": 3, "name": "kidz" } }, { "action": "DELETE", "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" } } ] |
Functional Details about the API
The proposed API will be used to generate a delta between data fetched from an anchor against JSON payload provided by the user. The following are some key functional details about the API:
...