...
As per the discussion with CPS team, it was concluded that the proposal for changing the error code response for following API's is not required at the moment. This decision was made in with reference to the research and decisions found at the following Epic CPS Exceptions and REST APIs HTTP Response Codes. Although an inconsistency was found with the API "Create a Node" which can be found below at point number 13. It is to be resolved in upcoming release.
Query a node
Create Schema Set
Get a Schema Set
Delete Schema
Create Anchor
Get All Anchors
Get an Anchor
Delete an Anchor
Get a Node
Delete a Node
Replace Descendants of a Node
Update a data node leaves for a given dataspace and anchor and a parent node xpath
Create Node
When an invalid json is passed (for example JSON with missing brackets) API returns 400 Bad Request without details.
When a valid json is passed with typo (for example JSON having a misspelled key) then returns 500 server error, should return 400 with response message
API: http://IP:PORT/cps/api/v1/dataspaces/<dataspace-name>/anchors/<anchor-name>/nodes?xpath=/
Current Error Code
Code Block 500 Internal Server Error
Updated Error Code
Code Block { "status": "400 BAD_REQUEST", "message": "Dataspace not found", "details": "Dataspace with name XYZ does not exist." }
Current Error Code
Code Block 500 Internal Server Error
Updated Error Code
Code Block { "status": "400 BAD_REQUEST", "message": "Anchor not found", "details": "Anchor with name ABC does not exist in dataspace XYZ." }