The Invalidate Affected Response API invalidates the cache entries that have become inaccurate due to catalog offer changes. You must pass the cachedAPIResponseIds provided in the invalidateAction node received in the response from the Affected Cache API.
You can obtain the List<cachedAPIChangeIds> or cachedAPIChangeIds required in the request body of this API from the cachedAPIChangeIds node (records.invalidateAction.invalidateCachedResponse.rest.requestBody.cachedAPIResponseIds) in the response body of the Get Affected Cache 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 parameters6methodName = 'invalidateCachedAPIResponse';7input.put('methodName',methodName);//required8input.put('apiName','regenerate'); //requires9List<Id> cachedAPIResponseIds = new List<Id>();10cachedAPIResponseIds.add('a4Q5g000000TmnaEAC');11input.put('cachedAPIResponseIds',cachedAPIChangeMap); //required12//remote action invocation13jk_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 cachedAPIResponseIds. For example, if there are 100 invalidate Action nodes from the GetAffected cache API (INVALID_ACTION1, INVALID_ACTION 2…INVALID_ACTION100) and each action node contains a list of cachedAPIResponseIds, such as INVALID_ACTION1.CAR1, then you can run parallel threads of Invalidate APIs with each individual invalidate Action node.
1THREAD1 - POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/invalidate2 Body : {"cachedAPIResponseIds":INVALID_ACTION1.CAR1}3THREAD2 - POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/invalidate4 Body : {"cachedAPIResponseIds":INVALID_ACTION2.CAR2}5THREAD3 - POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/invalidate6 Body : {"cachedAPIResponseIds":INVALID_ACTION3.CAR3}7.8.9.10.11THREAD100 - POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/invalidate12 Body : {"cachedAPIResponseIds":INVALID_ACTION4.CAR100}
Response Body
The return status indicates success or failure with a reason for the error. For example: