Currently CPS Delta Feature provides 2 endpoints as follows:

  • GET-/v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/delta?anchor2={anchor-name}?xpath={xpath}&descendants={descendants}
  • POST- /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/deltaByPayload?xpath={xpath}

Objective

The objective of this proposal is to have a new singular delta endpoint which can provide the functionality of the above-mentioned endpoints. This new endpoint will be a POST operation and will accept the source anchor name as the path parameter, xpath as the query parameter and a request body which will serve 2 functions:

  • first it can be used to provide the target anchor name as a replacement for query parameter of first API
  • second it can be used to provide the JSON payload as defined in proposal of 2nd API

After determining whether an anchor name or JSON payload is provided in the request the respective underlying controller will be called. So only the endpoints will be merged to a singular endpoint, and the underlying logic will remain same.

New Endpoint

#Sub interfaceMethodScenarioHTTP response codeNotes
1Data
  • POST- /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/delta?xpath={xpath}
Generate a delta report between a source anchor and target anchor or JSON payload
  • 200 (OK)
    • success
  • 400
    • dataspace not found
      DataspaceNotFoundException
    • anchor not found
      AnchorNotFoundException
    • Data node not found
      DataNodeNotFoundException
    • invalid xpath
      CpsPathException
  • 500
    • unexpected error

Request parameters:

Parameter name

In

Required

Description

dataspace-namePathYesDataspace name
anchorPathYesSource Anchor Name
xpathQueryYesxpath of the node
descendantsQueryNoLevel of descendants for delta comparison. Set to INCLUDE_ALL_DESCENDANTS by default.

Request body:

Content-Type: multipart/form-data

Type

Format

Description

FileYang file/Zip filefile containing the schema details.
Text/StringTarget anchor name or JSON payload as plain text
  • Case 1: target anchor name to fetch the data stored under the specified anchor, which is then compared to source anchor
  • Case 2: json data to be compared to source anchor
  • No labels