Task

Get Task List

This API retrieves a list of tasks with their relevant information, including task name, location ID, camera ID, camera RTSP, task status, task scheduler, and the task events (using IDs).

Endpoint: GET /tasks

Parameters:

Parameter
Decritpion
Type
Require

ids

Fetch specific ids.

string

No

offset

Offset for pagination. (default 0)

integer

No

limit

Limit the number of results per page. (default 100)

integer

No

location_id

Filter tasks by location ID. (default all)

integer

No

camera_id

Filter tasks by camera ID. (default all)

integer

No

Example Request:

GET /tasks?ids=1,2&order=id&offset=0&limit=10

Response:

[
    {
      "id": 1,
      "name": "Task 1",
      "status": "operating, normal",
      "scheduler": "24/7",
      "events": [1, 2, 3],
      "camera": {
          "id": 1,
          "name": "camera1",
          "source_url": "https://abc.com",
          "fps": 10,
          "resolution_height": 720,
          "resolution_width": 1280,
          "model_name": "111",
          "coordinates": {
              "latitude": 1.0,
              "longitude": 2.0
          },
          "address": null
      },
      "location": {
          "id": 4,
          "name": "location1",
          "timezone": "utc",
          "organization_id": 1,
          "coordinates": {
              "latitude": 1.0,
              "longitude": 2.0
          }
      },
      "cluster": 1,
      "snaphost": "https://test.com/a.jpg"
    },
    {
      "id": 2,
      "name": "Task 2",
      "status": "operating, normal",
      "scheduler": "daily",
      "events": [4, 5, 6],
      "camera": {
          "id": 1,
          "name": "camera1",
          "source_url": "https://abc.com",
          "fps": 10,
          "resolution_height": 720,
          "resolution_width": 1280,
          "model_name": "111",
          "coordinates": {
              "latitude": 1.0,
              "longitude": 2.0
          },
          "address": null
      },
      "location": {
          "id": 4,
          "name": "location1",
          "timezone": "utc",
          "organization_id": 1,
          "coordinates": {
              "latitude": 1.0,
              "longitude": 2.0
          }
      },
      "cluster": 1,
      "snaphost": "https://test.com/b.jpg"
    }
]

Response Fields:

Field
Description
Type

id

The unique identifier for the task.

integer

name

The name of the task.

string

status

The status of the task.

string

scheduler

The task scheduler configuration (24/7, daily, weekly).

string

events

An array of event IDs related to this task.

array

location

The location configuration. (detail as below)

object

camera

The camera configuration. (detail as below)

object

cluster

The id of the cluster to which the task belongs.

integer

snapshot

The snapshot url of the task.

string

camera:

Field
Description
Type

id

The unique identifier for the camera.

integer

name

The name of the camera.

string

source_url

The stream URL of the camera. (RTSP/s or HTTP/s)

string

fps

The fps of the camera original setup.

integer

resolution_height

The resolution height of the camera.

integer

resolution_width

The resolution width of the camera.

integer

model_name

The model name of the camera.

string

coordinates

The latitude and longitude of the camera

object

address

The address of the camera

string

location:

Field
Description
Type

id

The unique identifier for the location.

integer

name

The name of the location.

string

timezone

The timezone of the location.

string

organization_id

The ID of the organization the location belongs to.

integer

coordinates

The latitude and longitude of the location.

object


Get Task Detail

This API retrieves detailed information about a specific task, including the task name, location ID, camera ID, camera RTSP, task status, task scheduler, events, confidence threshold, and object size filter.

Endpoint: GET /tasks/:task_id

Parameters:

Parameter
Description
Type
Require

task_id

The unique identifier for the task.

integer

Required

Example Request:

Example Response:

Response Fields:

Field
Description
Type

id

The unique identifier for the task.

integer

name

The name of the task.

string

status

The status of the task.

string

scheduler

The task scheduler configuration (type, scheduled_times).

object

events

Event objects related to the task.

array

camera

The camera configuration

object

location

The location configuration

object

confidence_threshold

The confidence threshold for each detected object.

object

object_size_filter

The size filter for each detected object.

object

cluster

The information of the cluster to which the task belongs.

object

snapshot

The snapshot url of the task

string

scheduler

Field
Description
Type

type

The scheduler type of the task (24/7, daily, weekly).

string

scheduled_times

The scheduled times of the task. The keys indicates the days of the week (mon, tue, wed, thu, fri, sat, sun). The value of each day is arrays which are composed of start time and end time

object

camera

Field
Description
Type

id

The unique identifier for the camera.

integer

name

The name of the camera.

string

source_url

The stream URL of the camera. (RTSP/s or HTTP/s)

string

fps

The fps of the camera original setup.

integer

resolution_height

The resolution height of the camera.

integer

resolution_width

The resolution width of the camera.

integer

model_name

The model name of the camera.

string

coordinates

The latitude and longitude of the camera

object

address

The address of the camera

string

location

Field
Description
Type

id

The unique identifier for the location.

integer

name

The name of the location.

string

timezone

The timezone of the location.

string

organization_id

The ID of the organization the location belongs to.

integer

coordinates

The latitude and longitude of the location.

object

confidence_threshold

Field
Description
Type

{object}

The object name of the confidence_threshold.

string

{value}

The confidence_threshold of the {object}. confidence_threshold is the minimum confidence score for a prediction to be valid when detecting objects.

float

object_size_filter

Field
Description
Type

{object}

The object name of the object_size_filter.

string

{value}

The object_size_filter of the {object}. The parameters will decide the target detection bbox size available range of the image area. For example, [0.1, 0.2, 0, 1] means the width range is between 0.1~0.2 and the height range is between 0~1.

array

cluster

Field
Description
Type

id

The id of the compute target cluster.

integer

name

The name of the compute target cluster.

string

address

The address of the compute target cluster.

string


Add Task

This API creates a new detection task by registering a camera and binding it to the required resources. Once created, the task will appear in the Task List and start detecting.

Endpoint: POST /tasks

Request Body:

The request body should contain the details of the new task.

Field
Description
Type
Required

name

The name of the task.

string

Yes

organization_id

The ID of the organization the task belongs to 1.

integer

Yes

location_id

The ID of the location where the task is taking place.

integer

Yes

compute_target_id

The ID of the compute target where the task is operating.

integer

Yes

compute_target_cluster_id

The ID of the compute target cluster where the task is operating.

integer

Yes

camera_id

The ID of the camera the task is using.

integer

Yes

event_id

The ID of the event related to the task.

integer

Yes

Example Request:

Example Response:

Response Codes:

  • 201 Created: The new task was successfully created.

  • 400 Bad Request: The request was invalid or missing required parameters.

  • 500 Internal Server Error: An unexpected error occurred on the server.

Last updated