Fetch personalized HTML
Your server or app can easily retrieve content from Fresh Relevance for use on your site by making an HTTP GET request for each required piece of content. This can then be incorporated into the mobile app or web page. The content can be retrieved either in JSON format or in HTML format.
The HTML format can be merged into your page's markup where needed.
In JSON format, information such as the list of items in a recommendation block is returned. You could use these to drive other types of content on the webpage.
Learn more about key conceptsEnsure you have read and understood the Fresh Relevance Key Concepts as this is essential to understanding how the product and APIs work.
Struggling to get the correct URL to get a SlotTo find the specific URL for a Slot stored in your account:
- In Fresh Relevance, go to Content > Slots.
- Select the Web Personalization tab.
- Select the Slot you want, then select the Use icon.
- The URL to request that slot is shown under Feed URL.
Fetch content
Single Slot
You can fetch the content of a single Slot using the Content API and the Get Slot call
You need to replace:
-
Your content serving domain
with the correct domain.To find this, in Fresh Relevance, expand the User menu, then go to Settings > System configuration > Custom domains and copy the domain from the Content Serving URL field, for example, c8.dycdn.net
-
Your account id
with your account ID.To get your account ID from Fresh Relevance, expand the User menu and copy the Account ID value.
-
Slot id
with the ID of the Slot you want the content for. -
API token
with a Dynamic Content API token with read permission for content; you can find out how to create and edit API access tokens here. -
Required format
with one of the following options:
Format | Description |
---|---|
| Returns the SmartBlock selected by the Slot formatted as HTML. |
| Returns the SmartBlock selected by the Slot formatted as an image. |
| Returns open-time HTML. Note: Not needed for server-side personalization. |
| Returns everything as a JSON container, with HTML inside, plus metadata. |
| Returns everything as a JSON container, matching items inside items, plus metadata. Useful for Recommendations to return product IDs without the accompanying HTML. |
| Returns everything as a JSON container, with HTML inside, matching items inside items, plus metadata. |
Example format responses:
<table cellspacing="0" cellpadding="0" border="0" style="width: 600px;" align="center">
<tr>
<td class="imagecontainer" data-imageindex="0" style="border-radius: 0px;
padding: 0px;
text-align: center;
background-color: #ffffff;
">
<a href target="_blank" style="text-decoration: none;">
<img src="https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExcTVtbWpmZWZ2eHhjbndva2NsYXAyaHJ3c3Nnb3c3bWloYm96NnB6biZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/xTiN0CNHgoRf1Ha7CM/giphy.gif" alt="GIF">
</a>
</td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" style="width: 600px;" align="center">
<tr>
<td class="imagecontainer" data-imageindex="0" style="border-radius: 0px;
padding: 0px;
text-align: center;
background-color: #ffffff;
">
<a href="" target="_blank" style="text-decoration: none;">
<img src="https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExcTVtbWpmZWZ2eHhjbndva2NsYXAyaHJ3c3Nnb3c3bWloYm96NnB6biZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/xTiN0CNHgoRf1Ha7CM/giphy.gif" alt="GIF" />
</a>
</td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" style="width: 600px;" align="center">
<tr>
<td class="imagecontainer" data-imageindex="0" style="border-radius: 0px;
padding: 0px;
text-align: center;
background-color: #ffffff;
"><a class="fr__link-wrapper"
href="https://c8.dycdn.net/rg55bjkl/s/push2dd/?k=3ldtt4d&format=dynamiclink"><img src="https://c8.dycdn.net/rg55bjkl/s/push2dd/?k=3ldtt4d&format=dynamicimage"></a>
</td>
</tr>
</table>
{
"html": "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"width: 600px;\" align=\"center\">\n\n <tr>\n\n <td class=\"imagecontainer\" data-imageindex=\"0\" style=\"border-radius: 0px; \n padding: 0px;\n text-align: center;\n background-color: #ffffff;\n \">\n\n <a href target=\"_blank\" style=\"text-decoration: none;\">\n\n <img src=\"https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExcTVtbWpmZWZ2eHhjbndva2NsYXAyaHJ3c3Nnb3c3bWloYm96NnB6biZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/xTiN0CNHgoRf1Ha7CM/giphy.gif\" alt=\"GIF\">\n\n </a>\n\n </td>\n\n </tr>\n\n</table>",
"js": null,
"css": null,
"var": {
"tmclt": true
},
"meta": {
"tmsl": "push2dd",
"tmsb": "aa7u9zu",
"tmrl": "l0tt40i",
"tmcs": "iz2z0mg",
"tmcv": 0,
"tmty": "e",
"tmsn": "Test LS",
"products": []
}
}
{
"html": null,
"js": null,
"css": null,
"var": {},
"meta": {
"tmsl": "push2dd",
"tmsb": "aa7u9zu",
"tmrl": "l0tt40i",
"tmty": "e",
"tmsn": "Test LS"
},
"items": []
}
{
"html": "\n\n<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"width: 600px;\" align=\"center\">\n\n <tr>\n\n <td class=\"imagecontainer\" data-imageindex=\"0\" style=\"border-radius: 0px; \n padding: 0px;\n text-align: center;\n background-color: #ffffff;\n \">\n\n <a href=\"\" target=\"_blank\" style=\"text-decoration: none;\">\n\n <img src=\"https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExcTVtbWpmZWZ2eHhjbndva2NsYXAyaHJ3c3Nnb3c3bWloYm96NnB6biZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/xTiN0CNHgoRf1Ha7CM/giphy.gif\" alt=\"GIF\" />\n\n </a>\n\n </td>\n\n </tr>\n\n</table>\n",
"js": null,
"css": null,
"var": {},
"meta": {
"tmsl": "push2dd",
"tmsb": "aa7u9zu",
"tmrl": "l0tt40i",
"tmcs": "iz2z0mg",
"tmcv": 0,
"tmty": "e",
"tmsn": "Test LS",
"products": []
},
"items": []
}
Additional personalization parameters
This endpoint also supports personalization by including an identifier for the visitor in the query string parameters.
Any of the following optional query string parameters are supported:
Parameter | Description |
---|---|
e | The visitor's email address. |
d | An identifier for a device the visitor used to visit your website. The device ID is a cookie value that is generated by our script on your website. This is stored in the |
cid | The visitor's customer ID. This only works if this value is known to Fresh Relevance already. Learn more inImport person data. |
If you're using filters to return relevant content based on the specific site, then you may also need to pass through additional parameters, such as:
Parameter | Description |
---|---|
prid | Unique product identifier, for example 12345. |
sbr | Site Brand/Territory for the product , for example, DEMO. |
curr | Currency - ISO 4217 currency code, for example, USD. |
Examples
Fetch HTML content for server-side merging
https://c8.dycdn.net/abcdefg1/s/push2dd/?k=z321xx4d&format=html
Fetch JSON content for server-side processing
https://c8.dycdn.net/abcdefg1/s/push2dd/?k=z321xx4d&format=full
Fetch JSON content for server-side processing with additional personalization
https://c8.dycdn.net/abcdefg1/s/push2dd/?k=z321xx4d&format=full&[email protected]
Multi Slots
For websites and apps doing large-scale personalization, we have the Retrieve multiple Slots call in the Content API. It fetches several Slots at once, which results in fewer round-trips from the server and is, therefore, faster.
We recommend this approach for performance.
Updated about 1 month ago