Deploying to decision runtime with REST API

You can deploy decision service archives by using the runtime REST API.

Before you begin

For more information about the runtime REST API methods that are mentioned in the procedure, see the Decision runtime REST API reference in Reference.

Procedure

  1. Deploy a decision service archive by using the following runtime REST API method:
    POST https://<server>:<port>/ads/runtime/api/v1/deploymentSpaces/{deploymentSpaceId}/decisions/{decisionId}/archive
    • <server> is the hostname of the decision runtime, which is specified in the decision_runtime.ingress.hostname parameter.
    • <port> is the port of the decision runtime.
    For example, you can use a cURL command:
    curl -i -X 'POST' \
    'https://<server>:<port>/ads/runtime/api/v1/deploymentSpaces/{deploymentSpaceId}/decisions/{decisionId}/archive' \
    -H 'accept: */*' \
    -H 'Content-Type: application/octet-stream' \
    -H 'Authorization: ZenApiKey <base64(zen_user_id:zen_api_key)>' \
    --data-binary "@/path/to/archive.jar"
  2. Get the custom metadata by using the runtime REST API:
     curl -X 'GET' \ https://localhost:9443/abp/ads/runtime/api/v1/deploymentSpaces/test/decisions/test/metadata' \ -H 'accept: application/json' \
    
    -H 'Authorization: ZenApiKey \<base64(zen_user_id:zen_api_key)>' > /path/to/metadata.json Update the custom metadata in /path/to/metadata.json 
    Example of /path/to/metadata.json:
    {
      "map": {
          "metadata_1": {
          "kind": "{PLAIN|ENCRYPTED}",
          "readOnly": true|false,
          "value": "string_1"
        },
        ...,
        "metadata_N": {
          "kind": "{PLAIN|ENCRYPTED}",
          "readOnly": true|false,
          "value": "string_N"
        }
      }
    }

    The custom metadata is metadata that does not exist in the decision service archive. The decision service metadata is not mutable.

    For more information about the decision service metadata, see Decision service metadata.

  3. Modify the metadata in /path/to/metadata.json.
  4. Publish the new set of metadata by using the following runtime REST API method:
    curl -X 'PUT' \
    'https://<server>:<port>/ads/runtime/api/v1/deploymentSpaces/{deploymentSpaceId}/decisions/{decisionId}/metadata' \
    -H 'accept: */*' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: ZenApiKey <base64(zen_user_id:zen_api_key)>' \
    -d '@/path/to/metadata.json'
    
    Note:

    By default, deploying a decision service archive is prevented if both values of decisionServiceId and decisionServiceVersion in the decision service archive already exist in the target deploymentSpaceId (response code: 409).

    However, you can exceptionally deploy the decision service archive with the same decisionServiceId and decisionServiceVersion values in the same deployment space by setting the query parameter allowDuplicateDecisionService to true.