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

Obtaining Task Details

Function

This API is used to obtain details about intelligent video analysis tasks.

URI

GET /v2/{project_id}/tasks/{task_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

task_id

Yes

String

Task 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.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

id

String

Task ID

name

String

Task name

creator

String

Username of the task creator

project_id

String

Project ID of the task creator

description

String

Task description

Minimum: 0

Maximum: 500

release_id

String

ID of the service corresponding to a task

service_id

String

ID of the service corresponding to a task

created_at

String

Task creation time

updated_at

String

Time when the latest task status was updated

state

String

Task status. The value can be PENDING, RECOVERING, STARTING, UPGRADING, CREATE_FAILED, START_FAILED, RUNNING, STOPPING, STOPPED, ABNORMAL, SUCCEEDED, FAILED, DELETING, FREEZING, or FROZEN.

status

String

Details about a task status (for some statuses only)

Minimum: 0

Maximum: 4096

error

error object

Error information

schedule_status

String

Status of a scheduled task. The value can be ACTIVATED or INACTIVATED.

schedule

TaskSchedule object

Task schedule. Only the weekly mode is supported.

input

TaskInput object

Input configuration of a task, which is mandatory.

output

TaskOutputForDisplay object

Output configuration of a task

config

TaskServiceConfig object

Task runtime parameters customized by the service publisher

video_source_name

String

Video source name

title

String

Algorithm name (CN)

group_name

String

Group name. Multiple values are separated by commas (,).

company

String

Vendor

task_config

String

Task algorithm configuration

type

String

Cloud or edge

resource_order_id

String

Resource order ID

package_id

String

Algorithm package ID

device_id

String

Device ID

access_address

String

Access address

algorithm_publish_id

String

Algorithm ID

Table 4 error

Parameter

Type

Description

code

String

Error code

Minimum: 8

Maximum: 36

message

String

Error description

Minimum: 2

Maximum: 512

Table 5 TaskSchedule

Parameter

Type

Description

type

String

Type of a scheduled task. This parameter is mandatory for scheduled tasks. The value can be weekly, indicating that the task is executed every week.

timezone

String

Time zone where a user is located. This parameter is mandatory for scheduled tasks. The value is accurate to the minute.

days_of_week

Array of integers

Days in a week when a task is executed. This parameter is mandatory only for weekly tasks. The values 1 to 7 indicate Monday to Sunday respectively.

Minimum: 1

Maximum: 7

Array Length: 1 - 7

days_of_month

Array of integers

Days in a month when a task is executed. This parameter is mandatory only for monthly tasks. The values 1 to 31 indicate the first day to the 31st day of a month. Currently, the system does not support this parameter.

Minimum: 1

Maximum: 31

periods

Array<Array<>>

Time segment configuration. Select at least one time segment for executing a weekly or monthly task.

Table 6 TaskInput

Parameter

Type

Description

type

String

Task input type, which is mandatory when you create a task. The video_source type cannot be changed to other types. The following types are supported: obs (files stored in OBS, supported only by cloud tasks), url (specified file URL or stream request URL, supported only by cloud tasks), edgecamera (edge camera bound to IEF, supported only by edge tasks), restful (stream request URL obtained from a user-specified streaming server through a RESTful API, supported by both cloud and edge jobs) vcn (VCN device, supported only by edge tasks), and video_source (video sources managed in VIAS, supported by both cloud and edge tasks). You are advised to use the video_source type. Other types will be discontinued in the future. The outputs of tasks whose input type is obs, url, edgecamera, or restful can be sent to webhook. Options:

  • video_source

  • obs (not recommended and will be discontinued)

  • url (not recommended and will be discontinued)

  • edgecamera (not recommended and will be discontinued)

  • restful (not recommended and will be discontinued)

  • vcn (not recommended and will be discontinued)

data

Array of TaskInputData objects

Input details of a task, which is mandatory. The configuration varies depending on the input type. Multiple inputs are allowed during creation, but only one input is allowed for update. If the input type is obs, you must configure bucket, path, and index. Example: bucket: aicam, path: 3rdpartylicenses.txt, index: 0 If the input type is url, you must configure url and index. Example: url: https://xxx-xxx.com, index: 0 If the input type is restful, you must configure certificate_check, rtsp_path_in_response, url, index, and headers. Example: certificate_check: true, url: https://hsaij-dasahbi.com, rtsp_path_in_response: data/url, index: 0, headers: { AAA: AAA } If the input type is vcn, you must configure device_id, stream_type, and index. Example: device_id: 21356478954612546874#gdhjkiushdgdksjhslmhscjsckjhdbnk, stream_type: 1, index: 0 If the input type is EdgeCamera, you must configure id and index. Example: id: 007cdafc-6000-47ce-b0e3-870b4a0db65e, index: 0.

Array Length: 1 - 50

vcn

TaskInputVcn object

VCN server. This parameter is mandatory only when the input type is vcn.

Table 7 TaskInputData

Parameter

Type

Description

video_source_id

String

Video source ID. This parameter is mandatory when the input type is video_source.

stream_name

String

Name of a video stream

bucket

String

OBS bucket name. This parameter is mandatory when the input type is obs.

Maximum: 64

path

String

OBS path. This parameter is mandatory when the input type is obs.

Maximum: 1023

url

String

File URL or RESTful request URL for obtaining a video stream. This parameter is mandatory when the input type is url or edgerestful. The value contains a maximum of 1000 characters.

Maximum: 1000

headers

Object

Headers carried in the RESTful request for obtaining a video stream. This parameter is optional when the input type is edgerestful. The value is key-value pairs in JSON format. A maximum of 10 key-value pairs are allowed.

rtsp_path_in_response

String

Video stream address in the response body for the RESTful request. This parameter is mandatory when the input type is edgerestful. The value contains a maximum of 1024 characters.

Maximum: 1024

device_id

String

VCN ID. This parameter is mandatory when the input type is vcn.

stream_type

Integer

Stream type used for analysis. This parameter is mandatory when the input type is vcn. The value ranges from 1 to 3. The value 1 indicates primary stream, the value 2 indicates secondary stream 1, and the value 3 indicates secondary stream 2.

Minimum: 1

Maximum: 3

id

String

ID of the edge device mounted to IEF. This parameter is mandatory when the input type is edgecamera.

Maximum: 63

certificate_check

Boolean

Whether to verify the certificate of the HTTPS request. This parameter is mandatory when the input type is edgerestful. The value can be true or false.

Default: false

Table 8 TaskInputVcn

Parameter

Type

Description

ip

String

IP address of a VCN server. This parameter is mandatory only when the input type is vcn.

port

Integer

Port number of a VCN server. This parameter is mandatory only when the input type is vcn.

Minimum: 0

Maximum: 65535

username

String

Account name of a VCN server. This parameter is mandatory only when the input type is vcn. The value must match the regular expression ^.{1,100}$.

password

String

Password of a VCN server account. This parameter is mandatory only when the input type is vcn. The value must match the regular expression ^.{1,1000}$.

Table 9 TaskOutputForDisplay

Parameter

Type

Description

obs

TaskOutputObs object

Configuration information when the output type is obs.

dis

TaskOutputDis object

Configuration information when the output type is dis.

webhook

TaskOutputWebhook object

Configuration information when the output type is webhook.

event_center

Boolean

Whether to associate the event center with task outputs

Table 10 TaskOutputObs

Parameter

Type

Description

bucket

String

OBS bucket name. This parameter is mandatory when the OBS output type is used. The verification rule is (pattern: " ^[a-z0-9](?!.[-.][-.].)([a-z0-9-.]{1,61})[a-z0-9]$ ").

Maximum: 63

path

String

OBS path. This parameter is mandatory when the OBS output type is used. The verification rule is ^(?![/.\s])(?!.//.)([^:*?"<>|\]{0,1023})(?<![.\s])$.

Maximum: 1023

data_category

Array of strings

List of task output types. This parameter is optional and is required only for some services. The output contains data in the dataCategory list.

Array Length: 0 - 10

Table 11 TaskOutputDis

Parameter

Type

Description

stream_name

String

Name of a DIS stream. This parameter is mandatory when the DIS output type is used. The verification rule is ^[-A-Za-z0-9_]{1,64}$.

Maximum: 64

data_category

Array of strings

List of task output types. This parameter is optional and is required only for some services. The output contains data in the dataCategory list. For example, in the API for creating edge face-related tasks, the output contains dataCategory, with a value range of [FaceImage, OriginImage], indicating whether to send the face image or original image.

Array Length: 0 - 10

Table 12 TaskOutputWebhook

Parameter

Type

Description

url

String

Result callback address. This parameter is mandatory when the output type is webhook.

Maximum: 1000

headers

Object

Headers carried in result callback. This parameter is mandatory when the output type is webhook. The value is key-value pairs in JSON format. A maximum of 10 key-value pairs are allowed, and a minimum of 1 key-value pair is allowed.

data_category

Array of strings

List of task output types. This parameter is optional and is required only for some services. The output contains data in the dataCategory list.

Array Length: 0 - 10

Table 13 TaskServiceConfig

Parameter

Type

Description

common

Object

Task runtime configuration items customized by the service publisher. The value must be in JSON format. For details about the configuration items, see the description of the corresponding algorithm service.

Status code: 400

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error description

detail

String

Error details

params

Array of strings

Error parameters

Array Length: 0 - 1

reason

String

Error cause

advice

String

Suggestion

Status code: 500

Table 15 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error description

detail

String

Error details

params

Array of strings

Error parameters

Array Length: 0 - 1

reason

String

Error cause

advice

String

Suggestion

Example Requests

This request is used to obtain task details including the task name, input mode, and output mode.

/v2/{project_id}/tasks/{task_id}

https://{endpoint}/v2/{project_id}/tasks/{task_id}?

Example Responses

Status code: 200

Task details

{
  "id" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "name" : "qqqq_task",
  "creator" : "test",
  "project_id" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "release_id" : "xxxxxxx-xxxxxxx-xxxxxxx-xxxxx-xxxxxx",
  "service_id" : "xxxxxxx-xxxxxxx-xxxxxxx-xxxxx-xxxxxx",
  "created_at" : "2023-06-06T06:59:33.024Z",
  "updated_at" : "2023-06-06T06:59:33.024Z",
  "event_type" : 0,
  "priority" : "low",
  "steal" : 0,
  "state" : "PENDING",
  "input" : {
    "type" : "video_source",
    "data" : [ {
      "video_source_id" : "xxxxxxx-xxxxxxx-xxxxxxx-xxxxx-xxxxxx"
    } ]
  },
  "output" : {
    "event_center" : true
  },
  "config" : {
    "common" : { }
  },
  "video_source_name" : "url_test",
  "task_config" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?><algorithm><config><common><param titleCn=\"platform\" name=\"platform\" required=\"false\" titleEn=\"platform\" type=\"Object\"><param titleCn=\"project_id\" name=\"project_id\" required=\"false\" titleEn=\"project_id\" type=\"String\"/><param titleCn=\"domain_name\" name=\"domain_name\" required=\"false\" titleEn=\"domain_name\" type=\"String\"/><param titleCn=\"agency_name\" name=\"agency_name\" required=\"false\" titleEn=\"agency_name\" type=\"String\"/><param titleCn=\"domain_id\" name=\"domain_id\" required=\"false\" titleEn=\"domain_id\" type=\"String\"/><param titleCn=\"task_id\" name=\"task_id\" required=\"false\" titleEn=\"task_id\" type=\"String\"/></param></common></config></algorithm>",
  "type" : "0",
  "package_id" : "xxxxxxx-xxxxxxx-xxxxxxx-xxxxx-xxxxxx"
}

Status Codes

Status Code

Description

200

Task details

400

Request error

500

Internal error

Error Codes

See Error Codes.