Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Issues/Decisions/Open Questions


SloganNotesDecision
1Which alternative

2


Introduction

Currently CPS Delta Feature provides 2 endpoints as follows:

...

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.

...

Alternative 1: Single 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

...

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

Alternative

...

2:  One Endpoint with Two Operations

In RESTful interface we can have same endpoint for multiple APIs, given they are performing different operations, for example POST and GET.

...

Sample endpoints after changeImage Removed


After the update only the names of the endpoint will be updated, the path and query parameters will remain as it is. So, the updated APIs would be as follows:

#
Sub interface
Existing EndpointUpdated EndpointPath/Query ParametersResponse Codes
1
Data

GET-/v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/deltaAnchors

GET-/v2/dataspaces/{dataspace-name}/anchors/{source-anchor-name}/delta/{target-anchor-name}


Parameter NameInRequiredDescription
dataspace-namePathYesDataspace name
source-anchor-namePathYesFirst Anchor Name/Reference Anchor
target-anchor-namePathYesSecond Anchor Name/Comparand Anchor
descendantsQueryNoLevel of descendants for delta comparison. 
target-anchor-nameQueryYesSecond Anchor Name/Comparand Anchor
xpathQueryYesxpath of the node


  • 200 (OK)
    • success
  • 400
    • dataspace not found
      DataspaceNotFoundException
    • anchor not found
      AnchorNotFoundException
    • Data node not found
      DataNodeNotFoundException
    • invalid xpath
      CpsPathException
  • 500
    • unexpected error
2
Data

POST- /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/deltaPayload

POST- /v2/dataspaces/{dataspace-name}/anchors/{source-anchor-name}/delta


Parameter NameInRequiredDescription
dataspace-namePathYesDataspace name
source-anchor-namePathYesFirst Anchor Name/Reference Anchor
xpathQueryYesxpath of the node
FileBody
of content type:
(multipart/form-data TBC)OptionalYang file/Zip file containing the schema details.
Text/StringBody
of content type:
(multipart/form-data)YesJSON payload as plain text