Versions Compared

Key

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

...

It can be seen that only the existing list item, i.e. title: Matilda is replaced. Whereas the newly added list item with title: Book 2 is not added but user received a 200-response code.

Scenario 2: API executes the request with incorrect payload

Another user induced error can occur when the user tries to make changes to the key leaf node, which in the current example is "title". If the key is modified, for example title "Matilda" changed to "Incorrect Book Name", the request should fail because there is no such node present in the database.

But if such an error is intentionally induced to test the functionality of the API, it is seen that the request gets executed with an incorrect payload and the user receives a 200-response code.

Expand

Correct parent node xpath: /bookstore/categories[@code=1]

Incorrect JSON payload with misspelled key node, i.e. title

Code Block
{
  "books": [
    {
      "title": "Incorrect Book Name",
      "lang": "French",
      "editions": [2025]
    }
  ]
}

...

Expected Behavior

  • This is a user error as request is in itself wrong, because it tries to add a new list item to a list.

  • CPS provides a separate endpoint to Add a list element

  • So, such a scenario should be handled by throwing an exception from the API instead of returning a successful response.

  • Add support to Add list elements using Replace a node API

Proposed/Accepted Solutions

Info

WIP