Adding a Batch Task
Function
This API is used to add a batch task.
URI
POST /v2/{project_id}/batch-tasks
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details, see Obtaining a Project ID and Name. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. For details about how to obtain a user token, see Authentication. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Task name. It can contain up to 100 characters and can include letters, digits, hyphens (-), and underscores (_). |
description |
No |
String |
Task description, which is optional. Enter a maximum of 500 characters. Minimum: 0 Maximum: 500 |
schedule |
No |
TaskSchedule object |
Task schedule. Only the weekly mode is supported. |
batch_input |
Yes |
BatchTaskInputDto object |
Batch task input |
output |
Yes |
TaskOutput object |
Output configuration of a task. At least one output mode must be configured. |
config |
No |
TaskServiceConfig object |
Task configuration parameters |
service_name |
Yes |
String |
Algorithm API ID, which must match the regular expression ^[\u4E00-\u9FA5a-zA-Z0-9_-]{1,100}$. Minimum: 1 Maximum: 100 |
service_version |
Yes |
String |
Service version. The value must match the regular expression ^[a-z0-9.]{3,32}$. Minimum: 3 Maximum: 32 |
is_saved_as_template |
No |
Boolean |
Whether to save as a template Default: false |
resource_order_id |
No |
String |
Resource order ID, which corresponds to the associated algorithm. This parameter is only mandatory for commercial algorithms and must match the regular expression ^[a-z0-9-_]{4,36}$. Minimum: 4 Maximum: 36 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
type |
Yes |
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 |
Yes |
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 |
No |
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 |
No |
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 |
No |
Array<Array<>> |
Time segment configuration. Select at least one time segment for executing a weekly or monthly task. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
video_source_group |
No |
Array of BatchTaskVideoSourceGroupDto objects |
Video source group information Array Length: 1 - 100 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
video_source_group_id |
Yes |
String |
Video source group ID |
video_source_list |
Yes |
Array of BatchTaskInputVideoSourceDto objects |
Video sources Array Length: 0 - 100 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
video_source_id |
Yes |
String |
Video source ID |
target_roi |
No |
String |
ROI Minimum: 0 Maximum: 2048 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
obs |
No |
TaskOutputObs object |
Configuration information when the output type is obs. |
dis |
No |
TaskOutputDis object |
Configuration information when the output type is dis. |
webhook |
No |
TaskOutputWebhook object |
Configuration information when the output type is webhook. |
event_center |
No |
Boolean |
Whether to set the output mode to Event Center. true or 1 indicates yes. false indicates no. Default: false |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
bucket |
Yes |
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 |
Yes |
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 |
No |
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 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
stream_name |
Yes |
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 |
No |
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 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
url |
Yes |
String |
Result callback address. This parameter is mandatory when the output type is webhook. Maximum: 1000 |
headers |
Yes |
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 |
No |
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 |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
total_count |
Integer |
Total number of tasks |
failed_count |
Integer |
Number of failed tasks |
succeed_count |
Integer |
Number of successfully executed tasks |
id |
String |
Batch task ID |
error_list |
Array of strings |
Error information list |
Status code: 400
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
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 adds a batch task named wdwd. The smoke and fire detection algorithm is used, with version 1.0. The vendor is VIAS. The configuration is not saved as a template. The input mode is video_source. The output mode is webhook. The task startup parameters are configured.
/v2/{project_id}/batch-tasks { "name" : "wdwd", "service_name" : "Smoke and fire detection algorithm", "service_version" : "1.0", "manufacturer" : "VIAS", "is_saved_as_template" : false, "description" : "", "priority" : "low", "batch_input" : { "video_source_group" : [ { "video_source_group_id" : "xxxxxxx-xxxxxxx-xxxxxxx-xxxxx-xxxxxx", "video_source_list" : [ { "video_source_id" : "xxxxxxx-xxxxxxx-xxxxxxx-xxxxx-xxxxxx" } ] } ] }, "output" : { "webhook" : { "url" : "http://test", "headers" : { "a" : "a" } } }, "config" : { "common" : { "render_result_sw" : 1, "fire_detection_sw" : 1, "smoke_detection_sw" : 1 } } }
Example Responses
Status code: 200
Response to a batch operation request
{ "total_count" : 1, "failed_count" : 0, "succeed_count" : 1, "id" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "error_list" : [ ] }
Status Codes
Status Code |
Description |
---|---|
200 |
Response to a batch operation request |
400 |
Request error |
500 |
Internal error |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot