Deploying to decision runtime with REST API
You can deploy decision service archives by using the runtime REST API.
Before you begin
Procedure
-
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" - 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.jsonExample 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.
- Modify the metadata in /path/to/metadata.json.
- 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
decisionServiceIdanddecisionServiceVersionin the decision service archive already exist in the targetdeploymentSpaceId(response code:409).However, you can exceptionally deploy the decision service archive with the same
decisionServiceIdanddecisionServiceVersionvalues in the same deployment space by setting the query parameterallowDuplicateDecisionServicetotrue.