The Experience API
The Experience API
Now that you have seen how Channels, Templates, Components and Connections are configured in Conscia, let's query the DX Engine to see what the API response looks like. In this example, we'll run a query to request the Landing Page Template and pass 'customerSegment = traveler' as the user's real-time context.
To run the query, you can use the OpenAPI endpoint (https://docs.conscia.ai/api/dx-engine#tag--Experience-Engine), or feel free to use any other client of your choice.
Use the customer code that you were given for your sandbox as part of your queries and substitute the template code accordingly.
{
"templateCode": "landingPage",
"context": {
"customerSegment": "traveler",
"productCategory": 19
},
"debug": true
}
Here is the API response:
{
"duration": 804,
"components": {
"banner-contentstack": {
"response": [
{
"_version": 2,
"locale": "en-us",
"uid": "blt12ad65449abe6825",
"ACL": {},
"_in_progress": false,
"call_to_action": {
"title": "Learn More",
"href": "#"
},
"created_at": "2022-03-30T19:17:39.995Z",
"created_by": "blt573706c250004fc1",
"heading": "Great Outdoors",
"image_link": {
"title": "",
"href": "https://images.pexels.com/photos/32870/pexels-photo.jpg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260"
},
"subheading": "Enjoy the Great Outdoors",
"tags": [],
"title": "Great Outdoors",
"updated_at": "2022-03-30T19:17:45.491Z",
"updated_by": "blt573706c250004fc1",
"publish_details": {
"environment": "blt8f23432714f82d9b",
"locale": "en-us",
"time": "2022-04-05T02:46:17.664Z",
"user": "blt21250abb4c30c1a0"
}
}
]
},
"featured-blogs-contentful": {...},
"product-list-bigcommerce": {...}
}
}
As you can see in the above response, the various components that are defined as part of the template (banners, featured blogs, products) are returned. If we focus on a single Component within the overall response, specifically banners, you can see banner records are returned as part of the banner element of the payload.
Note that the DX Engine is truly headless, which means that it is not specific to any front-end. The response payload contains a block of JSON for each component that pulls the content model directly from the source system that it is connected to. Note that Conscia does not modify the JSON structure of the content returned from the source system in any way, unless the component is explicitly configured to do so.
The content returned for each component is tailored to the customer based on the trigger conditions met by the query, such as rule priority, active start/end date, and context fields.