Fetching Component and Template Definitions from the Conscia DX Engine

This blog post explains how you can fetch Component and Template definitions from the Conscia Digital Experience (DX) Engine using Conscia’s Webservice APIs. You can use this exported JSON to investigate Template and Component definitions offline, and you can store these definitions in a source code management system and even push them to other Conscia Environments using relevant Conscia Webservice APIs.

To invoke Conscia Webservice APIs, you must set the Authorization HTTP header to Bearer {Token}, replacing {Token} with a valid Conscia API token. You must also set the X-Customer-Code HTTP header to your Conscia customer identifier.

You always use GET to fetch template and component definitions.

Be sure to use the correct API endpoint:

To fetch all template definitions:

To fetch an individual template definition, replace {your-template-id} with your template’s identifier:

To fetch all component definitions:

To fetch an individual component definition, replace {your-component-id} with the component’s identifier:

You can use the following API to add or update Templates and Components in a Conscia Environment:

To specify an Environment for Conscia Webservice API calls, set the value of the X-Environment-Code HTTP header to the identifier associated with the Environment.

You can use the following API to export the configuration of an entire DX Engine Environment:

  • GET /api/raw-engine-config

You can use the following API to import an entire DX Engine Environment:

  • PUT /engine-config

With a JSON payload such as the following, where the engineConfig key holds a JSON value in the format returned by /api/raw-engine-config:

{
"engineConfig": {}
}

You can pass the ?preserveSecrets=true query string parameter to preserve secrets in the target Environment. If preserveSecrets is false, as by default, then importing an environment will overwrite its secrets.

To invoke a Conscia DX Engine Orchestration Template, replace my-template-id with the Template’s identifier:

POST /api/experience/template/_query  
{
"templateCode": "my-template-id",
"context": { }
}

To invoke one or more Conscia DX Engine Orchestration Components, replace my-component-code with the list of component identifiers:

POST /api/experience/components/_query  
{
"componentCodes": ["my-component-code"],
"context": { }
}
Visual Studio Code with Conscia DX Studio Environment JSON visible

Title Image credit: ChatGPT

One thought on “Fetching Component and Template Definitions from the Conscia DX Engine

Leave a comment