Skip to main content
Version: 1.17.0

Cameras

Get cameras

Query cameras is used to get a list of cameras.

query {
cameras() { } }

Input parameters:

  • ids
    • To get a list with certain profile groups, specify their IDs.
    • Data type: ID.
  • filter
    • Filtering the list of cameras (e.g., by custom fields)
    • Data type: JSONString.
  • order
    • Sorting the list of cameras (by custom fields in alphabetical/reverse alphabetical order)
    • Data type: String.
  • offset
    • The parameter is used to exclude the last n agents from the list.
    • Data type: Int.
  • limit
    • The parameter is used to get the last n agents from the list.
    • Data type: Int.
  • withArchived:
    • all: List of all cameras, including archived ones.
    • archived: List of archived cameras only.

Output parameters:

  • totalCount
    • Total number of returned cameras
    • Data type: Int.
  • collectionItems: CameraOutput:
    • id
      • Camera identifier
      • Data type: ID.
    • creationDate
      • Camera creation date
      • Data format: ISO 8601
    • lastModified
      • Last modification date
      • Data format: ISO 8601
    • info
      • Camera data, e.g., camera custom fields
      • Data format: JSON.

Example Request:

query {
cameras {
totalCount
collectionItems {
id
creationDate
lastModified
info
}
}
}

Example Response:

API returns the following result:
{
"data": {
"cameras": {
"totalCount": 0,
"collectionItems": []
}
}
}

Create a camera

Mutation createCamera is used to create a camera object.

mutation {
cameras() { }}

Input parameters:

  • cameraData:
    • fields:
      • name
        • Name of camera field
        • Data type: String.
      • value
        • Value in camera field
        • Data type: String.
    • agentId
      • Identifier assigned to an agent which the camera will be bound to
      • Data type: ID.

Output parameters:

  • ok
    • Mutation completion status
    • Data type: Boolean
  • camera: CameraOutput

Example Request:

mutation 
{createCamera(
cameraData: {fields: {name:"Title" value:"Camera 1"} agentId:"***"})
{
ok
camera {
id
creationDate
lastModified
info
}
}
}

Example Response:

API returns the following result:
{
"data": {
"createCamera": {
"ok": true,
"camera": {
"id": "4caa9737-b461-400b-a109-ea00f090ed20",
"creationDate": "2023-05-24T09:27:43.529604+00:00",
"lastModified": "2023-05-24T09:27:43.529563+00:00",
"info": {
"title": "Camera 1"
}
}
}
}
}

Delete a camera

Mutation deleteCameras is used to delete a camera object.

mutation {
deleteCameras() { }}

Input parameters:

  • cameraIds
    • Identifiers of cameras to be deleted
    • Data type: ID

Output parameters:

  • ok
    • Mutation completion status
    • Data type: Boolean

Example Request:

mutation {
deleteCameras(cameraIds: ["***"])
{
ok
}
}

Example Response:

API returns the following result:
{
"data": {
"deleteCameras": {
"ok": true
}
}
}

Update a camera

Mutation updateCamera is used to update data in a camera object (e.g., update data in camera fields).

mutation {
updateCamera() { }}

Input parameters:

  • cameraId
    • Identifier assigned to a camera which data should be updated
    • Data type: ID.
  • cameraData:
    • fields:
      • name
        • Name of camera field
        • Data type: String.
      • value
        • New value in camera field
        • Data type: String.
    • agentId
      • Identifier assigned to an agent which the camera will be bound to
      • Data type: ID

Output parameters:

  • ok
    • Mutation completion status
    • Data type: Boolean
  • camera: CameraOutput

Example Request:

mutation {
updateCamera(cameraId: "***"
cameraData: {fields: {name:"Title" value:"Camera 3"}})
{
ok
camera{
id
info
}
}
}

Example Response:

API returns the following result:
{
"data": {
"updateCamera": {
"ok": true,
"camera": {
"id": "***",
"info": {
"title": "Camera 3"
}
}
}
}
}

Mutation addCamerasToAgent is used to link cameras to an agent.

mutation {
addCamerasToAgent() { }}

Input parameters:

  • camerasIds
    • Identifiers assigned to cameras which should be linked to an agent
    • Data type: ID.
  • agentId
    • Identifier assigned to an agent to which cameras will be linked
    • Data type: ID.

Output parameters:

  • ok
    • Mutation completion status
    • Data type: Boolean
  • agent: AgentOutput

Example Request:

mutation {
addCamerasToAgent(camerasIds:"***" agentId: "***")

{
ok
agent {
id
creationDate
lastModified
token
camerasIds
cameras {
id
}
title
agentStatus
agentLastActiveTime
archived
}
}
}

Example Response:

API returns the following result:
{
"data": {
"addCamerasToAgent": {
"ok": true,
"agent": {
"id": "***",
"creationDate": "2023-05-25T07:46:15.754737+00:00",
"lastModified": "2023-05-25T08:09:34.813140+00:00",
"token": "***",
"camerasIds": [
"***",
"***"
]
"cameras": [
{
"id": "***
},
{
"id": "***"
}
]
"title": "Agent 1",
"agentStatus": "active",
"archived": false
}
}
}
}

Mutation removeCamerasFromAgent is used to link cameras to an agent.

mutation {
removeCamerasFromAgent() { }}

Input parameters:

  • camerasIds
    • Identifiers assigned to cameras which should be linked to an agent
    • Data type: ID.
  • agentId
    • Identifier assigned to an agent to which cameras will be linked
    • Data type: ID.

Output parameters:

  • ok
    • Mutation completion status
    • Data type: Boolean
  • agent: AgentOutput

Example Request:

mutation {
removeCamerasFromAgent(camerasIds: "***" agentId: "***")
{
ok
agent {
id
creationDate
lastModified
token
camerasIds
cameras {
id
}
title
agentStatus
archived
}
}
}

Example Response:

API returns the following result:
{
"data": {
"removeCamerasFromAgent": {
"ok": true,
"agent": {
"id": "***",
"creationDate": "2023-05-25T07:46:15.754737+00:00",
"lastModified": "2023-05-25T08:14:54.750972+00:00",
"token": "***",
"camerasIds": [
"***"
],
"cameras": [
{
"id": "***"
}
],
"title": "Agent 1",
"agentStatus": "inactive",
"archived": false
}
}
}
}

Get a list of custom fields for cameras

Query collectorSettings returns a list of camera custom fields.

query {
collectorSettings() { }}

Output parameters:

  • cameraFields
    • List of current camera fields
    • Data type: String.

Example Request:

query {
collectorSettings
{
cameraFields
}
}

Example Response:

API returns the following result:
{
"data": {
"collectorSettings": {
"cameraFields": [
"title",
"stream",
"type",
"width",
"height",
"real_name"
]
}
}
}

Add custom fields for cameras

Mutation addCamerasField is used to add camera custom fields.

mutation {
addCamerasField() { }}

Input parameters:

  • fieldInput:
    • name
      • Name of a new camera field
      • Data type: String.

Output parameters:

  • ok
    • Mutation completion status
    • Data type: Boolean.
  • fields
    • List of current camera fields
    • Data type: String.

Example Request:

mutation {
addCamerasField(fieldInput: {name: "model"})
{
ok
fields
}
}

Example Response:

API returns the following result:
{
"data": {
"addCamerasField": {
"ok": true,
"fields": [
"title",
"stream",
"type",
"width",
"height",
"real_name",
"model"
]
}
}
}

Delete custom fields for cameras

Mutation removeCamerasField is used to delete camera custom fields.

mutation {
removeCamerasField() { }}

Input parameters:

  • fieldInput:
    • name
      • Name of camera field to be deleted
      • Data type: String.

Output parameters:

  • ok
    • Mutation completion status
    • Data type: Boolean.
  • fields
    • List of current camera fields
    • Data type: String.

Example Request:

mutation {
removeCamerasField(fieldInput: {name: "model"})
{
ok
fields
}
}

Example Response:

API returns the following result:
{
"data": {
"removeCamerasField": {
"ok": true,
"fields": [
"title",
"stream",
"type",
"width",
"height",
"real_name"
]
}
}
}