Creating and deploying app configuration in Mix

Once you have built resources, you can create an app configuration containing specified resources from a project and deploy it to an environment.

This section describes how to create and deploy an app configuration in Mix as part of a Mix application. As mentioned previously, an app configuration contains built resources from a single Mix project. A Mix application can contain and make use of multiple app configurations.

An app configuration can be built and deployed using:

  • Mix dashboard
  • Mix.api
  • Mix.cli

Create and deploy app configuration using the dashboard

The Mix create and deploy applications document provides details on how to create and deploy an application configuration. For full details, you should consult this documentation.

Create and deploy app configuration using Mix.api

You can also create an app configuration using the Create an application configuration endpoint.

In the Create an application configuration endpoint, you can either:

  • Specify specific versions of built resources
  • Use the latest builds

In both cases, you need to specify an applicationId as a path parameter.

To obtain the applicationId:

  1. Obtain the orgId with the Get organizations endpoint.
  2. Using the orgId and Mix appId, obtain the applicationId with the with the Get list of Mix applications for an organization endpoint.

In both cases, you will also need to specify a deploymentFlowId in the request body. You can retrieve this from the Get organization deployment flows endpoint.

You will also need to have Authorized with Mix using your client ID and client secret to obtain a token to access Mix.api.

The authorization token needs to be included in the header of the Mix.api call.

Other details will depend on how you want to specify the project resources to include in the app configuration.

Specify specific versions of built resources

If you want to use specific versions of the built resources, you do not need to specify any query parameters. The resource versions are specified in the request body by buildLabel.

Reference the build by buildLabel

A specific version of a built resource, whether DLM, NLU model, or Dialog model, is identified in Mix.api by a buildLabel. A buildLabel is a string with the following pattern:

service_projectId_buildVersion

Where:

  • service is one of ASR, NLU, or DIALOG
  • projectId is the ID of the project for which the builds were created
  • buildVersion is the version of the build

You can use the Get builds or Get latest builds endpoints to view information, including buildLabel, about all builds or about the latest builds for each service specifically.

Use the latest builds

If you want to instead simply use the latest builds of the required services, use the useLatestFromProject query parameter, with the Mix project ID as the value. Also include the buildTypes query parameter, with any of ASR, NLU, and/or Dialog used as values.

When the useLatestFromProject parameter is specified, any builds referenced in the request body will be ignored.

Create app configuration with Mix.api code example

Here are a few generic examples of calls to the endpoint using curl.

This example shows using the latest DLM and NLU model builds from the project:

curl -X 'POST' \
  'https://mix.api.nuance.com/v4/apps/$APPLICATIONID/app-configs?useLatestFromProject=$PROJECTID&buildTypes=NLU&buildTypes=ASR' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'authorization: Bearer $TOKEN' \
  -d '{
  "dataHosts": [
    {
      "id": "string",
      "alias": "string",
      "environmentId": "string",
      "environmentGeographyId": "string",
      "value": "string"
    }
  ],
  "deploymentFlowId": "string",
  "tag": "string",
  "requestBuilds": {
    "asr": [
      {
        "buildLabel": "string",
        "locale": "string"
      }
    ],
    "nlu": [
      {
        "buildLabel": "string",
        "locale": "string"
      }
    ]
  }
}'

This example shows using specified versions of the DLM and NLU model from the project:

curl -X 'POST' \
  'https://mix.api.nuance.com/v4/apps/$APPLICATIONID/app-configs' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'authorization: Bearer $TOKEN' \
  -d '{
  "dataHosts": [
    {
      "id": "string",
      "alias": "string",
      "environmentId": "string",
      "environmentGeographyId": "string",
      "value": "string"
    }
  ],
  "deploymentFlowId": "string",
  "tag": "string",
  "requestBuilds": {
    "asr": [
      {
        "buildLabel": "ASR_$PROJECTID_2",
        "locale": "eng-USA"
      }
    ],
    "nlu": [
      {
        "buildLabel": "NLU_$PROJECTID_3",
        "locale": "end-USA"
      }
    ]
  }
}'

Create and deploy app configuration using Mix.cli

The mix app-configs:create command  is used to create an app configuration from the latest builds of the specified types using Mix.cli.

You need to have configured Mix.cli and obtained an access token previously.

You need to specify:

  • A deploymemt flow ID
  • An application ID
  • A project ID
  • A unique context tag

The application ID can be looked up using the mix applications:list command. The deployment flow ID can be looked up using the mix deployment-flows:list command. For both you will need the organization ID, which you can look up using the mix organizations:list command.

DLM and NLU model build Mix.cli code example

Here is an example of a call using Mix.cli. This creates and deploys an app configuration for the specified application to the specified deployment flow. The app configuration includes the latest NLU model and DLM builds.

mix app-configs:create -D $DEPLOYID -M $APPLICATIONID -P $PROJECTID -T $CONTEXTTAG --with-build-type nlu --with-build-type asr