Derive Change Entities API

The Derive Change Entities API derives the scope of the impacted entities from the unprocessed CachedAPIChange Ids received from the GetCatalog Change API.

This API takes the catalog changes as input in the request body and derives the scope of the impacted cache records. For example, if you modified the pricing of an offer due to the PriceListEntry(PLE) change, then the impacted scope entity would be the pricing of the offer to which that PLE is associated and the baskets containing that offer.

You can obtain the List<cachedAPIChangeIds> or cachedAPIChangeIds required in the request body of this API from the cachedAPIChangeIds node in the response body of the GetCatalog Change API.

Precondition 

You must first run the GetCatalog Change API to obtain the List<cachedAPIChangeIds> or cachedAPIChangeIds required in the request body of this API.

URI 

/services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/deriveChange

HTTP Method 

POST

URI Parameters 

ParameterExampleDefaultOptional/RequiredNotes
uniqueDeriveIds/services/apexrest/jk_234_regen_ne/v3/admin/catalogs/regenerate/deriveChange?uniqueDeriveIds=trueTrueOptionalThis parameter gets the distinct derived IDs from CachedAPIChange objects. Passing the request body in the API request is not required.

Request Body Parameters 

ParameterData typeDescriptionOptional/Required
CachedAPIChangeIdsStringUnprocessed cachedAPIChange Ids are the output of the GetCatalog Change API.Optional

Sample Post Body 

This is a sample post for cachedAPIChangeIds.

1{
2    "cachedAPIChangeIds": [
3        "a4Q5g000000Tjj1EAC",
4        "a4Q5g000000TjjBEAS",
5        "a4Q5g000000TjjCEAS"
6    ]
7}

Sample Input 

cachedAPIChangeIds contain the ID of the cached API change object, which could be a list of changes.

This is sample input with the ID of the cached API change object.

1{
2    "cachedAPIChangeIds": [
3        "a4Q5g000000Tjj1EAC",
4        "a4Q5g000000TjjBEAS",
5        "a4Q5g000000TjjCEAS"
6    ]
7}

Remote API 

This is an example of how you invoke the API using Apex:

1String methodName;
2Map<String, Object> input = new Map<String, Object>();
3Map<String, Object> output = new Map<String, Object>();
4Map<String, Object> options = new Map<String, Object>();
5// Setting remote parameters
6methodName = 'deriveChangeEntity';
7input.put('methodName',methodName);//required
8input.put('apiName','regenerate'); //requires
9List<Id> cachedAPIChangeMap = new List<Id>();
10cachedAPIChangeMap.add('a4Q5g000000TmnaEAC');
11input.put('cachedAPIChangeIds',cachedAPIChangeMap); //required
12//remote action invocation
13jk_232_cam.CpqAppHandler appHandler = new jk_232_cam.CpqAppHandler();
14appHandler.invokeMethod(methodName, input, output, options);

Parallel Invocation 

You can run this API in parallel for different cachedAPIChangeIds. For example, if there are 100 unprocessed cachedAPIChange entries from GetCatalogChangeAPI (CAC1, CAC2…CAC100), you can run parallel threads of the Derive Change API with each individual cachedAPIChangeIds.

1THREAD1 -  POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/deriveChange
2           Body : {"cachedAPIChangeIds":CAC1}
3THREAD2 -  POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/deriveChange
4           Body : {"cachedAPIChangeIds":CAC2}
5THREAD3 -  POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/deriveChange
6           Body : {"cachedAPIChangeIds":CAC3}
7.
8.
9.
10.
11THREAD100 - POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/deriveChange
12            Body : {"cachedAPIChangeIds":CAC100}

If you are executing APIs in parallel using an orchestrator, you must use the uniqueDeriveIds parameter. This parameter ensures that duplicate records are not created and processed.

For example:

1POST
2/services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/deriveChange?uniqueDeriveIds=true

HTTP Headers 

HeaderDescription
Content-Typeapplication/json

Response Body 

The return status indicates success or failure with a reason for the error. List<Id> of records contains the unprocessed Id of the CachedAPIChange__c object.

1{
2    "cachedAPIChangeIds": [
3        "a4Q5g000000TmqjEAC",
4        "a4Q5g000000TmqkEAC",
5        "a4Q5g000000TmqlEAC",
6        "a4Q5g000000TmqmEAC",
7        "a4Q5g000000TmqnEAC",
8        "a4Q5g000000TmqoEAC"
9    ],
10    "errorCode": "INVOKE-200",
11    "error": "OK"
12}

HTTP Response Codes 

CodeDescription
200OK
500Internal Server Error