Updated on 2024-04-22 GMT+08:00

Deploying an Algorithm

Function

This API is used to deploy an algorithm.

URI

POST /v2/{project_id}/algorithm/{alg_id}/deploy

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID and Name.

alg_id

Yes

String

Algorithm ID

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. For details about how to obtain a user token, see Authentication.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

pool_id

No

String

Resource pool ID. This parameter is mandatory when the service status is Not deployed.

stream_count

Yes

Integer

Number of video stream channels

Minimum: 1

Maximum: 10000

deploy_config

No

Object

Service startup parameter, which must be configured based on the model deployment constraints. The type is Map<String, Object>. This parameter is optional and is left blank by default. To ensure data security, do not enter sensitive information, such as plaintext passwords, in environment variables.

envs

No

Object

Environment variable key-value pair required for running a service. The type is Map<String, String>. This parameter is optional and is left blank by default. To ensure data security, do not enter sensitive information, such as plaintext passwords, in environment variables.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

alg_name

String

Algorithm name

Example Requests

This request is used to deploy an algorithm. In the request body, the resource pool ID, maximum number of stream channels, and service startup parameters are configured.

GET https://{endpoint}/v2/{project_id}/algorithm/068ed4d8-077e-4ec9-aa19-bc******e925/deploy

{
  "pool_id" : "ed9f128bf7d04f5683f0ef******a255",
  "stream_count" : 1,
  "deploy_config" : {
    "sub_scene" : "common"
  }
}

Example Responses

Status code: 200

Response body for deploying an algorithm

{
  "alg_name" : "Intrusion detection"
}

Status Codes

Status Code

Description

200

Response body for deploying an algorithm

400

Request error

500

Internal error

Error Codes

See Error Codes.