...
Slogan | Notes | Decision | |
---|---|---|---|
1 | Which alternative | changed target anchor name to a query parameter Second approach | Alternative 2 of having one endpoint capable of performing 2 operations |
2 |
Introduction
Currently CPS Delta Feature provides 2 endpoints as follows:
...
Type | Format | Description |
---|---|---|
File | Yang file/Zip file | file containing the schema details. |
Text/String | Target anchor name or JSON payload as plain text |
|
Anchor | ||||
---|---|---|---|---|
|
In RESTful interface we can have same endpoint for multiple APIs, given they are performing different operations, for example POST and GET.
...
# | Existing Endpoint | Updated Endpoint | Path/Query Parameters | Response Codes | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | GET-/v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/deltaAnchorsGET-/v2/dataspaces/{dataspace-name}/anchors/{source-anchor-name}/delta | GET-/v2/dataspaces/{dataspace-name}/anchors/{source-anchor-name}/delta?target-anchor-name={target-anchor-name}&descendants={descendants}&xpath={xpath} |
|
| ||||||||||||||||||||||||
2 | POST- /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/deltaPayloadPOST- /v2/dataspaces/{dataspace-name}/anchors/{source-anchor-name}/delta | POST- /v2/dataspaces/{dataspace-name}/anchors/{source-anchor-name}/delta?xpath={xpath} Body file- yang/zip schema (Optional) json - JSON payload as String (Mandatory) |
|
...
- we have two different ways to generate delta, so we can say the final operation is common that is "delta". So, the idea is to have the common components between the operations as path parameters, i.e. dataspace name and first anchor name
- remaining components should be in query, that is target anchor name, and fetch descendants' option in first operation and JSON payload and schema in second operation.
- this approach is also consistent with existing CPS API's such as list-node APIs where a singular endpoint performs different operations while having similar parameters