...
# | API | Request parameters | Response Codes | Scenarios |
---|
1 | Create a Node: /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes |
Parameter Name | In | Required | Description |
---|
dataspace-name | Path | true | dataspace name | anchor-name | Path | true | anchor name | xpath | Query | true | xpath of node | dry-run | Query | false | flag to enable or disable data validation (set to false by default) |
| - 200 (OK)
- 400
- dataspace not found
DataspaceNotFoundException - anchor not found
AnchorNotFoundException - Data node not found
DataNodeNotFoundException - invalid xpath
CpsPathException
- 500
| Scenario 1: dry run set to false - In this case there will be no functional change in the APIs, and they would return appropriate response codes with messages in case of any failure.the following scenarios:
- In case of successful validation, the data will be persisted, and a 200201-response code is returned with nothing in response body
- In case of validation failure, the data validation error is returned with appropriate message and a 400-response code.
Scenario 2: dry run set to true - In this case the APIs will return the same response codes. The only difference will be:
- in case data validation passes, then it would return a 200-response code without any response body, and the data will not be persisted in case of POST operation or modified in case of PUT/PATCH operations.
- In case of validation failure, the data validation error is returned with appropriate message and a 400-response code.
|
Sub-tasks
The following APIs:
- Create a Node
- Add List Element
would return a 500-response code in case of Data Validation failure. This is in clear contradiction to the details mentioned in CPS Exceptions and REST APIs HTTP Response Codes documentation. This has been identified as a bug and was fixed in the following patch Fix "Create a node" and "Add List Elements" APIs response code · Gerrit Code Review.
References:
...