Compose the API request for a web experience
When you compose the API request, you must enter the parameters that your organization's website requires in order to correctly display the content. You can copy and paste dynamic data from the web experience response into the API request. This is required if you want to use any parameters in the API request that are requested by the dependent website, such as "uri", "region", and "pointOfSale".
You can also include the content returned by a decision model in the API request.
To do this, you must configure the variant to include the dynamic data so that when the variant executes, the server requests the dynamic data and passes it to your organization's website.
To compose the API request for a web experience:
-
In the code editor, click the API tab.
-
Compose the API request using FreeMarker.
TipYou can copy and paste dynamic data from the guest data model and decision model response, as required.
-
You must then reference this data again by pasting it into the relevant HTML, CSS, or JavaScript editor.
-
Click Save.
-
Click
to close the code editor.
If you use an out-of-the-box web template, or if you have copied the JavaScript from such a template, you must reference an attribute from the API response within a context object. For example, to include in the CSS an imageURL from the API response, reference it as follows:
background-image: url(“{{context.imageURL}}”)