Skip to main content

Digging Deeper into the DX Engine

Now that you have familiarized yourself with the sandbox environment, you are ready to do a deeper dive into the DX Engine. So far, you have worked with DX Engine Component Types that are pre-built such Contentful and Commercetools and you have configured them. In this tutorial, we are going to use Conscia's Universal API Connector to fetch and orchestrate data and content. This will show you how the DX Engine allows you to connect to any backend system and perform a read or write.

Specifically, we'll be reading movie and actor data along with users' genre preferences from a RESTful webservice.

By the end of this quickstart, you will understand:

  • How to use the Universal API Connector Component
  • How the DX Engine performs orchestration without writing and building code
  • How to use Context to pass in real-time information
  • How to group Components into a Template

The movie data source

Endpoints

The following table outlines how to interact with the webservice.

EndpointDescription
GET https://sample-data.conscia.ai/api/collections/collection-movie?_limit=10Fetch a list of 10 movies.
GET https://sample-data.conscia.ai/api/collections/collection-actor?_limit=5Fetch a list of 5 actors.
GET https://sample-data.conscia.ai/api/collections/collection-movie?_limit=10&_id=tt8254452Fetch a specific movie by its ID.
GET https://sample-data.conscia.ai/api/collections/collection-movie?_limit=10&_id[]=tt8254452&_id[]=tt8255690Fetch multiple movies using IDs.
GET https://sample-data.conscia.ai/api/collections/collection-movie?_limit=10&_query=primaryTitle:loveSearch for movies with a specific keyword in the title.
GET https://sample-data.conscia.ai/api/collections/collection-movie?_limit=10&_query=genres:horrorSearch for movies with a specific genre.
GET https://sample-data.conscia.ai/api/collections/collection-user?_limit=5Fetch a list of 5 users.
GET https://sample-data.conscia.ai/api/collections/collection-user?_id=tony@iron.comFetch a specific user.
GET https://sample-data.conscia.ai/api/collections/collection-user?_query=favouriteGenre:horrorFetch users who prefer horror.

Record Structures

Movie

{
"id": "tt8254452",
"titleType": "movie",
"primaryTitle": "The Marvin Case",
"originalTitle": "The Marvin Case",
"startYear": 2018,
"runtimeMinutes": 70,
"isAdult": false,
"genres": [
"comedy"
],
"directors": [
"nm3778312"
],
"writers": [
"nm3778312"
],
"actors": [
"nm1175179",
"nm6339953",
"nm4268373",
"nm3799576",
"nm6201108",
"nm4969745",
"nm1260396",
"nm1458739"
]
}

Actor

{
"id": "nm0990876",
"primaryName": "Daniel Chaia",
"birthYear": null,
"deathYear": null,
"primaryProfession": [
"assistant_director",
"writer",
"actor"
]
}

Users

{
"id": "tony@marvel.com",
"favouriteGenre": "comedy"
}

Setting up a connection to the Sample Data Webservice

First we will create a "connection" to the webservice we're going to call.

  • Navigate to the Connections page (Settings --> Connections).
  • Click the Configure Connection button
  • Enter the following and click Submit:
FieldValue
Connection Codesample-data-connection
Connection NameConscia Sample Data Connection
ConnectorUniversal API Connector
Base URLGet value from: Literal
https://sample-data.conscia.ai/api
Path
Method
Base Headers
Base Query Parameters
Base Body

Fetching movies

We will setup a Component to fetch movies with a hardcoded limit of 5.

  • Navigate to the Experience Components page (Manage Experiences --> Experience Components).
  • Click the Create Experience Component button
  • Enter the following and click Submit:
FieldValue
Component Codemovies
Component NameMovies
No RulesChecked
Component TypeConscia - Universal API Connector

The DX Engine will create and prepare the Component for further configuration. You should see the Movies component appear in the Component Grid.

  • Right-click on it and click Update.
  • Enter the following and click Submit
FieldForm TabValueDescription
Trigger ExpressionConditionstrue
Validity ExpressionConditionstrue
ConnectionMainConscia Sample Data Connection
Webservice PathMainGet value from: Literal
/collections/collection-movie
MethodMainGET
HeadersMainHeader: content-type

Value:
Get value from: Literal
application/json
Under Headers, click Add another item in order to add a header.
Under Get value from..., select Specified value in order to enter a value manually.

Selecting Context Field or Expression would allow this value to be calculated and/or specified at query-time instead of setup time.
Query ParametersMainParameter: _limit

Value:
Get value from: Literal
5
Under Query Parameters, click Add another item in order to add a query parameter.

Now that the Component has been fully configured, let's query the DX Engine to see the results so far.

POST {{engineUrl}}/experience/components/_query
X-Customer-Code: {{customerCode}}
Authorization: Bearer {{dxEngineToken}}

{
"componentCodes": ["movies"],
"context": {}
}

The results will look like this:

{
"duration": 585,
"components": {
"movies": {
"status": "VALID",
"response": [
{
"id": "tt8246150",
"titleType": "movie",
"primaryTitle": "Knife Blood Pt.2",
"originalTitle": "Knife Blood Pt.2",
"startYear": 2018,
"runtimeMinutes": -1,
"isAdult": false,
"genres": [
"horror"
],
"directors": [
"nm6984708"
],
"writers": [],
"actors": [
"nm6787892",
"nm4342385",
"nm4088112",
"nm6545691",
"nm4044554"
]
},
{
"id": "tt8250078",
"titleType": "movie",
"primaryTitle": "Sink",
"originalTitle": "Sink",
"startYear": 2018,
"runtimeMinutes": 7,
"isAdult": false,
"genres": [
"drama"
],
"directors": [
"nm9757557"
],
"writers": [
"nm8337244"
],
"actors": [
"nm0692305",
"nm5073992",
"nm0936087",
"nm9757554",
"nm9757555"
]
},
{
"id": "tt8251336",
"titleType": "movie",
"primaryTitle": "No One Will Ever Know",
"originalTitle": "Nadie sabrá nunca",
"startYear": 2018,
"runtimeMinutes": 102,
"isAdult": false,
"genres": [
"drama"
],
"directors": [
"nm2571065"
],
"writers": [
"nm2571065"
],
"actors": [
"nm2578315",
"nm2784856",
"nm1173803",
"nm0709204"
]
},
{
"id": "tt8252898",
"titleType": "movie",
"primaryTitle": "The Man in the Mask",
"originalTitle": "The Man in the Mask",
"startYear": 2018,
"runtimeMinutes": -1,
"isAdult": false,
"genres": [
"documentary"
],
"directors": [
"nm3691317",
"nm5692167"
],
"writers": [
"nm3691317",
"nm5692167"
],
"actors": []
},
{
"id": "tt8254452",
"titleType": "movie",
"primaryTitle": "The Marvin Case",
"originalTitle": "The Marvin Case",
"startYear": 2018,
"runtimeMinutes": 70,
"isAdult": false,
"genres": [
"comedy"
],
"directors": [
"nm3778312"
],
"writers": [
"nm3778312"
],
"actors": [
"nm1175179",
"nm6339953",
"nm4268373",
"nm3799576",
"nm6201108",
"nm4969745",
"nm1260396",
"nm1458739"
]
}
]
}
}
}

The top-level property components will be an object with one child property for each configured Component. Each Component's property will contain: status, response and error (if an error was encountered). The response property should contain 5 movie records.

Fetch movies with a hardcoded genre

Now we will filter the movies further by genre.

  • Right-click on the Movies component and click Update.
  • Enter the following and click Submit
FieldForm TabValueDescription
Query ParametersMainParameter: _query

Value:
Get value from: Literal
genres:horror
Under Query Parameters, click Add another item in order to add a query parameter.

Query the DX Engine to see the results.

POST {{engineUrl}}/experience/components/_query
X-Customer-Code: {{customerCode}}
Authorization: Bearer {{dxEngineToken}}

{
"componentCodes": ["movies"],
"context": {}
}

The returned movies should now be all horror movies.

Fetch movies with a genre specified at query-time

Instead of hard-coding the genre, we will allow the genre to be sent at query-time using the context in the body of every DX Engine request.

  • Right-click on the Movies component and click Update.
  • Enter the following and click Submit
FieldForm TabValueDescription
Query ParametersMainParameter:
_query

Value:
Get value from: JS Expression
'genres:' + contextField('genre')
Since this is a JS Expression, the engine will evaluate the specified expression at query-time. The contextField function in the expression informs the engine to grab the value from the context field called genre and append it the string genres:.

Query the DX Engine with a context that specifies genre = comedy to see the results.

POST {{engineUrl}}/experience/components/_query
X-Customer-Code: {{customerCode}}
Authorization: Bearer {{dxEngineToken}}

{
"componentCodes": ["movies"],
"context": {
"genre": "comedy"
}
}

You should see 5 comedy move records returns. Try this different genres such as: drama, short, western...

Fetch a user

Setup a Context Field to hold a user id.

  • Navigate to the Context Fields page (Settings --> Context Fields).
  • Click the Create Context Field button
  • Enter the following and click Submit:
FieldValue
Context Field NameuserId
Display Name NameUser ID
Data TypeString

We will setup a Component to fetch a user based on a user id.

  • Navigate to the Experience Components page (Manage Experiences --> Experience Components).
  • Click the Create Experience Component button
  • Enter the following and click Submit:
FieldValue
Component Codeuser
Component NameUser
No RulesChecked
Component TypeConscia - Universal API Connector

The DX Engine will create and prepare the Component for further configuration. You should see the 'User' Component appear in the Component Grid.

  • Right-click on it and click Update.
  • Enter the following and click Submit
FieldForm TabValueDescription
Trigger ExpressionConditionstrue
Validity ExpressionValidationtrue
ConnectionMainConscia Sample Data Connection
Webservice PathMain/collections/collection-user
MethodMainGET
HeadersMainHeader:
content-type

Value:
Get value from: Literal
application/json
Under Headers, click Add another item in order to add a header. Under Get value from..., select Specified value in order to enter a value manually. Selecting Context Field or Expression would allow this value to be calculated and/or specified at query-time instead of setup time.
Query ParametersMainParameter:
_id

Value (Context Field):
User ID
Under Query Parameters, click Add another item in order to add a query parameter.

Let's query the DX Engine to fetch a user with the ID pepper@iron.com.

POST {{engineUrl}}/experience/components/_query
X-Customer-Code: {{customerCode}}
Authorization: Bearer {{dxEngineToken}}

{
"componentCodes": ["user"],
"context": {
"userId": "pepper@iron.com"
}
}

The result should look like this:

{
"duration": 531,
"components": {
"user": {
"status": "VALID",
"response": [
{
"id": "pepper@iron.com",
"favouriteGenre": "horror"
}
]
}
}
}

Querying for multiple components

Let's say we would like to get the results of both the movies and user Component using one query. There are two methods to query multiple components with one request.

Submitting a Component Query with a list of components

POST {{engineUrl}}/experience/components/_query
X-Customer-Code: {{customerCode}}
Authorization: Bearer {{dxEngineToken}}

{
"componentCodes": ["user", "movies"],
"context": {
"userId": "pepper@iron.com",
"genre": "drama"
}
}

The reponse will look this:

{
"duration": 198,
"components": {
"user": {
"status": "VALID",
"response": [
{
"id": "pepper@iron.com",
"favouriteGenre": "horror"
}
]
},
"movies": {
"status": "VALID",
"response": [
{
"id": "tt8250078",
"titleType": "movie",
"primaryTitle": "Sink",
"originalTitle": "Sink",
"startYear": 2018,
"runtimeMinutes": 7,
"isAdult": false,
"genres": [
"drama"
],
"directors": [
"nm9757557"
],
"writers": [
"nm8337244"
],
"actors": [
"nm0692305",
"nm5073992",
"nm0936087",
"nm9757554",
"nm9757555"
]
},
{
"id": "tt8251336",
"titleType": "movie",
"primaryTitle": "No One Will Ever Know",
"originalTitle": "Nadie sabrá nunca",
"startYear": 2018,
"runtimeMinutes": 102,
"isAdult": false,
"genres": [
"drama"
],
"directors": [
"nm2571065"
],
"writers": [
"nm2571065"
],
"actors": [
"nm2578315",
"nm2784856",
"nm1173803",
"nm0709204"
]
},
{
"id": "tt8254556",
"titleType": "movie",
"primaryTitle": "Girl",
"originalTitle": "Girl",
"startYear": 2018,
"runtimeMinutes": 109,
"isAdult": false,
"genres": [
"drama"
],
"directors": [
"nm4080113"
],
"writers": [
"nm4080113",
"nm3899543"
],
"actors": [
"nm9760132",
"nm3581007",
"nm9854120",
"nm7904438"
]
},
{
"id": "tt8257434",
"titleType": "movie",
"primaryTitle": "Kaaneen: A Secret Search",
"originalTitle": "Kaaneen: A Secret Search",
"startYear": 2018,
"runtimeMinutes": 135,
"isAdult": false,
"genres": [
"drama"
],
"directors": [
"nm9761042",
"nm8646148"
],
"writers": [],
"actors": []
},
{
"id": "tt8235296",
"titleType": "movie",
"primaryTitle": "The Trump Prophecy",
"originalTitle": "The Trump Prophecy",
"startYear": 2018,
"runtimeMinutes": 120,
"isAdult": false,
"genres": [
"drama"
],
"directors": [
"nm0776398"
],
"writers": [
"nm9444786",
"nm1205833",
"nm2052673",
"nm9444787"
],
"actors": [
"nm8985653",
"nm1690749",
"nm1982532",
"nm1546204"
]
}
]
}
}
}

Submitting a Template query

A Template is nothing more than a set of Components that you wish to group together in a response. A Component may belong to zero, one or more Templates. Let's create a Template that will contain the movies and user components.

  • Navigate to the Templates page (Manage Experiences --> Templates).
  • Click the Configure Experience Template button.
  • Enter the following and click Submit:
FieldValue
Experience Template Codewelcome
NameWelcome Payload
Experience ComponentsMovies, User

Now we will query the template we've just created.

POST {{engineUrl}}/experience/template/_query
X-Customer-Code: {{customerCode}}
Authorization: Bearer {{dxEngineToken}}

{
"templateCode": ["welcome"],
"context": {
"userId": "pepper@iron.com",
"genre": "drama"
}
}

The above query will respond with the same payload as the component query.

Using a user's favourite genre to filter the movie list

Instead of manually specifying the genre in the context, we will:

  • Only specify a user
  • Use the user's favourite genre to filter the movies

There are two different approaches to achieve this:

  • Context Field Enrichment: Configuring the user component to update the context with genre.
  • Component response expression: Configuring the movies component to pull genre directly from the user component's response

Context Field Enrichment

Context Enrichment is the process of using an expression to evaluate a component's response and writing that evaluated expression to the context. In this case, we will take the response of user component and use the favouriteGenre property to populate the genre context field.

Since the movie component refers to the genre context field and the user component will populate that same context field, the DX Engine sets up a dependency between the user and movies components. Specifically, it will process the user component before the movie component to ensure that the genre context field is set.

Let's update the user component so that it will set the genre context field to the fetched user's favourite genre.

  • Navigate to the Experience Components page (Manage Experiences --> Experience Components).
  • Right-click the user component and click Update.
  • Enter the following and click Submit:
FieldForm TabValueDescription
Context Field EnrichmentsUpdate ContextContext Field: genre
Expression: response[0].favouriteGenre
Click Add another item
note

By enriching the genre context field, you could now configure other components to refer to genre as part of their query. Those components could also further enrich the context and so on. This allows for extreme flexibility by allowing for unlimited dependencies between components.

Let's query the movies component along with a userId since we know that the user component will be processed by the engine first and it requires the userId context field.

POST {{engineUrl}}/experience/components/_query
X-Customer-Code: {{customerCode}}
Authorization: Bearer {{dxEngineToken}}

{
"componentCodes": ["movies"],
"context": {
"userId": "pepper@iron.com"
}
}

The response will look like this:

{
"duration": 266,
"components": {
"movies": {
"status": "VALID",
"response": [
{
"id": "tt8246150",
"titleType": "movie",
"primaryTitle": "Knife Blood Pt.2",
"originalTitle": "Knife Blood Pt.2",
"startYear": 2018,
"runtimeMinutes": -1,
"isAdult": false,
"genres": [
"horror"
],
"directors": [
"nm6984708"
],
"writers": [],
"actors": [
"nm6787892",
"nm4342385",
"nm4088112",
"nm6545691",
"nm4044554"
]
},
{
"id": "tt8281642",
"titleType": "movie",
"primaryTitle": "Sirf 5 Din",
"originalTitle": "Sirf 5 Din",
"startYear": 2018,
"runtimeMinutes": 145,
"isAdult": false,
"genres": [
"horror"
],
"directors": [
"nm1150018"
],
"writers": [
"nm1150018"
],
"actors": [
"nm0044796",
"nm2735302",
"nm2977124",
"nm6389513",
"nm4542765",
"nm3056569"
]
},
{
"id": "tt8289960",
"titleType": "movie",
"primaryTitle": "My Dead Selfie",
"originalTitle": "My Dead Selfie",
"startYear": 2018,
"runtimeMinutes": 97,
"isAdult": false,
"genres": [
"horror"
],
"directors": [
"nm0788309"
],
"writers": [
"nm0788309"
],
"actors": [
"nm3916819",
"nm2201671",
"nm6167779",
"nm5615091"
]
},
{
"id": "tt8083382",
"titleType": "movie",
"primaryTitle": "Tales from Beyond",
"originalTitle": "Tales from Beyond",
"startYear": 2018,
"runtimeMinutes": -1,
"isAdult": false,
"genres": [
"horror"
],
"directors": [
"nm2552518"
],
"writers": [
"nm2552518"
],
"actors": [
"nm1641229",
"nm6232442",
"nm7951387",
"nm6014899"
]
},
{
"id": "tt8063826",
"titleType": "movie",
"primaryTitle": "The Watcher",
"originalTitle": "The Watcher",
"startYear": 2018,
"runtimeMinutes": 97,
"isAdult": false,
"genres": [
"horror"
],
"directors": [
"nm8448178"
],
"writers": [
"nm8448178"
],
"actors": [
"nm5032640",
"nm2467058",
"nm7961808",
"nm9695331"
]
}
]
}
}
}

We can see that since pepper@iron.com has a favourite genre of horror, the response will only contain horror movies. Try querying with shuri@panther.com as the userId. Apparently she likes comedy, so we should see a list of comedy movies.

Component response expression

Instead of enriching the context, we can update the movies component as follows:

  • Right-click the movies component and click Update.
  • Enter the following and click Submit:
FieldForm TabValue
Query ParametersMainParameter:
_query

Value (JS Expression):
'genres:' + componentResponse('user')[0].favouriteGenre

We have used the componentResponse function in the above expression to refer directly to the output the user component.

Submitting the following query will return the same response as the query used above (using context field enrichment).

POST {{engineUrl}}/experience/components/_query
X-Customer-Code: {{customerCode}}
Authorization: Bearer {{dxEngineToken}}

{
"componentCodes": ["movies"],
"context": {
"userId": "pepper@iron.com"
}
}

Working with errors

  • Right-click the movies component and click Update.
  • Enter the following and click Submit:
FieldForm TabValue
Query ParametersMainParameter:
_query

Value (JS Expression):
'genres:' + componentResponse('user')[1].favouriteGenre

The above expression is referencing the second element in an array (from the user component's response) with only one element.

Querying the movies component will result in this:

{
"duration": 302,
"components": {
"movies": {
"error": "Cannot read properties of undefined (reading 'favouriteGenre')",
"status": "FAILED"
}
}
}

Let's correct the above expression

  • Right-click the movies component and click Update.
  • Enter the following and click Submit:
FieldForm TabValue
Query ParametersMainParameter:
_query

Value (JS Expression):
'genres:' + componentResponse('user')[0].favouriteGenre

Now we'll query with an unknown userId (unknown@unknown.com) and we will also ask to return the user component response:

POST {{engineUrl}}/experience/components/_query
X-Customer-Code: {{customerCode}}
Authorization: Bearer {{dxEngineToken}}

{
"componentCodes": ["movies", "user"],
"context": {
"userId": "unknown@unknown.com"
}
}

The response is:

{
"duration": 345,
"components": {
"user": {
"status": "VALID",
"response": []
},
"movies": {
"error": "Cannot read properties of undefined (reading 'favouriteGenre')",
"status": "FAILED"
}
}
}

We get this error since componentResponse('user')[0].favouriteGenre refers to an empty array. You can choose to handle this response in your client logic. Or perhaps you would like to explicitly mark the user component as INVALID since its response is, clearly, not what you expected (you expect an array of one element).

  • Right-click the user component and click Update.
  • Enter the following and click Submit:
FieldForm TabValue
Validity ExpressionValidittionresponse.length == 1

Rerunning the query above will now yield:

{
"duration": 190,
"components": {
"user": {
"status": "INVALID",
"response": []
},
"movies": {
"error": "Cannot read properties of undefined (reading 'favouriteGenre')",
"status": "FAILED"
}
}
}

The DX Engine has now explicitly informed us that the user component is in an invalid state. Any component that is dependent upon the user component can choose to skip its execution if it has a dependency that is INVALID (or SKIPPED or FAILED).

Let's configure the movies component to skip its execution if it has a dependency (in this case, the user component) that is invalid.

  • Right-click the movies component and click Update.
  • Enter the following and click Submit:
FieldForm TabValue
Skip on Invalid DependencyConditionstrue

The response will now look like:

{
"duration": 344,
"components": {
"user": {
"status": "INVALID",
"response": []
},
"movies": {
"status": "SKIPPED"
}
}
}

Querying with a valid userId:

POST {{engineUrl}}/experience/components/_query
X-Customer-Code: {{customerCode}}
Authorization: Bearer {{dxEngineToken}}

{
"componentCodes": ["movies", "user"],
"context": {
"userId": "pepper@iron.com"
}
}

will result in a valid component response for user and movies .

Fetch a list of actors using a specified list of actor IDs

Setup a Context Field to hold a actor ids.

  • Navigate to the Context Fields page (Settings --> Context Fields).
  • Click the Create Context Field button
  • Enter the following and click Submit:
FieldValue
Context Field NameactorIds
Display Name NameActor IDs
Data TypeString

We will setup a component to fetch actors using a context fields of actorIds.

  • Navigate to the Experience Components page (Manage Experiences --> Experience Components).
  • Click the Create Experience Component button
  • Enter the following and click Submit:
FieldValue
Component Codeactors
Component NameActors
No RulesChecked
Component TypeConscia - Universal API Connector

The DX Engine will create and prepare the component for further configuration. You should see the Actors component appear in the Component Grid.

  • Right-click on it and click Update.
  • Enter the following and click Submit
FieldForm TabValueDescription
Trigger ExpressionConditionstrue
Validity ExpressionValidationtrue
ConnectionMainConscia Sample Data Connection
Webservice PathMain/collections/collection-actor
MethodMainGET
HeadersMainHeader:
content-type

Value (Literal):
application/json
Under Headers, click Add another item in order to add a header. Under Get value from..., select Specified value in order to enter a value manually. Selecting Context Field or Expression would allow this value to be calculated and/or specified at query-time instead of setup time.
Query ParametersMainParameter:
_id

Value (Context Field):
Actor IDs
Under Query Parameters, click Add another item in order to add a query parameter.
Query Parameter OptionsMainArrayForma: bracketThis allows the _id to be restructured in bracket format. With Array Format set to bracket, if actorIds = ['a', 'b', 'c'], the webservice query string will be formatted as _id[]=a&_id[]=b&_id[]=c.

Let's query the actors component:

POST {{engineUrl}}/experience/components/_query
X-Customer-Code: {{customerCode}}
Authorization: Bearer {{dxEngineToken}}

{
"componentCodes": ["actors"],
"context": {
"actorIds": ["nm0000206", "nm0000098"]
}
}

The results will look like this:

{
"duration": 378,
"components": {
"actors": {
"status": "VALID",
"response": [
{
"id": "nm0000206",
"primaryName": "Keanu Reeves",
"birthYear": 1964,
"deathYear": null,
"primaryProfession": [
"actor",
"producer",
"soundtrack"
]
},
{
"id": "nm0000098",
"primaryName": "Jennifer Aniston",
"birthYear": 1969,
"deathYear": null,
"primaryProfession": [
"actress",
"producer",
"soundtrack"
]
}
]
}
}
}

Configure movies to use actors as a sub component

  • Right-click the movies component and click Update.
  • Enter the following and click Submit:
FieldValue
Sub ComponentsProperty Name = movieActors, Component Codes = actors, Context Field = actorIds, Expression = response.actors

For each movie record in the movies component response's array, the actors component will be processed with an updated context. In this case, each actor component will be processed with a context that will have a context field of actorIds with a value that is taken from the movie record's actors property.

We must explicitly instruct the DX Engine to process subcomponents like so:

POST {{engineUrl}}/experience/components/_query
X-Customer-Code: {{customerCode}}
Authorization: Bearer {{dxEngineToken}}

{
"componentCodes": [
"movies"
],
"context": {
"userId": "pepper@iron.com"
},
"processSubComponents": true
}

The response will look like:

{
"duration": 561,
"components": {
"movie": {
"status": "VALID",
"response": [
{
"id": "tt8246150",
"titleType": "movie",
"primaryTitle": "Knife Blood Pt.2",
"originalTitle": "Knife Blood Pt.2",
"startYear": 2018,
"runtimeMinutes": -1,
"isAdult": false,
"genres": [
"horror"
],
"directors": [
"nm6984708"
],
"writers": [],
"actors": [
"nm6787892",
"nm4342385",
"nm4088112",
"nm6545691",
"nm4044554"
],
"movieActors": {
"actors": {
"status": "VALID",
"response": [
{
"id": "nm4088112",
"primaryName": "Erin McShane",
"birthYear": null,
"deathYear": null,
"primaryProfession": [
"actress",
"sound_department",
"editor"
]
},
{
"id": "nm6787892",
"primaryName": "Alison Chang",
"birthYear": 1995,
"deathYear": null,
"primaryProfession": [
"actress",
"miscellaneous"
]
},
{
"id": "nm4342385",
"primaryName": "Tre Hall",
"birthYear": null,
"deathYear": null,
"primaryProfession": [
"actor",
"writer",
"miscellaneous"
]
},
{
"id": "nm6545691",
"primaryName": "Andrew Nunes Jr.",
"birthYear": 1993,
"deathYear": null,
"primaryProfession": [
"actor",
"director",
"writer"
]
},
{
"id": "nm4044554",
"primaryName": "Bennett Saltzman",
"birthYear": null,
"deathYear": null,
"primaryProfession": [
"actor",
"miscellaneous"
]
}
]
}
}
},
{
"id": "tt8281642",
"titleType": "movie",
"primaryTitle": "Sirf 5 Din",
"originalTitle": "Sirf 5 Din",
"startYear": 2018,
"runtimeMinutes": 145,
"isAdult": false,
"genres": [
"horror"
],
"directors": [
"nm1150018"
],
"writers": [
"nm1150018"
],
"actors": [
"nm0044796",
"nm2735302",
"nm2977124",
"nm6389513",
"nm4542765",
"nm3056569"
],
"movieActors": {
"actors": {
"status": "VALID",
"response": [
{
"id": "nm3056569",
"primaryName": "Rocky Verma",
"birthYear": 1969,
"deathYear": null,
"primaryProfession": [
"actor",
"stunts",
"casting_director"
]
},
{
"id": "nm4542765",
"primaryName": "Raju Thakkar",
"birthYear": null,
"deathYear": null,
"primaryProfession": [
"actor"
]
},
{
"id": "nm2977124",
"primaryName": "Mahie Gill",
"birthYear": null,
"deathYear": null,
"primaryProfession": [
"actress",
"producer"
]
},
{
"id": "nm0044796",
"primaryName": "Raj Babbar",
"birthYear": 1952,
"deathYear": null,
"primaryProfession": [
"actor",
"music_department"
]
},
{
"id": "nm2735302",
"primaryName": "Anuj Gill",
"birthYear": null,
"deathYear": null,
"primaryProfession": [
"actor",
"casting_director"
]
},
{
"id": "nm6389513",
"primaryName": "Suchhi Kumar",
"birthYear": null,
"deathYear": null,
"primaryProfession": [
"actor",
"producer",
"director"
]
}
]
}
}
},
{ ... },
{ ... },
{ ... }
]
}
}
}
note

This demonstrates nested orchestration (GraphQL-like dependencies)

Here are some advanced exercises for you to try with the DX Engine:

  • Remap the above JSON response from one Component to a cleaner response that is more consumable by your frontend.
note

You can take a look at the following tutorial here.