Versions Compared

Key

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

...

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.

Response Structure

The response can be sent as a collection or grouped by operation type or cm-handles. If we group the response by operation type it will be simpler for the end-point user to form a new request and sent it again if the error can be resolved with a retry or a few changes. 

Code Block
titleEach operation Response
{
    "cmHandle": "cmHandle-1"
    "operation": "CREATE" // This field can be used for grouping response if required
	"status": "FAILURE" // Can use the same structure to show success later on.
    "error-code": "01" // Only sent in the case of error
	"error-text" : "cmhandle already exist" // Only sent in the case of error 
}

Questions:

#QuestionAgreed SolutionRemarks
1Are multiple operations for one cm-handle is considered invalid input?

No special validation, process as usual

  • 2nd create will fail
  • 2nd update will override previous
  • 2nd delete will be ignored
2Should system check which dmi-plugin 'owns' cm handle before deleting it? ie. is is the same service that registered the cm-handleJust delete for now until Acces Control gets implemented

Agreed with stakeholder in meeting  

3Preferred output format

Alternative B: only failed cm handles, no status code for each handle. Stakeholder  expected that errors are rare and does not want to process data if successful ie. in most cases and empty response is expected (statuscode 200 code)

empty arrays will not appear in json at all. I.e. if there are no 'failed delete cm handles' the 'failedDeletedCmHandles'  property will simply not appear in the response.
4Order of processing

Change to:

delete → create → update

It will help us to handle the case where the user wants to recreate the cm handle

Response Structure

HttpStatus

ScenarioStatus CodeResponseBody
All operations were successful200Empty
All or few operations failed500With error details from each failed operation
Invalid Input400Error 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 

NameDescriptionMandatory?
cmHandleidentifies the failed cm-handle
  •  Mandatory
errorCodeIdentify the error
  •  Mandatory
errorTextHuman-readable error text
  •  Mandatory
statusFailure/Success; To be discussed with the team
  •  Mandatory

The response body can be structured in two ways

Alternative A: Group by operation type, with status fields

The interface is generic and if we need to send the status of all operations in the future it can be achieved without any breaking change.

Code Block
titleResponse Structure incl status
Code Block
titleGrouped Response Structure
linenumberstrue
collapsetrue
{
    "createdCmHandles": [ 
		{
 			"cmHandle": "cmHandle-1",
    		"status": "FAILURE", // Can use the same structureExtra field to showindicate success later on.the status
    		"error-code": "01" // Only sent in the case of error,
			"error-text" : "cmhandle already exist" // Only sent in the case of error
		}
	],
	"updatedCmHandles": [ 
		{
 			"cmHandle": "cmHandle-2",
    		"status": "FAILURE" // Can use the same structure to show success later on.,
    		"error-code": "02" // Only sent in the case of error,
			"error-text" : "cmhandle does not exist" // Only sent in the case of error
		}
	],
 	"deletedCmHandles": [ 
		{
 			"cmHandle": "cmHandle-3",
    		"status": "FAILURE" // Can use the same structure to show success later on.,
    		"error-code": "02" // Only sent in the case of error,
			"error-text" : "cmhandle does not exist" // Only sent in the case of error
		}
	]
}
Alternative B: Group by operation type but only for failed operations

This approach meets the current requirement and has a smaller payload size (no extra field for the status).

Code Block
titleResponse without grouping(only failed)
linenumberstrue
collapsetrue
{
    "operationResponsefailedCreatedCmHandles": [ 
		{
 			"cmHandle": "cmHandle-1",
		 	"operation": "CREATE",
    		"status": "FAILURE" // Can use the same structure to show success later on.
    		"error-code": "01" // Only sent in the case of error,
			"error-text" : "cmhandle already exist" // Only sent in the case of error
		}
	],
	"failedUpdatedCmHandles": [ 
		{
 			"cmHandle": "cmHandle-2"
		 	"operation": "UPDATE", 
    		"status": "FAILURE" // Can use the same structure to show success later on.
    		"error-code": "02" // Only sent in the case of error,
			"error-text" : "cmhandle does not exist" // Only sent in the case of error
		},
		{],
 			"cmHandlefailedDeletedCmHandles": [ "cmHandle-3"
		{
 	"operation": "DELETE", 
    		"statuscmHandle": "FAILURE" // Can use the same structure to show success later on.cmHandle-3",
    		"error-code": "02" // Only sent in the case of error,
			"error-text" : "cmhandle does not exist" // Only sent in the case of error
		}
	]
}

Error handling

The error can be due to client input and they should try not to Expected Error per operations

Input Issues

  1. If the DMIService ( dmiModelPlugin or dmiService ) does not match with the DMIService of cm handle? update & delete scenario. We should not update these two field because it impacts modelSync, but dmiDataService can be updated
  2. Multiple operations for a single cm-handle: 
    1. If not allowed: Throw the error; it enables us to process them parallelly for better performance.
    2. If allowed: 
      1. Which operation type has higher precedence
        1. create → update → delete: 
        2. delete → create → update: It will help us to handle the case where the user wants to recreate the cm handle
      2. Multiple within the same operation type
        1. create → Take the last one and show success or take the first one and let others fail
        2. update → Process them sequentially because the update can be partial and order may matter here
        3. delete → Process only once 
  3. Input is not in the correct expected format: For example, if the user has not defined the "cm-handle"

...

  1. Reject the request
Create CMHandles
  1. cm-handle already exist
  2. multiple create operations for one cm-handle
  3. unknown-error
Update CMHandles
  1. cm-handle does not exist
  2. DMIService name does not match with existing DMIService of cm handle
  3. unknown-error

...

Remove CMHandles
  1. cm-handle does not exist: No error 
  2. DMIService name does not match with existing DMIService of cm handle
  3. unknown-error

Should we indicate if something can be fixed with retry?


CodeSloganApplicable to
CreateUpdateRemove
00unknown/otherYesYesYes
01cm-handle does not existNoYesNo*
02

cm-handle already exist

YesNoNo
03not allowed**?YesYes

Notes
* remove will ignore non-existing cm handles (not an error, assume already deleted)
** suggested future error (for illustration purposes)