---
schema_version: "1"
id: 0ff803fedaeed86ff44a0c960d7277debb018ce664c89c42684aefc5cc832f02
title: Offers List API
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-t-offers-list-api.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-offers-list-api.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: b79fd4dc84ea2533e5e6e8393f3332d905e41993564ca6e84084a45dcb4d196b
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# Offers List API

The Offers List API paginates the list of eligible offers for a context combination and ensures the sequence of those offers on each page and the order of pages remain the same for every run of the getOffers API.

The ctxEligibilityCacheKey must be passed in the request body of this API. You can obtain the ctxEligibilityCacheKey required in the request body from the apiResponse.eligibilityContextKey node in the response body of the [Context Eligibility API](https://developer.salesforce.com/docs/industries/cme/guide/comms-t-context-eligibility-api.md).

## Precondition

You must first the [Context Eligibility API](https://developer.salesforce.com/docs/industries/cme/guide/comms-t-context-eligibility-api.md) to obtain the ctxEligibilityCacheKey required in the request body of this API.

## URI

/services/apexrest/{namespace}/v3/admin/catalogs/{catalogCode}/offers

## HTTP Method

POST

## 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/offers?effectiveStartTime=2021-07-04T12:08:56&expirationTime=2021-08-04T12:08:56
```

## Request Body Parameters

| Parameter              | Data Type | Description                                                                | Default | Optional/Required |
| ---------------------- | --------- | -------------------------------------------------------------------------- | ------- | ----------------- |
| ctxEligibilityCacheKey | String    | Cache key pointing to the context eligibility record to sort and paginate. | N/A     | Required          |

## Sample Request Body

This is a sample request for a context eligibility cache key (ctxEligibilityCacheKey).

```nolang
{
    "ctxEligibilityCacheKey": "418744a77cd0344bcc501f2ed72aa920"
}
```

## Remote API

This is an example of how you invoke the API using Apex:

```nolang
String methodName;
String requestBodyJSON;
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 = 'getOffers';
requestBodyJSON = '{"ctxEligibilityCacheKey":"418744a77cd0344bcc501f2ed72aa920"}';
input.put('apiName','CMOffers'); //required
input.put('catalogCode', 'TestCatalog');    //required
input.put('effectiveStartTime', null);      //optional
input.put('expirationTime', null);          //optional
input.put('requestBody', requestBodyJSON);  //required
input.put('methodName',methodName);         //required
input.put('requestURL', '/v3/admin/catalogs/TestCatalog/offers'); //required

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
```

## Parallel Invocation

Each context eligibility result can be processed in parallel. For example, if there are 10 catalogs and each catalog links to 12 context eligibility results, then all 120 results can run in parallel.

```nolang
THREAD1 -  POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offers
THREAD2 -  POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offers
...
THREAD12 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offers
THREAD13 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog2/offers
......
THREAD120 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog10/offers
```

## HTTP Headers

| Header       | Description      |
| ------------ | ---------------- |
| Content-Type | application/json |

## Response Body

This example shows a list of eligible offers for a context combination in the correct sequence and order of pages.

```
{
  "nextOffersAction": {
    "rest": {
      "params": {},
      "method": "GET",
      "link": "/v3/catalogs/T9_cache_mgmt/offers?context={\"DIM_0\":\"V_0_2\",\"DIM_1\":\"V_1_1\",\"DIM_2\":\"V_2_2\",\"DIM_3\":\"V_3_1\",\"DIM_4\":\"V_4_2\"}&offset=100&pagesize=20"
    },
    "remote": {
      "params": {}
    },
    "client": {
      "records": [],
      "params": {}
    }
  },
  "result": {
    "Promotion": [
      "a3T5g000000CvcvEAC",
      "a3T5g000000Cvd0EAC",
      "a3T5g000000Cvd1EAC"
    ],
    "Product": [
      "01t5g000002vVUIAA2",
      "01t5g000002vVUJAA2",
      "01t5g000002vVUKAA2",
      "01t5g000002vVULAA2",
      "01t5g000002vVUMAA2",
      "01t5g000002vVUNAA2",
      "01t5g000002vVUOAA2",
      "01t5g000002vVUPAA2",
      "01t5g000002vVUQAA2",
      "01t5g000002vVURAA2",
      "01t5g000002vVUSAA2",
      "01t5g000002vVUTAA2",
      "01t5g000002vVUUAA2",
      "01t5g000002vVUVAA2",
      "01t5g000002vVUWAA2",
      "01t5g000002vVUXAA2",
      "01t5g000002vVUYAA2"
    ]
  }
}
```

## HTTP Response Codes

| Code | Description           |
| ---- | --------------------- |
| 200  | OK                    |
| 500  | Internal Server Error |
