...
NCMP CMhandle registration endpoint receives multiple operations to create, update or delete cm-handles in a single request. As there are multiple operations, the endpoint response structure should be able to provide the status of all operations separately with consistent error-code to allow users to retrigger failed operations programmatically if possible.
Questions:
Question | Agreed Solution | Remarks | |
---|---|---|---|
1 | Are multiple operations for one cm-handle is considered invalid input? | ||
2 |
Response Structure
HttpStatus
Scenario | Status Code | ResponseBody |
---|---|---|
All operations were successful | 204200 | Empty |
All or few operations failed | 500 | With error details from each failed operation |
Invalid Input | 400 | Error Details |
Response Body
The response body should give enough information for each failed operation to retry them programmatically. For each failed operation we should send the below information
Name | Description | Mandatory? |
---|---|---|
cmHandle | identifies the failed cm-handle |
|
errorCode | Identify the error |
|
errorText | Human-readable error text |
|
status | Failure/Success; To be discussed with the team |
|
The response body can be formed structured in three two ways
Group by operation type
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "failedCreatedCmHandles": [ { "cmHandle": "cmHandle-1", "error-code": "01", "error-text" : "cmhandle already exist" } ], "failedUpdatedCmHandles": [ { "cmHandle": "cmHandle-2", "error-code": "02" , "error-text" : "cmhandle does not exist" } ], "deletedCmHandles": [ { "cmHandle": "cmHandle-3", "error-code": "02" , "error-text" : "cmhandle does not exist" } ] } |
Error handling
The error can be due to client input and they should try not to
Input Issues
- Multiple operations for a single cm-handle:
- If not allowed: Throw the error; it enables us to process them parallelly for better performance.
- If allowed:
- Which operation type has higher precedence
- create → update → delete:
- delete → create → update: It will help us to handle the case where the user wants to recreate the cmhandle
- Multiple In the same operation type
- create → Take the last one and show success or take the first one and let others fail.
- update → Process them sequentially because the update can be partial and order may matter here.
- delete → Process only once
- Which operation type has higher precedence
- Input is not in the correct expected format: For example, if the user has not defined the "cm-handle"Reject the request
Create CMHandles
- cm-handle already exist
- multiple create operations for one cm-handle
- unknown-error
Update CMHandles
...
- cm-handle does not exist: No error
- unknown-error
Should we indicate indicate if something can be fixed with retry?
...