The Aprimo API Records (Aprimo_api_records) Data Block is a System Data Block, and does not need to be edited in order to function.
This guide explains how to modify the Aprimo API Records (Aprimo_api_records) Data Block which functions as an API Forwarder and allows Assette to make API calls to Aprimo. Note that “contentType” to get all reacords and then do pagination in main block
Default Definition #
Below is the default definition of the Aprimo API Records (Aprimo_api_records) Data Block. For more information on the default set up, please see Aprimo API Records Data Block.
{
"api_fowarder_key": "Aprimo",
"method": "POST",
"path": "search/records",
"bodyTemplate": "{\"searchExpression\":{\"expression\": \"contentType = ? and File.Version.FileType.Kind = JPG and Contentstatus = 'Released'\", \"parameters\": [\"{{ImageName}}\"]},\"logRequest\": true}",
"jsonpath_for_data": "$"
}
Parameters #
api_fowarder_key: Specifies the key identifying the API Forwarder configuration to use. In this case, it’s set to "Aprimo"
. This value should not be edited, as this value is provisioned by Assette. For more information, see Assette-Aprimo Integration Overview.
method: Defines the HTTP method for the API call. Here, it’s set to "POST"
. This value should not be edited.
path: Indicates the endpoint path for the API request, which is "search/records"
.
queryTemplate: [Optional Parameter] Provides a template for the query string parameters. The queryTemplate parameter supports variables to support in query string for the API and can be added as shown below. Note that Assette retrieves all records and automatically handles pagination without this optional parameter if there are 50 or fewer images retrieved from Aprimo.{{skip}}
: Number of records to skip.{{take}}
: Number of records to retrieve.
"queryTemplate": "?skip={{Skip}}&take{{Take}}",
bodyTemplate: Contains the template for the request body with placeholders for dynamic values. This parameter most likely to be modified.
- expression: The search criteria, where
?
is a placeholder for the image name. - parameters: An array that replaces the
?
in the expression with the actual image name ({{ImageName}}
). - logRequest: A boolean flag to log the request; set to
true
.
{
"searchExpression": {
"expression": "contentType = ? and File.Version.FileType.Kind = JPG and Contentstatus = 'Released'",
"parameters": ["{{ImageName}}"]
},
"logRequest": true
}
jsonpath_for_data: Specifies the JSONPath expression to extract data from the API response. Here, it’s set to "$"
, pointing to the root of the response JSON.
Notes #
Placeholders: Ensure all placeholders ({{skip}}
, {{take}}
, {{ImageName}}
) are replaced with actual values before sending the request.
Logging: With "logRequest": true
, the API Forwarder will log the request for auditing or debugging purposes.
File Type: The expression filters files where File.Version.FileType.Kind
is JPG
. Modify this if you are searching for different file types.
Content Status: The expression includes Contentstatus = 'Released'
to filter for released content only.
Testing: Before deploying, test the configuration with different parameters to ensure it behaves as expected.