---
schema_version: "1"
id: e606dc1490c20db1e0c9db7bd6c2969b32f8e77a6a58cb620b854d8cf0bb8bf1
title: Context Dimensions API
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-t-context-dimensions-api.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-context-dimensions-api.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: d11be99bea33d52324b54a28995fd28f42a82c5e42dcc3cdf484261f5e44cd74
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# Context Dimensions API

The Context Dimensions API generates a list of cacheable and active context dimension codes and their values for caching. These dimensions and values are associated with rule sets attached to the catalog offers.

This API does not require anything from the previous API response. The list is ordered and is guaranteed to return the same order on every run as long as dimensions are not added or removed from the catalog.

If a context dimension associated with a catalog offer is not cacheable, it does not appear in the response. If a cacheable context dimension is not associated with a catalog offer, it does not appear in the response.

The Context Dimensions API call is required regardless of whether you have any rule sets linked to your catalog because the output of this API is internally required by subsequent APIs.

## URI

/services/apexrest/{namespace}/v3/admin/catalogs/{catalogCode}/contextdimensions

## HTTP Method

GET

## URI Parameters

If you specify just one of these two parameters, it follows the behavior described in the table below and accepts your defined time for the parameter you specified. If you are using one or both parameters, you must specify them with the same values for all of the Populate Cache APIs in this sequence.

| Parameter          | Example             | Default                         | Optional/Required | Notes                                                                                                                                                                                                                                                                                                                              |
| ------------------ | ------------------- | ------------------------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| effectiveStartTime | 2001-07-04T12:08:56 | Current date and time           | Optional          | effectiveStartTime is the time that you want your cached catalog entries to be effective. It should be in the UTC date-time format. Your effectiveStartTime must occur after the current time for which you are executing the Populate Cache APIs or you will receive an error message.                                            |
| expirationTime     | 2001-07-04T12:08:56 | effectiveStartTime + TimeToLive | Optional          | expirationTime is the time that you want your cached catalog entries to expire. It should also be in the UTC date-time format. Your expirationTime must occur after your effectiveStartTime or you receive an error message. TimeToLive is a custom setting created in CPQ Configuration Setup. It has a default value of 30 days. |

Here is an example of how to pass the URI parameters:

```nolang
GET /services/apexrest/vlocity_cmt/v3/admin/catalogs/AS-Test-Catalog/contextdimensions?effectiveStartTime=2021-07-04T12:08:56&expirationTime=2021-08-04T12:08:56
```

## 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 = 'getContextDimensions';
input.put('apiName','CMContextDimensions'); // required
input.put('catalogCode', 'TestCatalog');    // required
input.put('effectiveStartTime', null);      // optional
input.put('expirationTime', null);          // optional
input.put('methodName',methodName);         // required
input.put('requestURL', '/v3/admin/catalogs/TestCatalog/contextdimensions'); // required

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
```

## Parallel Invocation

This API can be run in parallel for multiple catalogs. For example, if you have 100 catalogs (Catalog1, Catalog2..Catalog 100), you can run the API for all 100 catalogs in 100 parallel threads.

```nolang
THREAD1 -  GET /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/contextdimensions
THREAD2 -  GET /services/apexrest/{namespace}/v3/admin/catalogs/catalog2/contextdimensions
......
THREAD100 - GET /services/apexrest/{namespace}/v3/admin/catalogs/catalog100/contextdimensions
```

## HTTP Headers

| Header       | Description      |
| ------------ | ---------------- |
| Content-Type | application/json |

## Response Body

This example shows a list of maps having dimension code and values marked for caching.

```
[
  {
    "code": "DIMENSION1",
    "valuesForCaching": [
      "VALUE1",
      "VALUE2",
      "VALUE3"
    ]
  },
  {
    "code": "DIMENSION2",
    "valuesForCaching": [
      "VALUE4",
      "VALUE5",
      "VALUE6"
    ]
  },
  {
    "code": "DIMENSION3",
    "valuesForCaching": [
      "VALUE7",
      "VALUE8",
      "VALUE9"
    ]
  }
]
```

The response body contains the following:

- DIMENSION1, DIMENSION2, DIMENSION3, etc. are sorted in an arbitrary order. There is no need to specify these in EPC.

- DIMENSION1, DIMENSION2, DIMENSION3, etc. are extracted from all the rules of the products in the catalog, for example, only the relevant dimensions.

## HTTP Response Codes

| Code | Description           |
| ---- | --------------------- |
| 200  | OK                    |
| 500  | Internal Server Error |
