Context Combinations API
The Context Combinations API generates a cartesian product of all the sets of dimension combination values passed in the request body. If a context dimension is not passed in the request, all the valuesForCaching are used for that dimension to generate the cartesian product. This API also returns a cache key that is required by the context eligibility API.
Keep the pageSize option under 20 to avoid reaching Salesforce governor limits.
You can obtain the dimensions required for the request body of this API from the apiResponse node in the response body of the Context Dimensions API. The code for each element in the API response becomes the key of the dimensions hash map and the valuesForCaching forms its values.
You must first run the Context Dimensions API to obtain the dimensions required for the request body of this API.
/services/apexrest/{namespace}/v3/admin/catalogs/{catalogCode}/contextcombinations
POST
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:
For example,
Parameter | Data Type | Description | Default | Optional/Required |
---|---|---|---|---|
dimensions | Map/Dictionary/Associative array Key = String Value = List of strings | Map containing only the dimensions for which you want to reduce the number of values used for creating combinations. This API lets you generate only cached entries for specific context dimensions and values, for example, you can calculate combinations for Gold and Silver values for an Account SLA dimension. You can leave this parameter blank if you want to perform all the context combinations relevant to your sales catalog or are not using any context dimensions with your catalog. You can obtain the dimensions required for the request body of this API from the apiResponse node in the response body of the Context Dimensions API. | N/A | Required |
pagesize | Positive integer | Number of entries to process | 20 | Optional |
offset | Non-negative integer | Index of the entry from which to start processing | 0 | Optional |
This is a sample request for a catalog without rules assigned to its offers.
This is an example of how you invoke the API using Apex:
You can run this API in parallel for multiple catalogs. For example, you may have 100 catalogs (Catalog1, Catalog2..Catalog 100). Each catalog has five dimensions with three values each. This gives you a total of 243 combinations for each catalog. If you have a page size of 20, this gives you 13 pages per catalog with a total of 1,300 combinations. Each of these pages can be populated in parallel threads.
Header | Description |
---|---|
Content-Type | application/json |
This example shows a cartesian product of dimension combination values passed in the request body.
Code | Description |
---|---|
200 | OK |
500 | Internal Server Error |