---
schema_version: "1"
id: cbabbedb2eb8130fae418b4459a58eed73bb580c1324779de056de2ba48fedfc
title: Invalidate Affected Response API
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-t-invalidate-affected-response-api.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-invalidate-affected-response-api.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 65d6177a13d95dda6fb91cfc80a68e91124b2dca884b8b028fa9e7b3347c52da
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# Invalidate Affected Response API

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](https://developer.salesforce.com/docs/industries/cme/guide/comms-t-affected-cache-api.md).

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.

## URI

/services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/invalidate

## HTTP Method

POST

## URL Parameters

For example: `POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/invalidate?expirationTime=2021-08-24T12:08:56`

| Parameter      | Example             | Default | Optional/Required | Description                                                   |
| -------------- | ------------------- | ------- | ----------------- | ------------------------------------------------------------- |
| expirationTime | 2021-08-24T12:08:56 | Null    | Optional          | For the future dated cache. The format is YYYY-MM-DDThh:mm:ss |

## Request Body Parameters

| Parameter            | Data Type | Description                                                          | Optional/Required |
| -------------------- | --------- | -------------------------------------------------------------------- | ----------------- |
| cachedAPIResponseIds | String    | cachedAPIResponse Ids that are invalid due to catalog offer changes. | Required          |

## Sample Input

cachedAPIChangeIds contain the IDs of the cached API response objects, which could consist of a list of changes.

This is sample input for the ID of the cachedAPIResponse object.

```nolang
{
    "cachedAPIResponseIds": [
        "a0a5g000000Dn6pAAC",
        "a0a5g000000Doj4AAC",
        "a0a5g000000DoJVAA0",
        "a0a5g000000DpBjAAK",
        "a0a5g000000DpG7AAK"
    ]
}
```

## Sample Input for invalidateAction Node

```nolang
{
      "invalidateAction": {
        "invalidateCachedResponse": {
          "rest": {
            "requestBody": {
              "cachedAPIResponseIds": [
                "a0a5g0000005JbKAAU",
                "a0a5g0000005JaGAAU",
                "a0a5g0000005JbTAAU",
                "a0a5g0000005JbUAAU",
                "a0a5g0000005JbVAAU",
                "a0a5g0000005JbWAAU"
              ]
            },
            "params": {

            },
            "link": "/v3/admin/catalogs/regenerate/invalidate",
            "method": "POST"
          }
        }
      }
    }
```

## HTTP Headers

| Header       | Description      |
| ------------ | ---------------- |
| Content-Type | application/json |

## Remote API

This is an example of how you invoke the API using Apex:

```nolang
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 = 'invalidateCachedAPIResponse';
input.put('methodName',methodName);//required
input.put('apiName','regenerate'); //requires
List<Id> cachedAPIResponseIds = new List<Id>();
cachedAPIResponseIds.add('a4Q5g000000TmnaEAC');
input.put('cachedAPIResponseIds',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 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.

```nolang
THREAD1 -  POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/invalidate
           Body : {"cachedAPIResponseIds":INVALID_ACTION1.CAR1}
THREAD2 -  POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/invalidate
           Body : {"cachedAPIResponseIds":INVALID_ACTION2.CAR2}
THREAD3 -  POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/invalidate
           Body : {"cachedAPIResponseIds":INVALID_ACTION3.CAR3}
.
.
.
.
THREAD100 -  POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/invalidate
            Body : {"cachedAPIResponseIds":INVALID_ACTION4.CAR100}
```

## Response Body

The return status indicates success or failure with a reason for the error. For example:

```
{
    "message": "Successfully completed.",
    "errorCode": "INVOKE-200",
    "error": "OK"
}
```

## HTTP Response Codes

| Code | Description           |
| ---- | --------------------- |
| 200  | OK                    |
| 500  | Internal Server Error |
