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

Parameter Example Default Optional/Required Notes
uniqueDeriveIds /services/apexrest/jk_234_regen_ne/v3/admin/catalogs/regenerate/deriveChange?uniqueDeriveIds=true True Optional This parameter gets the distinct derived IDs from CachedAPIChange objects. Passing the request body in the API request is not required.

Request Body Parameters

Parameter Data type Description Optional/Required
CachedAPIChangeIds String Unprocessed cachedAPIChange Ids are the output of the GetCatalog Change API. Optional

Sample Post Body

This is a sample post for cachedAPIChangeIds.

{
    "cachedAPIChangeIds": [
        "a4Q5g000000Tjj1EAC",
        "a4Q5g000000TjjBEAS",
        "a4Q5g000000TjjCEAS"
    ]
}

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.

{
    "cachedAPIChangeIds": [
        "a4Q5g000000Tjj1EAC",
        "a4Q5g000000TjjBEAS",
        "a4Q5g000000TjjCEAS"
    ]
}

Remote API

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

String methodName;
Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();
// Setting remote parameters
methodName = 'deriveChangeEntity';
input.put('methodName',methodName);//required
input.put('apiName','regenerate'); //requires
List<Id> cachedAPIChangeMap = new List<Id>();
cachedAPIChangeMap.add('a4Q5g000000TmnaEAC');
input.put('cachedAPIChangeIds',cachedAPIChangeMap); //required
//remote action invocation
jk_232_cam.CpqAppHandler appHandler = new jk_232_cam.CpqAppHandler();
appHandler.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.

THREAD1 -  POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/deriveChange
           Body : {"cachedAPIChangeIds":CAC1}
THREAD2 -  POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/deriveChange
           Body : {"cachedAPIChangeIds":CAC2}
THREAD3 -  POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/deriveChange
           Body : {"cachedAPIChangeIds":CAC3}
.
.
.
.
THREAD100 - POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/deriveChange
            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:

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

HTTP Headers

Header Description
Content-Type application/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.

{
    "cachedAPIChangeIds": [
        "a4Q5g000000TmqjEAC",
        "a4Q5g000000TmqkEAC",
        "a4Q5g000000TmqlEAC",
        "a4Q5g000000TmqmEAC",
        "a4Q5g000000TmqnEAC",
        "a4Q5g000000TmqoEAC"
    ],
    "errorCode": "INVOKE-200",
    "error": "OK"
}

HTTP Response Codes

Code Description
200 OK
500 Internal Server Error