Preview the results from the recommendation by id.
/content/preview/api/v1.1/personalization/recommendationResults/.by.id/{id}
Audience attributes must be specified as part of the query parameters as name value pairs prepended with the keyword attribute as follows: attribute.\
Example: ?attribute.custom.myAttribute1=value1&attribute.custom.myAttribute2=value2
Where multivalued audience attributes are allowed, they should be provided in the query by repeating the name value pairs.
Example: ?attribute.custom.myMultiValue=value1&attribute.custom.myMultiValue=value2 etc.
Note: Taxonomy related information in the response will not be shown until the taxonomy is published to the specified channel although filtering categorized assets using rules with promoted version of taxonomies and it's categories is allowed
Request
-
id: string
Id of the recommendation.
-
attribute.category.attributeName(optional): array
Collection Format:
multi
List of audience attributes. Any special characters present must be encoded.The audience attributes should be prefixed with the keyword attribute:
attribute.\.\ =\
Example: ?attribute.custom.myAttribute1=value1&attribute.custom.myAttribute2=value2 -
channelToken(optional): string
Channel token of the targeted channel. A channel token must be provided as either a query parameter or a request header.
-
fields(optional): string
The fields parameter is used to control the returned fields and values in the queried item. This parameter accepts a comma-separated list of field names or all. All the user-defined field names should be provided with prefix fields and followed by a period (.). These fields will be returned for each queried item. As all the field names are case-sensitive, users must provide the correct field names in the search query. When fields is specified as all (case-insensitive), in case of a type-specific query, all the standard fields, and user-defined fields except largetext, json, location datatype are returned for each queried item, whereas in case of a query across all types, only all standard fields are returned. The standard fields id and type are always returned in the response and cannot be filtered out. This parameter is optional in the query and by default query result shows only id, name, description, and type in the response. Any incorrect or invalid field name given in the query will be ignored.
In the context of a brace style cross-type query, type specific fields may be specified using syntax name,{typename1:fields.userdefinedfieldname1,fields.userdefinedfieldname2},{typename2:fields.userdefinedfieldname1}.In the preceding example, all items of type typename1 will have fields - name, userdefinedfieldname1 and userdefinedfieldname2, while all items of type typename2 will have fields - name, userdefinedfieldname1. If the cross-type query does not resolve to types referenced in the typed fields clause(s), an error will be thrown. Example: ?q=(type eq "LocationType")&fields=fields.state,fields.country,updatedDate
This returns id, type, state, country, updatedDate in the search results for a LocationType with state and country fields.
Example: ?q=(type eq "LocationType")&fields=all
This will return all standard fields and all user-defined fields except largetext, json, location data types
Example: ?fields=all
This will return only standard fields (id, type, typeCategory, name, description, slug, language, createdDate, updatedDate, taxonomies, renditions) since Type is not used in the search query (acts as a Global query)Default Value:name,description
-
limit(optional): integer(int32)
This parameter accepts a non negative integer and is used to control the size of the result. The maximum value allowed for limit is 500.Default Value:
100
-
links(optional): string
Accepts a comma-separated list of rel (relation) links, which the client requires in the results. By default, all the applicable links in a resource are included in the response. Possible values are: self, canonical, describedby, first, last, prev, next.
Example: links=self,canonical will only return the links with the rel property self or canonical. -
offset(optional): integer(int32)
Start index of response rows.Default Value:
0
-
totalResults(optional): boolean
Accepts a boolean value. This value is always set to true and displays the total results in the response.Default Value:
true
Attribute entries can be provided as a single value:
"\
or as an array in the case of multi value attributes:
"\
NOTE: Audience attributes specified in the query will override audience attributes specified in the body.
For preview of recommendations, only valid value for asset state is PREVIEW
object
-
assetState:
string
Allowed Values:
[ "PUBLISHED", "ALL", "PREVIEW" ]
A Enum that is used to determine if only published assets should be returned in the testing of the recommendation. Valida values are ALL and PUBLISHED. Default value is ALLe. -
audienceAttributes:
object audienceAttributes
Additional Properties Allowed: additionalPropertiesArray of audience attributes to be used in testing the recommendation. Each attribute can be proprovided as a single value:
"\.\ " : "\ "
or as an array for multi value attributes:
"\.\ " : ["\ ", "\ " ... ]
object
"\
or as an array for multi value attributes:
"\
Response
- application/json
200 Response
object
-
aggregationResults(optional):
array aggregationResults
Aggregation results.
-
count(optional):
integer(int32)
Total number of records in the current response.
-
hasMore(optional):
boolean
Check whether there are more pages to fetch.
-
items(optional):
array items
Singular resources contained in the collection.
-
limit(optional):
integer(int32)
Actual page size used by the server. This might not be the same as what the client requests.
-
links(optional):
array links
Links of the resource.
-
offset(optional):
integer(int32)
The actual index from which the singular resources are returned.
-
pinned(optional):
array pinned
Pinned items. Shows items pinned at the top of search list
-
properties(optional):
object properties
Additional Properties Allowed: additionalPropertiesadditional collection properties.
-
scrollId(optional):
string
scrollId if the search resolved to a scroll search.
-
totalResults(optional):
integer(int32)
Total number of rows that satisfy the client request (excluding the paging parameters.)
array
-
Array of:
object Link
Link of the resource.
array
object
object
object
-
href(optional):
string
The target resource's URI. It could be template URI. It is a required property in the get response.
-
mediaType(optional):
string
Media type.
-
method(optional):
string
What HTTP method can be used to access the target resource.
-
profile(optional):
string
Link to the metadata that describes the target resource.
-
rel(optional):
string
Relation type. It is a required property in the get response.
-
templated(optional):
boolean
Whether the URI is a template.
object
400 Response
403 Response
500 Response
Examples
Example 1:
The following example shows how to preview a recommendation by Id by submission of a POST request on the REST resource using cURL:
curl -X POST -H 'Accept: application/json' 'https://host:port/content/preview/api/v1.1/personalization/recommendationResults/.by.id/RECO9DAF2D6B079140589709992EC922A5B9?attribute.custom.attribute-ts-1=Single value&channelToken=b1230e5b0e7f4e998d586391ca1647da&fields=all'
This previews recommendation with id: RECO9DAF2D6B079140589709992EC922A5B9, channelToken: b1230e5b0e7f4e998d586391ca1647da. Audience attribute is provided in the url which will match the rules.
Request Payload
{ "audienceAttributes": { }, "assetState": "PREVIEW" }
Response Body
{ "hasMore": false, "offset": 0, "count": 2, "limit": 2, "totalResults": 2, "items": [ { "description": "Complex item - 278890853097008", "language": "en-US", "updatedDate": { "value": "2021-10-28T11:18:29.112Z", "timezone": "UTC" }, "mimeType": "contentItem", "type": "278799601349002-testRecommendation-complexType", "typeCategory": "ContentType", "createdDate": { "value": "2021-10-28T11:18:19.541Z", "timezone": "UTC" }, "taxonomies": { "items": [] }, "name": "contentItem3ComplexType-278890853059007", "renditions": { "items": [] }, "links": [ { "href": "https://<hostname>/content/preview/api/v1.1/items/CORE05B1B553E20B46DC8A1ACE333958BBB1?channelToken=b1230e5b0e7f4e998d586391ca1647da", "rel": "self", "method": "GET", "mediaType": "application/json" } ], "id": "CORE05B1B553E20B46DC8A1ACE333958BBB1", "fileGroup": "contentItem", "fields": { "Text_single_1": "Single value", "Number_1": 111, "Text_multi_1": [ "Aaa bbb ccc", "Ddd eee fff" ], "Decimal_1": 1.11, "Boolean_1": true }, "slug": "3000000010216-contentitem3complextype-278890853059007" }, { "description": "Complex item - 278862344909006", "language": "en-US", "updatedDate": { "value": "2021-10-28T11:18:57.169Z", "timezone": "UTC" }, "mimeType": "contentItem", "type": "278799601349002-testRecommendation-complexType", "typeCategory": "ContentType", "createdDate": { "value": "2021-10-28T11:18:19.101Z", "timezone": "UTC" }, "taxonomies": { "items": [] }, "name": "contentItem2ComplexTypePub-278862344860005", "renditions": { "items": [] }, "links": [ { "href": "https://<hostname>/content/preview/api/v1.1/items/CORE84C77C63C8DF4A80A26599B1B0FB964F?channelToken=b1230e5b0e7f4e998d586391ca1647da", "rel": "self", "method": "GET", "mediaType": "application/json" } ], "id": "CORE84C77C63C8DF4A80A26599B1B0FB964F", "fileGroup": "contentItem", "fields": { "Text_single_1": "Single value", "Number_1": 111, "Text_multi_1": [ "Aaa bbb ccc", "Ddd eee fff" ], "Decimal_1": 1.11, "Boolean_1": true }, "slug": "3000000010215-contentitem2complextypepub-278862344860005" } ], "links": [ { "href": "https://<hostname>/content/preview/api/v1.1/personalization/recommendationResults/.by.id/RECO9DAF2D6B079140589709992EC922A5B9?attribute.custom.attribute-ts-1=Single value&channelToken=b1230e5b0e7f4e998d586391ca1647da&fields=all", "rel": "self", "method": "POST", "mediaType": "application/json" }, { "href": "https://<hostname>/content/preview/api/v1.1/personalization/recommendationResults/.by.id/RECO9DAF2D6B079140589709992EC922A5B9?attribute.custom.attribute-ts-1=Single value&channelToken=b1230e5b0e7f4e998d586391ca1647da&fields=all", "rel": "canonical", "method": "POST", "mediaType": "application/json" }, { "href": "https://<hostname>/content/preview/api/v1.1/metadata-catalog/personalization/recommendationResults/.by.id/RECO9DAF2D6B079140589709992EC922A5B9?channelToken=b1230e5b0e7f4e998d586391ca1647da", "rel": "describedby", "method": "GET", "mediaType": "application/schema+json" }, { "href": "https://<hostname>/content/preview/api/v1.1/personalization/recommendationResults/.by.id/RECO9DAF2D6B079140589709992EC922A5B9?attribute.custom.attribute-ts-1=Single value&channelToken=b1230e5b0e7f4e998d586391ca1647da&fields=all&offset=0", "rel": "first", "method": "POST", "mediaType": "application/json" }, { "href": "https://<hostname>/content/preview/api/v1.1/personalization/recommendationResults/.by.id/RECO9DAF2D6B079140589709992EC922A5B9?attribute.custom.attribute-ts-1=Single value&channelToken=b1230e5b0e7f4e998d586391ca1647da&fields=all&offset=0", "rel": "last", "method": "POST", "mediaType": "application/json" } ] }
Example 2:
curl -X POST -H 'Accept: application/json' 'https://host:port/content/preview/api/v1.1/personalization/recommendationResults/.by.id/RECOF7E733CC021B4D968D9F9B25E7151F03?attribute.custom.attribute-ts-1=WillNeverMatch&channelToken=b1230e5b0e7f4e998d586391ca1647da&fields=all'
This previews recommendation with id: RECOF7E733CC021B4D968D9F9B25E7151F03, channelToken: b1230e5b0e7f4e998d586391ca1647da. Audience attribute is provided in the url and since no rules match, defaults are returned.
Request Payload
{ "audienceAttributes": { }, "assetState": "PREVIEW" },
Response Body
{ "hasMore": false, "offset": 0, "count": 2, "limit": 2, "totalResults": 2, "items": [ { "description": "Complex item - 278857744875004", "language": "en-US", "updatedDate": { "value": "2021-10-28T11:19:09.889Z", "timezone": "UTC" }, "mimeType": "contentItem", "type": "278799601349002-testRecommendation-complexType", "typeCategory": "ContentType", "createdDate": { "value": "2021-10-28T11:18:16.312Z", "timezone": "UTC" }, "taxonomies": { "items": [] }, "name": "contentItem1ComplexTypePub-278857744819003", "renditions": { "items": [] }, "links": [ { "href": "https://<hostname>/content/preview/api/v1.1/items/COREBE5441D25AF4449CA58430AC33587B74?channelToken=b1230e5b0e7f4e998d586391ca1647da", "rel": "self", "method": "GET", "mediaType": "application/json" } ], "id": "COREBE5441D25AF4449CA58430AC33587B74", "fileGroup": "contentItem", "fields": { "Text_single_1": "ZZZZZZ", "Number_1": 111, "Text_multi_1": [ "Aaa bbb ccc", "Ddd eee fff" ], "Decimal_1": 1.11, "Boolean_1": true }, "slug": "3000000010214-contentitem1complextypepub-278857744819003" }, { "description": "Complex item - 278897517017002", "language": "en-US", "updatedDate": { "value": "2021-10-28T11:18:34.754Z", "timezone": "UTC" }, "mimeType": "contentItem", "type": "278799601349002-testRecommendation-complexType", "typeCategory": "ContentType", "createdDate": { "value": "2021-10-28T11:18:20.214Z", "timezone": "UTC" }, "taxonomies": { "items": [] }, "name": "contentItem5ComplexTypePub-278897516976001", "renditions": { "items": [] }, "links": [ { "href": "https://<hostname>/content/preview/api/v1.1/items/CORE3E0B1C2E479B43E3A42A0955ED5A79DC?channelToken=b1230e5b0e7f4e998d586391ca1647da", "rel": "self", "method": "GET", "mediaType": "application/json" } ], "id": "CORE3E0B1C2E479B43E3A42A0955ED5A79DC", "fileGroup": "contentItem", "fields": { "Text_single_1": "Single value", "Number_1": 111, "Text_multi_1": [ "Aaa bbb ccc", "Ddd eee fff" ], "Decimal_1": 1.11, "Boolean_1": true }, "slug": "3000000010218-contentitem5complextypepub-278897516976001" } ], "links": [ { "href": "https://<hostname>/content/preview/api/v1.1/personalization/recommendationResults/.by.id/RECOF7E733CC021B4D968D9F9B25E7151F03?attribute.custom.attribute-ts-1=WillNeverMatch&channelToken=b1230e5b0e7f4e998d586391ca1647da&fields=all", "rel": "self", "method": "POST", "mediaType": "application/json" }, { "href": "https://<hostname>/content/preview/api/v1.1/personalization/recommendationResults/.by.id/RECOF7E733CC021B4D968D9F9B25E7151F03?attribute.custom.attribute-ts-1=WillNeverMatch&channelToken=b1230e5b0e7f4e998d586391ca1647da&fields=all", "rel": "canonical", "method": "POST", "mediaType": "application/json" }, { "href": "https://<hostname>/content/preview/api/v1.1/metadata-catalog/personalization/recommendationResults/.by.id/RECOF7E733CC021B4D968D9F9B25E7151F03?channelToken=b1230e5b0e7f4e998d586391ca1647da", "rel": "describedby", "method": "GET", "mediaType": "application/schema+json" }, { "href": "https://<hostname>/content/preview/api/v1.1/personalization/recommendationResults/.by.id/RECOF7E733CC021B4D968D9F9B25E7151F03?attribute.custom.attribute-ts-1=WillNeverMatch&channelToken=b1230e5b0e7f4e998d586391ca1647da&fields=all&offset=0", "rel": "first", "method": "POST", "mediaType": "application/json" }, { "href": "https://<hostname>/content/preview/api/v1.1/personalization/recommendationResults/.by.id/RECOF7E733CC021B4D968D9F9B25E7151F03?attribute.custom.attribute-ts-1=WillNeverMatch&channelToken=b1230e5b0e7f4e998d586391ca1647da&fields=all&offset=0", "rel": "last", "method": "POST", "mediaType": "application/json" } ] }
Example 3:
curl -X POST -H 'Accept: application/json' 'https://host:port/content/preview/api/v1.1/personalization/recommendationResults/.by.id/RECOG7E733CC021B4D968D9F9B25E7151F09?fields=all&channelToken=b1230e5b0e7f4e998d586391ca1647da'
This previews recommendation with id: RECOG7E733CC021B4D968D9F9B25E7151F09, channelToken: b1230e5b0e7f4e998d586391ca1647da. Audience attributes are provided in the body of the request which will match the rules.
Request Payload
{ "audienceAttributes": { "custom.attribute-bool-1": [ "Another single onezzz", "And this alsozzz" ], "custom.attribute-ts-1": [ "Another single one", "And this also" ] }, "assetState": "PREVIEW" },
Response Body
{ "hasMore": false, "offset": 0, "count": 2, "limit": 2, "totalResults": 2, "items": [ { "description": "Complex item - 278890853097008", "language": "en-US", "updatedDate": { "value": "2021-10-28T11:19:57.100Z", "timezone": "UTC" }, "mimeType": "contentItem", "type": "278799601349002-testRecommendation-complexType", "typeCategory": "ContentType", "createdDate": { "value": "2021-10-28T11:18:19.541Z", "timezone": "UTC" }, "taxonomies": { "items": [] }, "name": "contentItem3ComplexType-278890853059007", "renditions": { "items": [] }, "links": [ { "href": "https://<hostname>/content/preview/api/v1.1/items/CORE05B1B553E20B46DC8A1ACE333958BBB1?channelToken=b1230e5b0e7f4e998d586391ca1647da", "rel": "self", "method": "GET", "mediaType": "application/json" } ], "id": "CORE05B1B553E20B46DC8A1ACE333958BBB1", "fileGroup": "contentItem", "fields": { "Text_single_1": "Another single one", "Number_1": 222, "Text_multi_1": [ "Ggg hhh iii", "Jjj kkk lll" ], "Decimal_1": 2.22, "Boolean_1": false }, "slug": "3000000010216-contentitem3complextype-278890853059007" }, { "description": "Complex item - 278894031582000", "language": "en-US", "updatedDate": { "value": "2021-10-28T11:19:57.750Z", "timezone": "UTC" }, "mimeType": "contentItem", "type": "278799601349002-testRecommendation-complexType", "typeCategory": "ContentType", "createdDate": { "value": "2021-10-28T11:18:19.885Z", "timezone": "UTC" }, "taxonomies": { "items": [] }, "name": "contentItem4ComplexTypePub-278894031536009", "renditions": { "items": [] }, "links": [ { "href": "https://<hostname>/content/preview/api/v1.1/items/CORE9272086F9EC046F5879E6343F2933D15?channelToken=b1230e5b0e7f4e998d586391ca1647da", "rel": "self", "method": "GET", "mediaType": "application/json" } ], "id": "CORE9272086F9EC046F5879E6343F2933D15", "fileGroup": "contentItem", "fields": { "Text_single_1": "And this also", "Number_1": 333, "Text_multi_1": [ "Mmm nnn ooo", "Ppp qqq rrr" ], "Decimal_1": 3.33, "Boolean_1": false }, "slug": "3000000010217-contentitem4complextypepub-278894031536009" } ], "links": [ { "href": "https://<hostname>/content/preview/api/v1.1/personalization/recommendationResults/.by.id/RECOG7E733CC021B4D968D9F9B25E7151F09?fields=all&channelToken=b1230e5b0e7f4e998d586391ca1647da", "rel": "self", "method": "POST", "mediaType": "application/json" }, { "href": "https://<hostname>/content/preview/api/v1.1/personalization/recommendationResults/.by.id/RECOG7E733CC021B4D968D9F9B25E7151F09?fields=all&channelToken=b1230e5b0e7f4e998d586391ca1647da", "rel": "canonical", "method": "POST", "mediaType": "application/json" }, { "href": "https://<hostname>/content/preview/api/v1.1/metadata-catalog/personalization/recommendationResults/.by.id/RECOG7E733CC021B4D968D9F9B25E7151F09?channelToken=b1230e5b0e7f4e998d586391ca1647da", "rel": "describedby", "method": "GET", "mediaType": "application/schema+json" }, { "href": "https://<hostname>/content/preview/api/v1.1/personalization/recommendationResults/.by.id/RECOG7E733CC021B4D968D9F9B25E7151F09?fields=all&offset=0&channelToken=b1230e5b0e7f4e998d586391ca1647da", "rel": "first", "method": "POST", "mediaType": "application/json" }, { "href": "https://<hostname>/content/preview/api/v1.1/personalization/recommendationResults/.by.id/RECOG7E733CC021B4D968D9F9B25E7151F09?fields=all&offset=0&channelToken=b1230e5b0e7f4e998d586391ca1647da", "rel": "last", "method": "POST", "mediaType": "application/json" } ] } } ] }