Querying the DX Engine
There are two types of queries that can be made to the DX Engine.
- Component Query
- Template Query
A Component Query looks like this:
POST {{engineUrl}}/experience/components/_query
X-Customer-Code: {{customerCode}}
Authorization: Bearer {{dxEngineToken}}
{
"componentCodes": ["movies", "actors"],
"context": {
"userId": "pepper@iron.com"
}
}
A Template Query looks like this:
POST {{engineUrl}}/experience/template/_query
X-Customer-Code: {{customerCode}}
Authorization: Bearer {{dxEngineToken}}
{
"templateCode": "welcome",
"context": {
"userId": "pepper@iron.com",
"genre": "drama"
}
}
A Template is nothing more than a defined list of Components. If the welcome
Template only included the movies
and actors
Components, the above two DX Engine queries would function exactly the same way.
The passed Context (sometimes referred to as the Request Context) is available to all Components (i.e. any expressions can refer to this Context). The DX Engine knows the dependencies amongst the requested Components. If a Component is requested, then the Component(s) upon which is depends, if any, will be executed as well.
Every request is logged with a unique Request ID which is availble in the header of every DX Engine response. That Request ID can be used later to get details of that request.
Webhooks will allow for the synchronous or asynchronous calling of your own webservices. The available webhooks will be:
- BeforeSync (allows for the modification of the context before processsing request)
- BeforeAsync
- AfterSync (allows for the modification of the result before responding to caller)
- AfterAsync