web sdk tasks - Genetec/DAP GitHub Wiki

Executing saved tasks

Saved tasks are report queries stored in Security Center that you can retrieve and execute through the Web SDK. Tasks are either public (visible to all users) or private (visible only to the user who created them).

Listing saved tasks

Retrieve the list of saved tasks available to the authenticated user.

List public tasks:

GET /tasks/public

List private tasks:

GET /tasks/private

Response:

{
  "Rsp": {
    "Status": "Ok",
    "Result": [
      {
        "Guid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "Name": "Daily door activity",
        "TaskType": "Door Activity"
      }
    ]
  }
}

Response fields:

  • Guid: The unique identifier for the saved task
  • Name: The display name of the saved task
  • TaskType: A display label for the report category (e.g., Door Activity, Camera Activity, Access, Alarm). Returns Not executable report when the saved task cannot be mapped to an executable report category.

The result is an empty array when no saved tasks exist.

Executing a saved task by GUID

Execute a saved task using its GUID. The server runs the report query and returns the results.

POST /tasks/execute/{task-guid}

Replace {task-guid} with the GUID returned from the listing endpoints.

[!IMPORTANT] POST requests require the Content-Length: 0 header since there is no request body. Without this header, the request fails with HTTP 411 "Length Required".

Optional query parameter:

  • maxResultCount: Optional positive integer. Limits the number of results returned. If omitted, the server applies its own report-manager limit.
POST /tasks/execute/{task-guid}?maxResultCount=100

Successful response:

{
  "Rsp": {
    "Status": "Ok",
    "Result": []
  }
}

The Result array contains the report query results. The structure varies depending on the report type. The response status can also be TooManyResults or Partial instead of Ok.

Error response:

{
  "Rsp": {
    "Status": "Fail",
    "Result": {
      "Message": "Query unsuccessful: SystemNotRunning"
    }
  }
}

Executing a saved task by name

Execute a saved task using its type and name instead of its GUID.

Execute a public task:

POST /tasks/public/execute/{task-type}/{task-name}

Execute a private task:

POST /tasks/private/execute/{task-type}/{task-name}

Replace {task-type} with the report category display label from the task listing (e.g., Door Activity) and {task-name} with the task name. URL-encode spaces in both values.

[!IMPORTANT] POST requests require the Content-Length: 0 header since there is no request body. Without this header, the request fails with HTTP 411 "Length Required".

Optional query parameter:

  • maxResultCount: Limits the number of results returned.

Error response when the task is not found (HTTP 404):

{
  "Rsp": {
    "Status": "Fail",
    "Result": {
      "SdkErrorCode": "InvalidValue",
      "Message": "Could not find task of type SomeType with logical name SomeName."
    }
  }
}