Full version

API Reference

This page contains the MyVMS Server API reference for MyVMS 8.x and later. The API includes named RPC methods and server-provided resources.

This reference does not describe every API method, resource, or configuration option available in MyVMS.

If you need a specific integration or an API feature that is not documented here, please contact us at 112@myms.eu.

API Reference

Core

Data Format

MyVMS API supports JSON and MessagePack. JSON uses application/json . MessagePack uses application/x-msgpack . Text encoding is UTF-8.

RPC Endpoint and Protocol

Supported product line: MyVMS 8.x and later.

URI: /rpc
MIME types: application/json, application/x-msgpack
Methods: POST

The resource provides easy access to the capabilities of full-blown MyVMS server communication protocol. This protocol is used, for example, by "Observer" application. Developers should not implement the network part of the interaction and can use HTTP as transport protocol.

Data formats

Requests can be transmitted using JSON or MessagePack. Request and response use the same format. Text encoding is UTF-8. MessagePack is recommended for maximum performance and is required by methods that return binary frame data. Examples in this reference use JSON.

Time

Time is represented as an array of integers. Its elements represent year, month, day, hour, minute, seconds, and milliseconds respectively. If some element in the end of the array equals to zero, it can be omitted. For example, “October 30, 2016, 15:00” could not only be presented as [2016, 11, 30, 15, 0, 0, 0] but also as [2016, 11, 30, 15].

Request structure

In the case of a single request, it is an object with one required field:

  • method - a method name.

and optional fields:

  • params - an object with the parameters;
  • id - an integer ID, which will be included in the response;

Request sample:

1{
2  "id" : 42,
3  "method" : "some_method",
4  "params" : 
5  {
6     "some_param" : "some_value" 
7  }
8}

Response structure

Response also is an object, a set of fields that depends on a success of a inquiry processing:

  • id - an integer ID that was contained in the request;
  • result - an object with the result; It is contained in a response only in case of successful processing command;
  • error - an object with information about the error.

Response sample for successful request processing:

POST /rpc HTTP/1.1
Host: 127.0.0.1
Content-Type: application/json

{
  "method" : "sum_two_numbers",
  "params" :
  {
    "first" : 30,
    "second" : 12
  }
}
HTTP/1.1 200 OK
Date: Tue, 07 Jun 2016 07:52:46 GMT
Content-Type: application/json

{
  "result" : 
  {
     "sum" : 42
  }
}

Response sample where errors occurred during request processing:

POST /rpc HTTP/1.1
Host: 127.0.0.1
Content-Type: application/json

{
  "method" : "sum_two_numbers",
  "params" :
  {
    "second" : 30
  }
}
HTTP/1.1 200 OK
Date: Tue, 07 Jun 2016 07:52:46 GMT
Content-Type: application/json

{
  "error" : 
  {
    "type" : "invalid_param",
    "message" : "first" 
  }
}

Batch requests

Server supports execution of a list of commands transmitted simultaneously. In this case, the commands should be represented as an array of single requests. Response to such request will be represented as an array of single responses, the order of which will correspond to the order of requests:

POST /rpc HTTP/1.1
Host: 127.0.0.1
Content-Type: application/json

[
  {
    "method" : "mul_two_numbers",
    "params" :
    {
      "first" : 7,
      "second" : 6
    }
  },
  {
    "method" : "sub_two_numbers",
    "params" :
    {
      "first" : 30
    }     
  }
]
HTTP/1.1 200 OK
Date: Tue, 07 Jun 2016 07:52:46 GMT
Content-Type: application/json

[
  {
    "result" : 
    {
       "mul" : 42
    }
  },
  {
    "error" : 
    {
      "type" : "invalid_param",
      "message" : "second" 
    }
  }
]

API Version

Information on the RPC API version contains a text name and integer value that increases every time a change to the API server is made. The version value can be used to determine the required methods and parameters for server support. A method with the same name can be implemented differently in different API versions, for example, it can have different parameters.

get_version

Request Example:

1{
2    "method" : "get_version" 
3}

Response Example:

1{
2    "result" : {
3        "version" : {
4            "name" : "v20200622",
5            "value" : 13
6        }
7    }
8}

Server Information

get_server_info

Minimum API version: 12

Response content:

  • id - a unique identifier for the server.
  • name - server name.
  • network - detaild of the server's network settings, a list of port numbers for connecting to the server using different protocols.
  • version - version information.
  • local_time - server local time.

Request Example:

1{
2    "method" : "get_server_info",
3    "version" : 12    
4}

Response Example:

1{
2    "result" : {
3        "info" : {
4            "id" : "bf57f49b771a",
5            "name" : "Devline XVR4",
6            "network" : {
7                "ports" : {
8                    "http" : 9786,
9                    "main" : 9780,
10                    "ping" : 9877,
11                    "rtsp" : 9784
12                }
13            },
14            "version" : {
15                "name" : "v20200901",
16                "value" : 15
17            },
18            "local_time" : [2020,9,29,16,39,38,226]
19        }
20    }
21}

Authentication

RPC

auth

RPC authentication method used by the client authentication flow. The server realm used for calculating the user secret is obtained through this method.

Session Authentication

Protocol version 93 adds session-based authentication, allowing an authenticated client to reuse the established session for subsequent requests.

Exact request and response fields depend on the protocol implementation in use and should be taken from the corresponding server protocol version.

Resource

HTTP Digest Authentication

HTTP resources support Digest Authentication. Username and password values use UTF-8 encoding.

Analytics

RPC

object_detector.get_config

Minimum API version: 70

Returns Object Detector configuration for a camera.

Parameters:

  • camera — camera identifier.
{
  "method": "object_detector.get_config",
  "params": {
    "camera": "0"
  },
  "version": 70
}

object_detector.set_config

Minimum API version: 70

Changes Object Detector configuration for a camera.

Parameters:

  • config.zones[].types may contain "animal", "transport" and "human".
{
  "method": "object_detector.set_config",
  "params": {
    "camera": "0",
    "config": {
      "enabled": true
    }
  },
  "version": 70
}

abandoned_detector.get_config

Minimum API version: 67

Returns Abandoned Object Detector configuration for a camera.

{
  "method": "abandoned_detector.get_config",
  "version": 67,
  "params": {
    "camera": "0"
  }
}
{
  "result": {
    "config": {
      "zones": [
        {
          "id": "0",
          "mask": {
            "data": [1024,1],
            "width": 32,
            "height": 32
          },
          "name": "default"
        }
      ],
      "enabled": false,
      "outline": true
    }
  }
}

abandoned_detector.set_config

Changes Abandoned Object Detector configuration for a camera.

crossing_detector.get_config

Minimum API version: 81

Returns Crossing / Visitor Counting configuration for a camera.

{
  "method": "crossing_detector.get_config",
  "version": 81,
  "params": {
    "camera": "0"
  }
}
{
  "result": {
    "config": {
      "lines": [
        {
          "id": "0",
          "in": {
            "end": {"x": 0.9745, "y": 0.3902},
            "start": {"x": 0.5923, "y": 0.1969}
          },
          "out": {
            "end": {"x": 0.9294, "y": 0.4794},
            "start": {"x": 0.5472, "y": 0.2862}
          }
        }
      ],
      "enabled": false,
      "client_data": {
        "osd": {
          "enabled": true,
          "opacity": 50,
          "osd_pos": "TopCenter",
          "font_size": 25
        }
      }
    }
  }
}

crossing_detector.set_config

Minimum API version: 81

Changes Crossing / Visitor Counting configuration.

{
  "method": "crossing_detector.set_config",
  "version": 81,
  "params": {
    "camera": "0",
    "config": {
      "enabled": true,
      "client_data": {
        "osd": {
          "enabled": true,
          "opacity": 50,
          "osd_pos": "TopCenter",
          "font_size": 25
        }
      }
    }
  }
}
{
  "result": {}
}

osd_pos values:

TopLeft
TopCenter
TopRight
CenterLeft
Center
CenterRight
BottomLeft
BottomCenter
BottomRight

Reactions

RPC

reactions.get_config

Minimum API version: 74 (62)

Minimum MyVMS version: 8.2

Returns the configured reactions.

The current reaction model includes conditions, actions, schedules, interactive buttons and reaction identifiers.
{
  "method": "reactions.get_config",
  "version": 74
}

reactions.set_config

Minimum API version: 74

Minimum MyVMS version: 8.2

Changes the reaction configuration.

A reaction contains an identifier, name, enabled state, conditions, actions, optional button settings and optional time ranges.

Complete example — write recognized plates to a file on schedule:

{
  "method": "reactions.set_config",
  "version": 82,
  "params": {
    "config": [
      {
        "id": "123",
        "name": "Write plate to file",
        "button": {
          "enabled": false
        },
        "actions": [
          {
            "text": "${hour}:${minute}:${second} - ${plate_direction} - ${plate_text}",
            "type": "write_file",
            "filename": "${day}-${month}-${year}.txt",
            "min_period": 0,
            "client_path": "D:\\\\DATA\\\\APNR\\\\"
          }
        ],
        "enabled": true,
        "conditions": [
          {
            "type": "plate_recognition",
            "inlist": false,
            "cameras": ["0"],
            "plate_min_period": 60
          }
        ],
        "time_ranges": [
          {
            "dow": [0,1,2,3,4,5,6],
            "start_time": [9,0],
            "end_time": [18,0]
          }
        ]
      }
    ]
  }
}

Response:

{
  "result": {}
}

Error example:

{
  "error": {
    "type": "invalid_param",
    "message": "config"
  }
}
  • min_period — minimum interval between action executions; 0 means no limit.
  • plate_min_period — minimum interval before processing the same plate again.
  • dow — weekdays, starting with 0 for Monday.
  • start_time / end_time — active reaction time range.

reactions.get_transports_config

Minimum API version: 62

Returns transport settings used by reaction actions.

Request:

{
  "method": "reactions.get_transports_config",
  "version": 74
}

Response example:

{
  "result": {
    "config": {
      "ftp": {
        "port": 21,
        "use_devline_service": false
      },
      "smtp": {
        "port": 25,
        "use_devline_service": true
      },
      "telegram": {
        "use_devline_service": true
      },
      "push": {
        "server": {
          "url": "https://push.myvms.eu/api"
        }
      }
    }
  }
}

reactions.set_transports_config

Minimum API version: 62

Changes reaction transport settings.

SMTP example:

{
  "method": "reactions.set_transports_config",
  "version": 74,
  "params": {
    "config": {
      "smtp": {
        "port": 465,
        "login": "my@mail.com",
        "server": "smtp.mail.com",
        "password": "gprkwgpkuprkwugp",
        "security": "SSL",
        "use_devline_service": false
      }
    }
  }
}

Push transport example:

{
  "method": "reactions.set_transports_config",
  "params": {
    "config": {
      "push": {
        "server": {
          "url": "https://push.myvms.eu/api"
        }
      }
    }
  },
  "version": 90
}

Response:

{
  "result": {}
}

reactions.get_interactive_reactions

Minimum API version: 71

Returns interactive reactions available as user buttons.

Request:

{
  "method": "reactions.get_interactive_reactions",
  "version": 71
}

Response example:

{
  "result": {
    "interactive_reactions": [
      {
        "id": "3c2e4ab5c33bc7f6",
        "name": "btn 2",
        "active": false,
        "button": {
          "client_data": {
            "duration": [0,0,0]
          }
        },
        "active_timerange": true
      }
    ]
  }
}

reactions.start_interactive_reaction

Minimum API version: 71

Starts an interactive reaction.

Request:

{
  "method": "reactions.start_interactive_reaction",
  "version": 71,
  "params": {
    "id": "3c2e4ab5c33bc7f6",
    "duration": [0,0,0]
  }
}

If duration is omitted and the reaction has a configured duration, the action behaves like a held button.

Response:

{
  "result": {}
}

Error example:

{
  "error": {
    "type": "auth",
    "message": "forbidden"
  }
}

reactions.stop_interactive_reaction

Minimum API version: 71

Stops an interactive reaction.

Request:

{
  "method": "reactions.stop_interactive_reaction",
  "version": 71,
  "params": {
    "id": "3c2e4ab5c33bc7f6"
  }
}

Response:

{
  "result": {}
}

Error example:

{
  "error": {
    "type": "auth",
    "message": "forbidden"
  }
}

Data Model

Action: write_file

Writes reaction data to a file.

{
  "type": "write_file",
  "text": "${hour}:${minute}:${second} - ${plate_direction} - ${plate_text}",
  "filename": "${day}-${month}-${year}.txt",
  "min_period": 0,
  "client_path": "D:\\\\DATA\\\\APNR\\\\"
}

Action: send_telegram

Sends a message and optionally a video clip to Telegram.

{
  "type": "send_telegram",
  "video": {
    "attach": true,
    "stream": "video",
    "duration": 5
  },
  "cameras": ["-1"],
  "addresses": ["321321"],
  "min_period": 300,
  "auto_generate": true
}

Action: send_video_to_ftp

Sends a video clip to an FTP server.

{
  "path": "",
  "type": "send_video_to_ftp",
  "video": {
    "stream": "video",
    "duration": 5
  },
  "cameras": ["-1"],
  "filename": "",
  "min_period": 300
}

Action: send_email

Sends an email and can optionally attach video.

{
  "type": "send_email",
  "video": {
    "attach": false,
    "stream": "video",
    "duration": 5
  },
  "cameras": ["-1"],
  "message": "",
  "subject": "",
  "addresses": ["email@mail.ru"],
  "min_period": 300,
  "auto_generate": true
}

Action: sound_alarm

Plays an alarm sound on matching clients.

{
  "type": "sound_alarm",
  "filename": "D:\\\\alarm.wav",
  "min_period": 60
}

Action: put_on_alarm_monitor

Places the selected camera on the alarm monitor.

{
  "type": "put_on_alarm_monitor",
  "cameras": ["-1"],
  "min_period": 0,
  "min_duration": 5
}

Action: execute_command

Starts an external command. Reaction substitution values can be passed as arguments.

{
  "type": "execute_command",
  "args": ["${plate_text}"]
}

Action: send_http_request

Sends an HTTP request from a reaction.

The HTTP reaction action supports authentication fields added by later protocol revisions, including login/password, and was subsequently extended with additional request options.

The exact field set depends on the protocol version. Use the configuration returned by reactions.get_config as the authoritative structure for the connected server.

Action: send_client_command

Sends a command to selected connected clients. Client selection can use a user/client filter.

Action: integration

Executes an action on an integrated automation device, such as a relay.

Action: post_event

Creates/posts an event as a reaction action.

Action: recording / stream state

Reaction actions can change recording behavior, including changing the record mode of a single stream.

Action: send_push

Sends a push notification to users selected by user_filter .

{
  "type": "send_push",
  "video": {
    "attach": true,
    "stream": "video",
    "duration": 5
  },
  "cameras": ["-1"],
  "user_filter": {
    "black_list": ["00000003"]
  },
  "min-period": 60,
  "auto-generate": false,
  "message": "Some text"
}

Condition: plate_recognition

{
  "type": "plate_recognition",
  "lists": ["1"],
  "inlist": true,
  "cameras": ["0"],
  "plate_min_period": 60
}

Condition: abandoned_object_detection

{
  "type": "abandoned_object_detection",
  "cameras": ["3"]
}

Condition: object_detection

{
  "type": "object_detection",
  "types": ["transport","animal","human"],
  "cameras": ["2"]
}

Condition: sabotage_detection

{
  "type": "sabotage_detection"
}

Condition: crossing_detection

{
  "type": "crossing_detection",
  "cameras": {
    "1": {
      "lines": {
        "0": {
          "in": true,
          "out": false
        }
      }
    }
  }
}

Condition: integration

Example: temperature greater than 50 on an integrated device input.

{
  "node": "3cf6f3e20af7183b",
  "type": "integration",
  "expression": {
    "type": "input_value",
    "input": "temperature",
    "value": 50,
    "operator": "greater"
  },
  "min_period": -1
}

Transports

Transport configuration is managed through reactions.get_transports_config and reactions.set_transports_config .

  • ftp
  • smtp
  • telegram
  • push
{
  "ftp": {
    "port": 21,
    "use_devline_service": false
  },
  "smtp": {
    "port": 25,
    "use_devline_service": true
  },
  "telegram": {
    "use_devline_service": true
  },
  "push": {
    "server": {
      "url": "https://push.myvms.eu/api"
    }
  }
}

Scheduling and substitution values

Reactions can be limited by time_ranges . Action strings may use substitution values such as plate text, date and time.

{
  "time_ranges": [
    {
      "dow": [0,1,2,3,4,5,6],
      "start_time": [9,0],
      "end_time": [18,0]
    }
  ]
}

Example substitution values used in the supplied configuration:

${hour}
${minute}
${second}
${day}
${month}
${year}
${plate_text}
${plate_direction}

Events

RPC

archive.get_events_list

Minimum API version: 54

Minimum MyVMS version: 8.1.0

Returns external events stored in the archive.

Parameters:

  • channel — camera/channel identifier.
  • type — event type.
  • start_time / end_time — requested interval.
  • filter — event data filter.
{
  "method": "archive.get_events_list",
  "params": {
    "channel": 0,
    "type": "general",
    "start_time": [2025, 1, 13, 10, 0, 0],
    "end_time": [2025, 1, 13, 10, 30, 0],
    "filter": {
      "data": "test"
    }
  },
  "version": 54
}

post_event

Posts an external general event to MyVMS Server. This is the current API for integrations that send incoming events to the server over HTTP RPC.

The event may be processed by reactions, written to the archive, and/or delivered to connected clients. When targets is omitted, all targets supported by the server are used.

Request:

{
  "method": "post_event",
  "params": {
    "event": {
      "type": "general",
      "camera": "0",
      "timestamp": [2026, 9, 15, 10, 30],
      "duration": [0, 0, 10],
      "source": "integration",
      "name": "External event",
      "data": "Optional event details",
      "osd": "0"
    },
    "targets": [
      { "target": "reactions" },
      { "target": "archive" },
      { "target": "clients" }
    ]
  },
  "version": 35
}

Event fields: type is required and currently must be general. camera, timestamp, duration, source, name, data, and osd are optional. If timestamp is omitted, the server uses its current time. duration is an array [hours, minutes, seconds, milliseconds]; trailing zero values may be omitted.

Targets: reactions evaluates rules with the “External event” condition; archive stores the event; clients sends it to connected clients, for example for OSD display.

events.get_templates_config

Minimum API version: 56

Returns saved event templates.

{
  "method": "events.get_templates_config",
  "version": 56
}

events.set_templates_config

Minimum API version: 56

Changes saved event templates.

Parameters:

  • config — event template configuration.
  • base_revision — configuration revision used for conflict checking.
{
  "method": "events.set_templates_config",
  "params": {
    "config": {
      "templates": ["Not present", "Violation"]
    },
    "base_revision": "5da5899ac74c2822e4bb4930d6f2ce49d2e65409"
  },
  "version": 56
}

Camera Configuration

RPC

get_camera_config

Minimum API version: 81

Minimum MyVMS version: 8.2

Returns the configuration of a camera.

Parameters:

  • camera — camera/source identifier.
{
  "method": "get_camera_config",
  "params": {
    "camera": "0"
  },
  "version": 81
}

set_camera_config

Minimum API version: 81

Minimum MyVMS version: 8.2

Changes camera configuration. The configuration structure follows the server camera configuration model.

Parameters:

  • camera — camera/source identifier.
  • config — partial camera configuration to change.
  • video/video2 record_mode: "permanent", "alarm", "none".
  • audio record_mode: "permanent", "level", "none".
{
  "method": "set_camera_config",
  "params": {
    "camera": "0",
    "config": {
      "video_streams": {
        "video2": {
          "record_mode": "permanent"
        }
      }
    }
  },
  "version": 81
}

Network

RPC

network.get_config

Minimum API version: 38

Returns server network configuration.

{
  "method": "network.get_config",
  "version": 38
}
{
  "result": {
    "config": {
      "ports": {
        "http": 9786,
        "main": 9780,
        "ping": 9877,
        "rtsp": 9784
      },
      "filters": {
        "white_list": []
      },
      "server_name": "Devline Server"
    }
  }
}

network.set_config

Minimum API version: 38

Changes server network configuration.

{
  "method": "network.set_config",
  "params": {
    "config": {
      "ports": {
        "http": 9786,
        "main": 9780,
        "ping": 9877,
        "rtsp": 9784
      },
      "filters": {
        "white_list": [
          {
            "address": "127.0.0.1"
          }
        ]
      },
      "server_name": "My Server"
    }
  },
  "version": 38
}

Response:

{
  "result": {}
}

The white list may be empty:

{
  "filters": {
    "white_list": []
  }
}

Dynamic DNS

RPC

cloud.get_config

Minimum API version: 50

Returns Dynamic DNS / cloud configuration. The user must have network configuration rights.

Request:

{
  "method": "cloud.get_config",
  "version": 50
}

Response:

{
  "result": {
    "config": {
      "api": {
        "id": "12345",
        "server": "api.myvms.net"
      },
      "enabled": true
    }
  }
}

Error:

{
  "error": {
    "type": "auth",
    "message": "forbidden"
  }
}

cloud.get_info

Minimum API version: 50

Returns server registration information from the API server.

{
  "method": "cloud.get_info",
  "version": 50
}
{
  "result": {
    "info": {
      "is_factory": false,
      "domain_name": {
        "hostname": "srv-123",
        "parent_domain": "myvms.net"
      },
      "owner_email": "example@myvms.eu",
      "remote_address": "123.123.123.123"
    }
  }
}

Network/internal error example:

{
  "error": {
    "data": {
      "code": -101
    },
    "type": "internal",
    "message": "failed to obtain connection info"
  }
}

cloud.check_domain

Minimum API version: 50

Checks whether a requested Dynamic DNS name is available.

{
  "method": "cloud.check_domain",
  "params": {
    "domain_name": {
      "parent_domain": "myvms.net",
      "hostname": "my-name"
    }
  },
  "version": 50
}

Name already registered:

{
  "result": {
    "is_free": false,
    "owner_email_sha1": "e79aaa123aa60ef0fbd60c6c1fa86613baa85749"
  }
}

Name available:

{
  "result": {
    "is_free": true,
    "owner_email_sha1": ""
  }
}

cloud.request_otp

Minimum API version: 50

Requests a one-time code for registration confirmation.

{
  "method": "cloud.request_otp",
  "params": {
    "email": "my@email.ru"
  },
  "version": 50
}
{
  "result": {}
}

Error example:

{
  "error": {
    "data": {
      "code": 400
    },
    "type": "internal",
    "message": "failed to request otp"
  }
}

-101 indicates network/connectivity problems; 400 indicates an invalid email.

cloud.register_server

Minimum API version: 50

Registers the server and assigns a Dynamic DNS name.

Parameters:

  • email — owner email.
  • otp — confirmation code.
  • domain_name — requested Dynamic DNS name.
{
  "method": "cloud.register_server",
  "params": {
    "email": "my@email.com",
    "otp": "1234QWER",
    "domain_name": {
      "hostname": "my-name",
      "parent_domain": "myvms.net"
    }
  },
  "version": 50
}

cloud.set_config

Minimum API version: 50

Enables or disables Dynamic DNS.

Parameters:

  • config.enabled — true to enable, false to disable.
{
  "method": "cloud.set_config",
  "params": {
    "config": {
      "enabled": true
    }
  },
  "version": 50
}

Cameras

RPC

get_camera_state

Returns camera state information for the specified camera. The state may include motion state, stream state, recording state, properties revision, alarm state and source state.

Resource

All cameras

URI: /cameras
Version: 1.2
MIME-types: application/json
Methods: GET

List all cameras available at server. JSON representation — objects array camera

Single cam in JSON representation:

{  "uri":  /* string */,
   "name": /* string */,
   "width":  /* number (current resolution) */,
   "height": /* number (current resolution) */,
   "image-uri": /* string */,
   "video-uri": /* string */,
   "osd-uri": /* string */,
   "ptz": {
     "pan-tilt": {
       "absolute-uri": /* string */,
       "relative-uri": /* string */
     },
     "zoom": {
       "absolute-uri": /* string */,
       "relative-uri": /* string */
     },
     "focus": {
       "absolute-uri": /* string */,
       "relative-uri": /* string */
     },
     "menu": {
       "show-uri": /* string */,
       "hide-uri": /* string */,
       "activate-uri": /* string */,
       "move-uri": /* string */
     },
     "presets-uri": /* string */
   } }

Example for resource's interaction:

GET /cameras HTTP/1.1
Host: 127.0.0.1
Accept: application/json
HTTP/1.1 200 OK
Date: Mon, 23 May 2005 21:07:53 GMT
Content-Type: application/json

[ { "uri": "http://127.0.0.1/3r5ggsbJHke",
    "name": "Newton",
    "width": 640,
    "height": 480,
    "image-uri": "http://127.0.0.1/Ogei7uquahbohyae",
    "video-uri": "http://127.0.0.1/pamua8Eif4moh6ae" },
    "osd-uri": "http://127.0.0.1/knnfHg6" },
  { "uri": "http://127.0.0.1/7GheuI95dfghk",
    "name": "Newton PTZ",
    "width": 1280,
    "height": 800,
    "image-uri": "http://127.0.0.1/PeevupeeNgeir7eu",
    "video-uri": "http://127.0.0.1/EK8Shadi3fa3noe1",
    "osd-uri": "http://127.0.0.1/Ldh485h" },
    "ptz": { "focus": { "relative-uri": "http://127.0.0.1/ahgae6Shah1oothi" },
             "menu": { "activate-uri": "http://127.0.0.1/quee0tieMe1weiRa",
                       "show-uri": "http://127.0.0.1/uGai8doosho7Ohfi",
                       "hide-uri": "http://127.0.0.1/Fohbureit0eedoo0",
                       "move-uri": "http://127.0.0.1/EiY3aach4Nuutha8" },
             "pan-tilt": { "relative-uri": "http://127.0.0.1/isai7chahCuChait" },
             "zoom": { "relative-uri": "http://127.0.0.1/quieJae7zeish3oo" },
             "presets-uri": "http://127.0.0.1/neeloe2po1Hua3xa" } },
  { "uri": "http://127.0.0.1/hdUneK3oe8",
    "name": "camera1",
    "width": 320,
    "height": 240,
    "image-uri": "http://127.0.0.1/ethieSho5ching4e",
    "video-uri": "http://127.0.0.1/cee9rahtoo4uRooh" },
    "osd-uri": "http://127.0.0.1/Jy8Uj8" },
  { "uri": "http://127.0.0.1/Heo89qli3J",
    "name": "hallway",
    "width": 320,
    "height": 240,
    "image-uri": "http://127.0.0.1/xohpai8jeQuohm6f",
    "video-uri": "http://127.0.0.1/euDaiheejiaGae3s" }
    "osd-uri": "http://127.0.0.1/Oje654fgbd" } ]
Media URL rule: obtain the current media URL from the server and use the returned value. Do not construct media URLs manually from camera indexes, ports, or assumed path formats.

Image

Single frame

URI: <image-uri of camera's object>
Version: 1.0
MIME-type: image/jpeg , image/png
Methods: GET

Request parameters:

  • quality — image quality. Set by integer from 0 (maximum compression) to 100 (maximum quality). If is not set, then using default value for this cam.
  • resolution — image resolution. If is not set, then using current resolution for this cam.
  • keep_aspect_ratio — keep aspect ratio: 0 - no, 1 - yes. Default 0(no).

Resource interaction example:

GET /ethieSho5ching4e?keep_aspect_ratio=1&resolution=640x480 HTTP/1.1
Host: 127.0.0.1
Accept: image/*
HTTP/1.1 200 OK
Date: Mon, 23 May 2005 23:15:27 GMT
Content-Type: image/jpeg
Content-Length: 23185

[Image data]
HTTP 9786 (default) GET Query string parameters: On clients where it is not possible to authorize a request using standard means (HTTP Digest/Basic Authentication), it is possible to transfer the Authorization header with one of the request parameters, for example

MP4 stream

Protocol: HTTP
Port: 9786 (default)
URI: <streaming-uri of Camera>
Methods: GET

To create a link to the stream, use the value <streaming-uri of Camera> and the stream identifier made up of the name and extension. The stream identifier can take two values:

  • sub.mp4 - secondary stream (low resolution);
  • main.mp4 - primary stream (high resolution).
Query line parameters:
  • time — the moment in time in ISO 8601 format, from which the archive will be exported.
  • duration — duration in seconds (format HH:MM:SS). Optional parameter.
  • download — allow file to be downloaded. 0 – no, 1 – yes. Default setting – 0 (no).
  • audio — audio stream (0 – without audio, 1 – with audio). Default setting – 0 (no).
  • filename — name of file.

Examples of stream links:

http://login:password@192.168.0.123:9786/cameras/6/streaming/main.mp4?
time=2021-05-12T13:00:00&duration=00:40:00&audio=1
On clients where it is not possible to authorize a request using standard means (HTTP Digest/Basic Authentication), it is possible to transfer the Authorization header with one of the request parameters, for example
http://192.168.0.123::9786/cameras/6/streaming/main.mp4?time=2021-05-12T13:00:00&
duration=00:40:00&audio=1&authorization=Basic%20d2ViOg==

RTSP stream

Protocol: RTSP
Port: 9784 (default)
URI: /cameras/<index>/streaming/<name>
Methods: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE
Limitations: Not implemented in the Windows version

To generate a link for the stream, use the camera's serial number (<index>) and stream name (<name>), which can have two values:

  • sub - second stream (low resolution);
  • main - first stream (high resolution).

Examples of stream links:

rtsp://login:@192.168.0.123:9784/cameras/0/streaming/main?audio=1
rtsp://login:password@192.168.0.123:9784/cameras/15/streaming/sub
On clients where it is not possible to authorize a request using standard means (HTTP Digest/Basic Authentication), it is possible to transfer the Authorization header with one of the request parameters, for example
rtsp://192.168.0.123:9784/cameras/2/streaming/main?authorization=Basic%20d2ViOg==

PTZ

Camera's PTZ-control

URI: <absolute-uri or relative-uri of camera's object/ptz/pan-tilt and /ptz/zoom>
Version: 1.0
MIME-types: application/json
Methods: PUT

PTZ-control prduced by record with specified objects URIs pan-tilt-data and zoom-data .

JSON-representation pan-tilt-data

{ "x": /* number */,
  "y": /* number */,
  "speed": /* number */ }

JSON-representation zoom-data:

{ "zoom": /* number */,
  "speed": /* number */ }

Valid values of speed parameter are in interval [0, 1]. Parameters x , y and zoom for commands of relative rotation set in abstract units - it is only -1 and +1 now.

Example — relative rotation from current position:

HTTP/1.1 204 No Content
Date: Tue, 24 May 2005 17:21:15 GMT

Example — relative scaling:

HTTP/1.1 204 No Content
Date: Tue, 24 May 2005 17:21:37 GMT

Camera's focus control

URI: <absolute-uri or relative-uri of camera's object/ptz/focus>
Version: 1.0
MIME-types: application/json
Methods: PUT

JSON-representation of focus data:

{ "focus": /* number */,
  "speed": /* number */ }

Valid values of speed parameter are in interval [0, 1]. Parameter focus for commands of relative focus changing set in abstract units - it is only -1 and +1 now.

Example for resource's interaction:

PUT /ahgae6Shah1oothi HTTP/1.1
Host: 127.0.0.1
Content-Type: application/json

{ "focus": -1.0,
  "speed": 1.0 }
HTTP/1.1 204 No Content
Date: Tue, 24 May 2005 17:38:27 GMT

Work with Camera's On-Screen Menu

URI: <activate-uri, show-uri, hide-uri and move-uri of camera's object/ptz/menu>
Version: 1.0
MIME-types: application/json
Methods: PUT

Resources self-provide commands executed by method PUT. Into resources with activate-uri (choice menu item), show-uri (show menu) hide-uri (hide menu) allowed record without request body.

Menu moving proceed by recording menu's command into resource with move-uri .

JSON-representation menu's command:

{ "action": /* string */ }

Where action valid in one of: left , right , up or down .

Example for menu's interaction — show menu:

PUT /uGai8doosho7Ohfi HTTP/1.1
Host: 127.0.0.1
HTTP/1.1 204 No Content
Date: Tue, 24 May 2005 13:28:15 GMT

Moving bottom to the next menu item:

PUT /EiY3aach4Nuutha8 HTTP/1.1
Host: 127.0.0.1
Content-Type: application/json

{ "action": "down" }
HTTP/1.1 204 No Content
Date: Tue, 24 May 2005 13:28:19 GMT

Choice menu item:

PUT /quee0tieMe1weiRa HTTP/1.1
Host: 127.0.0.1
HTTP/1.1 204 No Content
Date: Tue, 24 May 2005 13:28:22 GMT

Hide menu:

PUT /Fohbureit0eedoo0 HTTP/1.1
Host: 127.0.0.1
HTTP/1.1 204 No Content
Date: Tue, 24 May 2005 13:28:24 GMT

All Cameras’ PTZ-presets.

URI: <presets-uri camera's object>
Version: 1.0
MIME-types: application/json
Methods: GET, POST

Single Camera's PTZ-preset.

Example for resource's interaction:

Single Camera's PTZ-preset

URI: <preset-uri PTZPreset object>
Version: 1.0
MIME-types: application/json
Methods: DELETE, GET, PUT

JSON representation:

{ "name": /* string */,
	"activate-uri": /* string */,
	"preview-uri": /* string */,
	"update-uri": /* string */ }

Example for resource's interaction:

GET /phiwohGh5aer0ye4 HTTP/1.1
Host: 127.0.0.1
Accept: application/json
HTTP/1.1 200 OK
Date: Tue, 24 May 2005 14:39:18 GMT
Content-Type: application/json

{ "name": "Xyzzy!",
  "activate-uri": "http://127.0.0.1/ju9moT7wuciiW7ae",
  "preview-uri": "http://127.0.0.1/eite4ohLiQu5Veoc",
  "update-uri": "http://127.0.0.1/WieB4ahng4ieghi9" }

PTZ-preset's image preview

URI: <preview-uri PTZPreset object>
Version: 1.0
MIME-types: image/jpeg , image/png
Methods: GET

Size of preview image depends from camera.

Example for resource's interaction:

GET /eite4ohLiQu5Veoc HTTP/1.1
Host: 127.0.0.1
Accept: image/png
HTTP/1.1 200 OK
Date: Tue, 24 May 2005 11:27:16 GMT
Content-Type: image/png
Content-Length: 2108

[Image Data]

Media

Resource

JPEG / Single Frame

A single JPEG frame is requested through the camera image resource. Current frame requests may use quality , resolution and keep_aspect_ratio .

Protocol version 90 extends the JPEG resource with archive-frame access. Archive requests may include stream , time , resolution and keep_aspect_ratio .

Obtain media URLs from the server and use the returned value. Do not rely on a hard-coded internal media URL layout.

HLS

HLS resources expose primary and secondary streams as main.m3u8 and sub.m3u8 .

MP4

MP4 resources expose main.mp4 and sub.mp4 . Archive/export parameters include time , duration , download , audio and filename .

RTSP

RTSP resources expose primary and secondary streams as main and sub .

PTZ

Resource

PTZ

Camera's PTZ-control

URI: <absolute-uri or relative-uri of camera's object/ptz/pan-tilt and /ptz/zoom>
Version: 1.0
MIME-types: application/json
Methods: PUT

PTZ-control prduced by record with specified objects URIs pan-tilt-data and zoom-data .

JSON-representation pan-tilt-data

{ "x": /* number */,
  "y": /* number */,
  "speed": /* number */ }

JSON-representation zoom-data:

{ "zoom": /* number */,
  "speed": /* number */ }

Valid values of speed parameter are in interval [0, 1]. Parameters x , y and zoom for commands of relative rotation set in abstract units - it is only -1 and +1 now.

Example — relative rotation from current position:

HTTP/1.1 204 No Content
Date: Tue, 24 May 2005 17:21:15 GMT

Example — relative scaling:

HTTP/1.1 204 No Content
Date: Tue, 24 May 2005 17:21:37 GMT

Camera's focus control

URI: <absolute-uri or relative-uri of camera's object/ptz/focus>
Version: 1.0
MIME-types: application/json
Methods: PUT

JSON-representation of focus data:

{ "focus": /* number */,
  "speed": /* number */ }

Valid values of speed parameter are in interval [0, 1]. Parameter focus for commands of relative focus changing set in abstract units - it is only -1 and +1 now.

Example for resource's interaction:

PUT /ahgae6Shah1oothi HTTP/1.1
Host: 127.0.0.1
Content-Type: application/json

{ "focus": -1.0,
  "speed": 1.0 }
HTTP/1.1 204 No Content
Date: Tue, 24 May 2005 17:38:27 GMT

Work with Camera's On-Screen Menu

URI: <activate-uri, show-uri, hide-uri and move-uri of camera's object/ptz/menu>
Version: 1.0
MIME-types: application/json
Methods: PUT

Resources self-provide commands executed by method PUT. Into resources with activate-uri (choice menu item), show-uri (show menu) hide-uri (hide menu) allowed record without request body.

Menu moving proceed by recording menu's command into resource with move-uri .

JSON-representation menu's command:

{ "action": /* string */ }

Where action valid in one of: left , right , up or down .

Example for menu's interaction — show menu:

PUT /uGai8doosho7Ohfi HTTP/1.1
Host: 127.0.0.1
HTTP/1.1 204 No Content
Date: Tue, 24 May 2005 13:28:15 GMT

Moving bottom to the next menu item:

PUT /EiY3aach4Nuutha8 HTTP/1.1
Host: 127.0.0.1
Content-Type: application/json

{ "action": "down" }
HTTP/1.1 204 No Content
Date: Tue, 24 May 2005 13:28:19 GMT

Choice menu item:

PUT /quee0tieMe1weiRa HTTP/1.1
Host: 127.0.0.1
HTTP/1.1 204 No Content
Date: Tue, 24 May 2005 13:28:22 GMT

Hide menu:

PUT /Fohbureit0eedoo0 HTTP/1.1
Host: 127.0.0.1
HTTP/1.1 204 No Content
Date: Tue, 24 May 2005 13:28:24 GMT

All Cameras’ PTZ-presets.

URI: <presets-uri camera's object>
Version: 1.0
MIME-types: application/json
Methods: GET, POST

Single Camera's PTZ-preset.

Example for resource's interaction:

Single Camera's PTZ-preset

URI: <preset-uri PTZPreset object>
Version: 1.0
MIME-types: application/json
Methods: DELETE, GET, PUT

JSON representation:

{ "name": /* string */,
	"activate-uri": /* string */,
	"preview-uri": /* string */,
	"update-uri": /* string */ }

Example for resource's interaction:

GET /phiwohGh5aer0ye4 HTTP/1.1
Host: 127.0.0.1
Accept: application/json
HTTP/1.1 200 OK
Date: Tue, 24 May 2005 14:39:18 GMT
Content-Type: application/json

{ "name": "Xyzzy!",
  "activate-uri": "http://127.0.0.1/ju9moT7wuciiW7ae",
  "preview-uri": "http://127.0.0.1/eite4ohLiQu5Veoc",
  "update-uri": "http://127.0.0.1/WieB4ahng4ieghi9" }

PTZ-preset's image preview

URI: <preview-uri PTZPreset object>
Version: 1.0
MIME-types: image/jpeg , image/png
Methods: GET

Size of preview image depends from camera.

Example for resource's interaction:

GET /eite4ohLiQu5Veoc HTTP/1.1
Host: 127.0.0.1
Accept: image/png
HTTP/1.1 200 OK
Date: Tue, 24 May 2005 11:27:16 GMT
Content-Type: image/png
Content-Length: 2108

[Image Data]

Camera On-Screen Menu support should be verified against the current IP-camera implementation.

Microphones / Audio

Resource

Microphones

All microphones

URI: /microphones
Version: 1.2
MIME-types: application/json
Methods: GET

List all microphones available at server.

JSON representation — objects array microphone .

Single microphone in JSON representation:

{ "uri":  /* string */,
  "name": /* string */,
  "audio-uri": /* string */,
  "camera-uri": /* string */ }

Example for resource's interaction:

GET /microphones HTTP/1.1
Host: 127.0.0.1
Accept: application/json
HTTP/1.1 200 OK
Date: Mon, 23 May 2005 21:07:53 GMT
Content-Type: application/json

[ { "uri": "http://127.0.0.1/6Hjk9l4dudlf",
    "name": "Newton",
    "audio-uri": "http://127.0.0.1/Ogei7uquahbohyae",
    "camera-uri": "http://127.0.0.1/pamua8Eif4moh6ae" },
  { "uri": "http://127.0.0.1/Pqja954nfrdqcb",
    "name": "Microphone1",
    "audio-uri": "http://127.0.0.1/ethieSho5ching4e",
    "camera-uri": "http://127.0.0.1/cee9rahtoo4uRooh" },
  { "uri": "http://127.0.0.1/Q57mak8maogk",
    "name": "Hallway",
    "audio-uri": "http://127.0.0.1/xohpai8jeQuohm6f",
    "camera-uri": "http://127.0.0.1/euDaiheejiaGae3s" } ]

Audio Stream

Audio Stream

URI: <audio-uri Microphone object>
Version: 1.1
MIME-types: audio/x-wav , audio/mpeg
Methods: GET

Request parameters:

  • sample_rate — signal sampling rate. Valid values in [8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000] Hz. If is not set. then using value equal 22050.
  • bit_rate — bitrate, e.g. 128. If is not set, using 64 kbps for audio/mpeg and 22050 * 16 bps (22.05 kHz * 16 bit) for audio/x-wav.

Example for resource's interaction:

GET /ethieSho5ching4e?sample_rate=44100&bit_rate=128 HTTP/1.1
Host: 127.0.0.1
Accept: audio/mpeg
HTTP/1.1 200 OK
Date: Mon, 23 May 2005 23:15:27 GMT
Content-Type: audio/mpeg

[Audio data]

Audio broadcasting lasts until disconnect by any side.

Users

RPC

User and group management is exposed through the users.* method family.

users.get_user_clients

Returns the list of allowed clients for a user.

users.remove_user_allowed_client

Removes a client from a user's allowed-client list.

users.clear_user_allowed_clients

Minimum API version: 69

Clears the allowed-client list for a user.

{
  "method": "users.clear_user_allowed_clients",
  "version": 69,
  "params": {
    "user": "00000013"
  }
}
{
  "result": {}
}

Error:

{
  "error": {
    "type": "invalid_param",
    "message": "id"
  }
}

Data Model

System user settings are presented as lists of groups and users. Each user can be included in one group or have settings independent of groups. One group cannot be included in another group. The main system user ("admin" by default) cannot inherit settings of groups and have any kind of rights restrictions. The list of permissible changes to settings for the main user is limited to setting the username and password pair and changing the views of the cameras on the screen.

Including a user in a group is done by assigning an identifier of the parent group to the list of user attributes. A user, included in a group, can both inherit each individual configuration attribute of the parent group and override its value. For example, the user can inherit the list of accessible video devices but have a unique list of audio devices. If the user’s attribute value is assigned, then the attribute is considered overridden, if not, then inherited. If the attribute is not defined for either the user or parent group, then the user does not have the restrictions corresponding to that attribute, for example, if the list of devices is not assigned, then all devices are available.

User Attributes

Mandatory:

  • id - identifier;
  • name - name;
  • secret - user secret, calculated as MD5 (username:realm:password), where the value "realm", actual to the server, can be obtained using the "auth" RPC method.

Optional:

  • group - parent group identifier;
  • description - description;
  • enabled - activity, by default: true;
  • expiration_time - activity end-time;
  • time_ranges - list of weekdays and activity timeframes;
  • video_devices - list of available video devices;
  • audio_devices - list of available audio devices;
  • ptz_devices - list of available PTZ devices;
  • server_operations - list of available server operations;
  • client_operations - list of available client operations;
  • views - if not defined, then the list of views is inherited from the parent group.

Group Attributes

Mandatory:

  • id - identifier;
  • name — name.

Optional:

  • description - description;
  • enabled - activity, by default: true;
  • expiration_time - activity end-time;
  • time_ranges - list of weekdays and activity timeframes;
  • video_devices - list of available video devices;
  • audio_devices - list of available audio devices;
  • ptz_devices - list of available PTZ devices;
  • server_operations - list of available server operations;
  • client_operations - list of available client operations.

Operation Rights

The list of operation rights is in the form of a dictionary in which operations identifiers are used as the keys, and true or false as the values. The set of all operations available to the user are split into two lists: server and client operations. The server can control only a limited set of operations carried out by the user, for example, changing the configuration and access to the archive, but cannot control, for example, minimizing the client application windows, saving images and using digital zoom. Several operations may be restricted on both the server and client, while further prohibition of operations on the client is necessary only for ease of interaction with the program (absence of interface elements for operations prohibited on the server).

Server operations:

  • archive_access - access the archive;
  • archive_events_add - add events to the archive;
  • archive_events_access - access events in the archive;
  • adm_configuration - access to change configuration files;
  • adm_users - change user settings;
  • adm_video - change video device settings;
  • adm_audio - change audio device settings;
  • adm_ptz - change PTZ device settings;
  • adm_archive - change archive recording settings;
  • adm_network - change network settings;
  • adm_analytics - change video analytics settings;
  • adm_reactions - change response settings;
  • adm_licensing - access licensing settings;
  • adm_userlog - access user log;
  • adm_filesystem - access server file system;
  • adm_monitoring - access server state monitoring.

Client operations:

  • find_server - search for servers;
  • select_views - switch camera view;
  • cam_assignment - change location of cameras in the view;
  • change_cam_stream - switch camera stream display;
  • change_all_cams_stream - simultaneous switching of stream display for all cameras;
  • use_zoom - digital image zoom;
  • save_cam_frame - save frames;
  • setup_cam_color - rapid change of camera image parameters;
  • view_archive - view archive;
  • view_archive_in_folder - view archive from specified folder;
  • export_archive - export archive;
  • decompose_frames - breakdown of archive into individual frames;
  • view_archive_events - archive event viewing;
  • add_archive_events - adding events to the archive;
  • enter_in_adm - server administration;
  • adm_view_monitoring - server state monitoring;
  • adm_view_analytics - access video analytics settings;
  • adm_access_to_filesystem - access to server file system;
  • adm_setup_licensing - access to licensing settings;
  • adm_setup_users - access to user settings;
  • adm_setup_video - access to video device settings;
  • adm_setup_audio - access to audio device settings;
  • adm_setup_ptz - access to PTZ device settings;
  • adm_setup_network - access to network settings;
  • adm_setup_archive - access to archive recording settings;
  • adm_setup_reactions - access to reaction settings;
  • adm_view_userlog - access to user log;
  • close_program - program termination;
  • maximize_window - maximize program window to full screen;
  • minimize_window - minimize program windows.

Examples of User and Group Settings

User without rights restrictions:

1{
2    "id" : "00000000",
3    "name" : "admin",
4    "secret" : "d87fab4d658bc121c37936fb957d2fa5" 
5}

Disconnected user with limited device list:

1{
2    "id" : "00000001",
3    "name" : "user",
4   "secret" : "d87fab4d658bc121c37936fb957d2fa5",
5    "description" : "Some text. Some text.",
6    "enabled" : false,
7    "video_devices" : [ "3", "11" ]
8}

User, active until 2:14 AM, August 29, 1997:

1{
2    "id" : "00000001",
3    "name" : "user",
4    "secret" : "d87fab4d658bc121c37936fb957d2fa5",
5    "expiration_time" : [1997,8,29,2,14,00]
6}

Group of users with limited operations list and user, included in it, who inherits operations restrictions and has his own restrictions on operating time (Mon-Fri 08:00-19:00 and Sat-Sun 10:00-15:00):

1{
2    "id" : "00000001",
3    "name" : "Group1",
4    "server_operations" : { "archive_access" : true },
5    "client_operations" : { "view_archive" : true, "save_cam_frame" : true }
6}
1{
2    "id" : "00000001",
3    "name" : "User1",
4    "group" : "00000001",
5    "secret" : "d87fab4d658bc121c37936fb957d2fa5",
6    "time_ranges" : [
7        {
8            "dow" : [0,1,2,3,4],
9            "start_time" : [8,0,0],
10            "end_time" : [19,0,0]
11        },
12        {
13            "dow" : [5,6],
14            "start_time" : [10,0,0],
15            "end_time" : [15,0,0]
16        }
17    ]
18}

User inheriting all parent group attributes but with his own list of available camera locations on the screen:

1{
2    "id" : "00000002",
3    "name" : "user",
4    "secret" : "d87fab4d658bc121c37936fb957d2fa5",
5    "views" : {}
6}

users.get_users

Minimum API version: 12

Getting a list of server users.

Request Example:

1{
2    "method" : "users.get_users",
3    "version" : 12
4}

Response Example:

1{
2    "result" : {
3        "users" : [
4            {
5                "id" : "00000000",
6                "name" : "admin",
7                "secret" : "4fe612b4dcf238983ae0ad620ce4961c" 
8            },
9            {
10                "id" : "00000001",
11                "name" : "user",
12                "secret" : "3ae0ad620ce4961c4fe612b4dcf23898",
13                "video_devices" : ["2", "4"]
14            }
15        ]
16    }
17}

users.get_user

Minimum API version: 12

Getting user settings.

Request parameters:

  • id - user ID.

Request Example:

1{
2    "method" : "users.get_user",
3    "params" : { "id" : "00000000" },
4    "version" : 12
5}

Response Example:

1{
2    "result" : {
3        "user" : {
4            "id" : "00000000",
5            "name" : "admin",
6            "secret" : "4fe612b4dcf238983ae0ad620ce4961c" 
7        }
8    }
9}

users.add_user

Minimum API version: 12

Adding a user.

Request parameters:

  • user - set of user attributes without identifier.

Request Example:

1{
2    "method" : "users.add_user",
3    "params" : {
4        "user" : {
5            "name" : "test",
6            "secret" : "fef6bd724619600ebb1de3936337e942" 
7        }
8    },
9    "version" : 12
10}

Response Example:

1{
2    "result" : {
3        "user" : {
4            "id" : "00000003" 
5        }
6    }
7}

users.remove_user

Minimum API version: 12

Removing a user.

Request parameters:

  • id - user ID.

Request Example:

1{
2    "method" : "users.remove_user",
3    "params" : { "id" : "00000002" },
4    "version" : 12
5}

Response Example:

1{
2    "result" : {}
3}

Error Example:

1{
2    "error" : {
3        "type" : "invalid_param",
4        "message" : "id" 
5    }
6}

users.modify_user

Minimum API version: 12

Changing user settings.

Request parameters:

  • user - set of modifiable user attributes, including user ID.

If disabling a user is required, it is recommended to include only essential, for example, only "enabled", changes in the set of attributes to be changed. All user attributes not included in the parameters will remain unchanged after the request has been executed.

Example of request to disconnect user:

1{
2    "method" : "users.modify_user",
3    "params" : {
4        "user" : {
5            "id" : "00000003",
6            "enabled" : false
7        }
8    },
9    "version" : 12
10}

Example of request to connect user to a group:

1{
2    "method" : "users.modify_user",
3    "params" : {
4        "user" : {
5            "id" : "00000003",
6            "group" : "00000002" 
7        }
8    },
9    "version" : 12
10}

Example of request to change list of user’s accessible video devices:

1{
2    "method" : "users.modify_user",
3    "params" : {
4        "user" : {
5            "id" : "00000003",
6            "video_devices" : [ "4", "12" ]
7        }
8    },
9    "version" : 12
10}

Example of request to remove restrictions to user’s list of accessible video devices (if the user is included in a group then after the request is executed he will inherit the parent group’s list; if the user is independent of the group, he won’t have any video device restrictions):

1{
2    "method" : "users.modify_user",
3    "params" : {
4        "user" : {
5            "id" : "00000003",
6            "video_devices" : null
7        }
8    },
9    "version" : 12
10}

Response Example:

1{
2    "result" : {}
3}

users.get_groups

Minimum API version: 12

Getting list of server user groups.

Request schema similar to users.get_users .

users.get_group

Minimum API version: 12

Getting user group settings.

Request parameters:

  • id - group identifier.

Request schema similar to users.get_user .

users.add_group

Minimum API version: 12

Adding user group.

Request parameters:

  • group - set of group attributes.

Request schema similar to users.add_user .

users.remove_group

Minimum API version: 12

Removing user group.

Request parameters:

  • id - group identifier.

Request schema similar to users.remove_user .

users.modify_group

Minimum API version: 12

Changing user group settings.

Request parameters:

  • group - set of modifiable group attributes, including group identifier.

Request schema similar to users.modify_user .

users.get_user_views

Minimum API version: 12

Getting list of views accessible to user.

Request parameters:

  • id - user ID.

Request Example:

1{
2    "method" : "users.get_user_views",
3    "params" : { "id" : "00000002" },
4    "version" : 12
5}

users.set_user_views

Minimum API version: 12

Changing set of views accessible to user.

Request parameters:

  • id - user identifier;
  • views - set of views.

users.get_group_views

Minimum API version: 12

Getting list of views accessible to user group.

Request parameters:

  • id - group identifier.

Request Example:

1{
2    "method" : "users.get_group_views",
3    "params" : { "id" : "00000002" },
4    "version" : 12
5}

users.set_group_views

Minimum API version: 12

Changing list of views accessible to user group.

Request parameters:

  • id - group identifier;
  • views - set of views.

Licensing

RPC

licensing.get_cards

Returns activated license cards.

licensing.add_cards

Activates supplied license codes. Invalid codes may be returned in the result as invalid_codes .

Privacy Mask

RPC

privacy_mask.get_config

Returns privacy-mask configuration for a camera.

privacy_mask.set_config

Changes privacy-mask configuration for a camera.

OSD

Resource

Creating OSD

URI: <osd-uri Camera's object>
Version: 1.5
MIME-types: application/json
Methods: POST

Request body in JSON representation:

 { "name": /* string */,
   "left": /* number */,
   "top":  /* number */,
   "font-size":  /* number */,
   "font-color": /* string */,
   "line-count": /* number */,
   "draw-background": /* number */ }

Output coordinates and font size set in % related to frame sizes.

Parameter <font-color> set with link like #RGB, where R, G, B - value of color parts at hex-form in interval [0..255].

Example: #FF0000, #0A5B4F.

Parameter set text background notation (blacking-out or clarification depends from luminance of text color): 0 - no notation, 1 - notate.

Success server answer on this request:

HTTP/1.1 201 Created
Location: <URI OSD>

Example for resource's interaction:

POST <osd-uri object Camera> HTTP/1.1
Host: 127.0.0.1
Content-Type: application/json

{ "name": "xyz",
    "left": 10,
    "top": 20,
    "font-size": 10,
    "font-color": "#00FF00",
    "line-count": 10,
    "draw-background": 1 }
HTTP/1.1 201 Created
Date: Mon, 23 May 2005 23:15:27 GMT
Location: <osd-uri object Camera>/xyz

Removing OSD-object

URI: <URI OSD object>
Version: 1.2
Methods: DELETE

Example for resource's interaction:

DELETE <URI OSD-object> HTTP/1.1
Host: 127.0.0.1
HTTP/1.1 204 No content
Date: Mon, 23 May 2005 23:15:27 GMT

Adding content to OSD-object

URI: <URI OSD object>
Version: 1.2
MIME-types: text/plain
Methods: POST

Example for resource's interaction:

POST <URI OSD-object> HTTP/1.1
Host: 127.0.0.1
Content-Type: text/plain
Content-Length: 15

Hello, world!!!
HTTP/1.1 201 Created
Date: Mon, 23 May 2005 23:15:27 GMT

Removing content from OSD-object

URI: <URI OSD object>/clear
Version: 1.2
MIME-types: text/plain
Methods: PUT

Example for resource's interaction:

PUT <URI OSD-object>/clear HTTP/1.1
Host: 127.0.0.1
HTTP/1.1 204 No content
Date: Mon, 23 May 2005 23:15:27 GMT

ANPR / Plate Recognizer

RPC

How to receive:

{
    "method" : "plate_recognizer.get_lists_config",
    "version" : @version
}

By receiving a response to the plate_recognizer.get_lists_config query:

{
    "result" : {
        "config" : {
            "lists" : [
                ...
            ]
        },
        "revision" : "1c468c284ec9409fa070c7522a6bc2f710ccc3d5" 
    }
}

- revision - only computed by the server, since the notation of settings may be various (msgpack/json/etc.).*
A query to change the settings

How to send:

{
    "method" : "plate_recognizer.set_lists_config",
    "params" :
    {
        "config" :
        {
            "lists" :
            [
                {
                    "id" : "0",
                    "client_data" : 
                    {
                        "name" : "Persons paid for parking",
                        "description" : "Good chaps",
                    },
                    "entries" :
                    [
                        {
                            "text" : "A123BC456",
                            "client_data" : 
                            {
                                "name" : "Jones",
                                "description" : "Entrance 1, flat 13, tel: +000000000" 
                            }
                        },
                        {
                            "text" : "A321BC654",
                            "client_data" :
                            {
                                "name" : "Smith",
                                "description" : "Entrance 2, flat 24, tel: +000000000" 
                            }
                        }
                    ]
                },
                {
                    "id" : "1",
                    "client_data" : 
                    {
                        "name" : "Persons haven’t paid for parking",
                        "description" : "Bad chaps",
                    },
                    "entries" :
                    [
                        {
                            "text" : "B321CA456",
                            "client_data" : 
                            {
                                "name" : "Williams",
                                "description" : "Entrance 3, flat 39, tel: +000000000" 
                            }
                        }
                    ]
                }
            ]
     },
     "base_revision" : "fa2421b790e473508b60f6c78ce66f3e84a610ca" 
 },
 "version" : @version
}

- Among all the attributes in the list, only id and entries are important to the server. The rest of the parameters are shown just for demonstration purposes.
- base_revision is an optional parameter. If it is not set, the list will be accepted and saved without any check. If it is set, the server will compare it to the current value of “revision” in the settings, and in case the values coincide, then the list shall be accepted and saved. If they do not coincide, the server will return an error indicating the actual value of “revision” which it expects in such a query:

config
{
    "error" : {
        "type" : "invalid_param",
        "message" : "base_revision",
        "data" : {
            "revision" : "1c468c284ec9409fa070c7522a6bc2f710ccc3d5" 
        },
    }
}

Server Configuration

RPC

Any changes to the server configuration, for example, a change to the list of users and their rights, camera settings, archive recording parameters etc. are temporary once implemented and can be canceled by a client command or after restarting the server. Changes to server settings can only be fixed to the configuration files by using a client command.

settings.accept

Minimum API version: 13

Saving current server settings to configuration files.

Request Example:

1{
2    "method" : "settings.accept",
3    "version" : 13
4}

Response Example:

1{
2    "result" : {}
3}

settings.reset

Minimum API version: 13

Resetting all current server settings to a previous state saved in the configuration files.

Request Example:

1{
2    "method" : "settings.reset",
3    "version" : 13
4}

Response Example:

1{
2    "result" : {}
3}

Archive

RPC

archive.get_config

Returns archive configuration.

Archive Timeline

From this point on, timeline is understood to mean bit representation of information about the presence of a recording in the archive: whether there is an archive per unit of time or not. In this definition, the unit of time acts as the timeline’s resolution. The server enables timelines to be obtained with any resolution up to 1 second. The resolution does not have to be a multiple of 1 second, minute, day etc. Any timeline can be calculated precisely, for example, up to 10 seconds, 16 seconds, 2 minutes, 30 minutes, 7 days etc.

Examples of Timelines:
  • [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0] – timeline from January 1, 2016 to January 1, 2017 with resolution of 1 month. In this case, it is clear that the archive for February and March is available on the server;
  • [1, 0] – timeline from January 1, 2016 to January 1, 2017 with resolution of 6 months. The archive is available for the first half of 2016;
  • [0, 1, 0] – timeline from January 1, 2015 to January 1, 2018 with resolution of 1 year. The archive for 2016 is available;
  • [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] – timeline for February 2016. The archive for February 5 and 17 is available. Remember when constructing timelines that the number of days for any month of any year is set at 31, i.e. when requesting the timeline for May, June and July the server will return an array of 93 elements, where the element corresponding to June 31 will always equal zero as such a day does not exist.
  • [0, 0, 0, 0, 0, 0, 1, 1, 0, 0] – timeline from 00:30 March 10, 2016 to 00:41 March 10, 2016. Archive is available for 00:36 and 00:37.

archive.get_frames_timeline

Getting a timeline.

Request parameters:

  • channel – channel identifier is optional: if not specified, all available ones are used;
  • stream – stream identifier ("video", "video2", "video3", "audio");
  • start_time – timeline start-time;
  • end_time – timeline end-time;
  • unit_len – timeline resolution in seconds.

Response Example:

  • timeline - requested timeline (see description in "Data formats" section).

Request sample for the list of days in February, 2016 where a record for at least one camera is available:

1{
2  "method" : "archive.get_frames_timeline",
3  "params" :
4  {
5    "start_time" : [2016, 2, 1],
6    "end_time" : [2016, 3, 1],
7    "unit_len" : 86400 //the number of seconds per day - 60 * 60 * 24
8  }
9}

Response Example:

1{    
2  "result" :
3  {
4    "timeline" : [0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
5  }
6}

Request sample for the list of minutes for substream archive of camera 0 on the 1st of February, 2016:

1{
2  "method" : "archive.get_frames_timeline",
3 "params" :
4  {
5    "channel" : 0,
6    "stream" : "video2",
7    "start_time" : [2016, 2, 1],
8   "end_time" : [2016, 2, 2],
9    "unit_len" : 60
10  }
11}

Response Example:

1{    
2  "result" :
3  {
4    "timeline" : [0, 0, 1, ... , 0, 0, 1] //the array consists of 1440 elements
5  }
6}

archive.get_motions_timeline

Gets a timeline by a customised filter: by zone/s of motion detection, object size, object colors(videoanalytics at playback)

Request parameters:

  • channel - optional channel identifier(if not set, all available channels are used);
  • start_time - begin of time interval;
  • end_time - end of time interval (duration of a time interval mustn't be longer than 5 minuties);
  • unit_len -a scale of a timeline unit(seconds);
  • filter - an object contains of customized filter parameters.

Filter parameters(all parameters are optional):

  • min_area - minimal size of detected object( from all size of a frame). Value(float number) from 0.0 to 1.0, for example - 0.1 for detected object not less than 10% from a size of a frame;
  • max_area - maximum size of detected object;
  • mask64 - 64-bit matrix 8х8 which contains 64 cells of a frame and represented as a string of 64 symbols each of them could be "0" or "1". For example "0000000000010000000000000000000000000000000000000000000000000000", it is requested of an existing of motion detection at the 4th cell at the 2nd row of a frame;
  • colors - an array, where each elements consist of an array of 3 numbers, corresponding to RGB-elements of searching color(range [0, 255]).

Response sample:

  • timeline - requested timeline (see description in "Data formats" section).

Request sample:

1{
2  "method" : "archive.get_motions_timeline",
3  "params" :
4  {
5    "start_time" : [2016, 2, 1, 18, 0, 0],
6    "end_time" : [2016, 2, 1, 18, 5, 0],
7    "unit_len" : 60,
8    "filter" : 
9    {
10       "min_area" : 0.03,
11       "colors" : [[120, 16, 23], [43, 55, 233]]
12    }
13  }
14}

Response sample:

1{    
2  "result" :
3  {
4    "timeline" : [0, 1, 0, 0, 1]
5  }
6}

archive.get_channels_list

Gets list of cameras, records for which are available in archive, for particular time interval.

Request parameters:

  • start_time - begin of time interval;
  • end_time - end of time interval.

Response content:

  • channels - array of channels, where each element corresponds to one channel.

Every element of “channels” array contains the following fields:

  • channel - channel identifier.

Request sample:

1{
2  "method" : "archive.get_channels_list",
3  "params" :
4  {
5   "start_time" : [2016, 1, 6],
6    "end_time" : [2016, 1, 7]
7  }
8}

Response sample:

1{    
2  "result" :
3  {
4    "channels" :
5    [
6      {
7        "channel" : 0
8      },
9      {
10        "channel" : 1
11      }
12    ]
13  }
14}

archive.get_streams_list

Gets streams for particular camera and for particular time interval that are available in archive.

Request parameters:

  • channel - channel identifier;
  • start_time - begin of time interval;
  • end_time - end of time interval.

Response content:

  • streams - array of streams, where each elements corresponds to one stream.

Every element of “streams” array contains the following fields:

  • stream - stream identifier.

Request sample:

1{
2  "method" : "archive.get_streams_list",
3  "params" :
4  {
5    "channel" : 0,
6    "start_time" : [2016, 1, 6],
7    "end_time" : [2016, 1, 7]
8  }
9}

Response sample:

1{    
2  "result" :
3  {
4    "streams" :
5    [
6      {
7        "stream" : "video" 
8      },
9      {
10        "stream" : "video2" 
11      },
12      {
13        "stream" : "video3" 
14      },
15      {
16        "stream" : "audio" 
17      },
18    ]
19  }
20}

archive.get_frames_list

Gets a list of frames.

Request sample:

  • channel - channel identifier;
  • stream - stream identifier;
  • start_time - begin of time interval;
  • end_time - end of time interval.

Response content:

  • frames_list - array of frames, where each elements corresponds to one frame.

Every element of “frames_list” array contains the following fields:

  • id - frame identifier;
  • gop_index - ordinal number of a frame at GOP, 0 - I-frame;
  • timestamp - frame time.

Request sample: getting list of frames for type "video" and camera 0 at 13:00 on the 1st of March 2016:

1{
2  "method" : "archive.get_frames_list",
3  "params" :
4  {
5    "channel" : 0,
6    "stream" : "video",
7    "start_time" : [2016, 3, 1, 13, 0],
8    "end_time" : [2016, 3, 1, 14, 0]
9  }
10}

Response sample:

1{    
2  "result" :
3  {
4    "frames_list" : 
5    [
6      {
7        "id" : "f9lk3jfs42df41fsdj4",
8        "gop_index" : 12,
9        "timestamp" : [2016, 3, 1, 13, 11, 43, 543]
10      },      
11      {
12        "id" : "kdj48dh2n",
13        "gop_index" : 13,
14       "timestamp" : [2016, 3, 1, 13, 11, 43, 659]
15      },
16      ... ,
17      {
18        "id" : "ja4wds94dk34",
19        "gop_index" : 2,
20        "timestamp" : [2016, 3, 1, 13, 58, 12, 78]
21      }
22    ]
23  }
24}

archive.get_frame

Gets information about particular frame. This method supports only "application/x-msgpack" format.

Request sample:

  • channel - channel identifier;
  • stream - stream identifier;
  • id - frame identifier.

Response content:

  • frame - an object with metadata and information about a frame.

"Frame" object contains the following fields:

  • info - object with information about a frame;
  • raw_bytes - raw frame data.

Content of an object "info"- video request :

  • timestamp - frame timestamp;
  • gop_index - ordinal number of a frame at GOP;
  • width (might be omited) - frame width;
  • height (might be omited) - frame height;
  • codec - one of the following values: "h264", "mpeg4", "mjpeg".

Content of an object "info"- audio request:

  • timestamp - frame timestamp;
  • codec - currently the only possible value is "pcm";
  • channels - number of audio channels;
  • sps - numbers of samples per second;
  • bps - number of bits per second.

Request sample:

1{
2  "method" : "archive.get_frame",
3  "params" :
4  {
5    "channel" : 0,
6    "stream" : "video",
7    "id" : "deadbeef" 
8  }
9}

Response sample:

1{
2  "result" :
3  {
4    "frame" :
5    {
6      "info" : 
7      {
8        "timestamp" : [2016, 12, 23, 12, 54, 26, 943],
9        "gop_index" : 21,
10        "codec" : "h264" 
11      },
12      "raw_bytes" : ...
13    }
14  }
15}

archive.seek_frame

Searching for nearest frame in the archive. Getting frame data only supported in application/x-msgpack format.

Request parameters:

  • channel – channel identifier;
  • stream – stream identifier;
  • start_time – start time for frame search;
  • direction – direction of frame search as "forward" or "backward" string;
  • read_data – flag indicating need to read frame data from disc as well as information about it.

Response content:

  • frame – dictionary with metadata and frame data in the event that "read_data" flag is set.

Content of the "frame" dictionary field corresponds completely to the contents of the dictionary of the same name in response to "archive.get_frame" method.

If the server is unable to find any frames, an error will be returned.

Request Example:

1{
2  "method" : "archive.seek_frame",
3  "params" :
4  {
5    "channel" : 0,
6    "stream" : "video3",
7    "start_time" : [2016, 12, 1, 13, 0],
8    "read_data" : true,
9    "direction" : "backward" 
10  }
11}

Response Example:

1{
2  "result" :
3  {
4    "frame" :
5    {
6      "info" : 
7      {
8        "timestamp" : [2016, 11, 23, 12, 54, 26, 943],
9        "gop_index" : 0,
10        "codec" : "mjpeg" 
11      },
12      "raw_bytes" : ...
13    }
14  }
15}

archive.seek_frames

Search for nearest sequence of frames in the archive.

Additional request parameters regarding "archive.seek_frame":

  • quantity - number of resulting sequential frames relating to the first one to meet the given parameters.

Response content:

  • frames - an array where each element corresponds to the "frame" dictionary in response to "archive.seek_frame" request.

archive.get_objects_timeline

Minimum API version: 70

Returns a timeline of Object Detector events.

{
  "method": "archive.get_objects_timeline",
  "version": 70,
  "params": {
    "start_time": [2025,1,16,10,0,0],
    "end_time": [2025,1,16,10,30,0],
    "unit_len": 60
  }
}
{
  "result": {
    "timeline": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
  }
}

archive.get_objects_list

Minimum API version: 70

Returns Object Detector results for a time interval.

Supported filters include types , coco_category and mask .

Request:

{
  "method": "archive.get_objects_list",
  "version": 70,
  "params": {
    "channel": 0,
    "start_time": [2025,1,16,13,40,5],
    "end_time": [2025,1,16,13,40,10]
  }
}

Response:

{
  "result": {
    "objects_list": [
      {
        "x": 0.7040,
        "y": 0.3520,
        "id": "06198376",
        "type": "human",
        "width": 0.1490,
        "height": 0.4790,
        "timestamp": [2025,1,16,13,40,9,526],
        "coco_category": 0
      },
      {
        "x": 0.0610,
        "y": 0.3680,
        "id": "94e1b15e",
        "type": "transport",
        "width": 0.5290,
        "height": 0.5870,
        "timestamp": [2025,1,16,13,40,9,526],
        "coco_category": 2
      }
    ]
  }
}

Filter by humans:

{
  "method": "archive.get_objects_list",
  "version": 70,
  "params": {
    "channel": 0,
    "start_time": [2025,1,16,13,40,5],
    "end_time": [2025,1,16,13,40,10],
    "filter": {
      "types": ["human"]
    }
  }
}

Mask example:

{
  "mask": {
    "data": [1024,1],
    "width": 32,
    "height": 32
  }
}

Error:

{
  "error": {
    "type": "invalid_param",
    "message": "time range exceeded"
  }
}

The documented maximum request interval is 30 minutes.

archive.get_sabotages_timeline

Returns a Sabotage Detector event timeline.

Request shape follows the corresponding Object Detector timeline/list pattern for this detector type.

archive.get_sabotages_list

Returns Sabotage Detector events for the requested interval.

Request shape follows the corresponding Object Detector timeline/list pattern for this detector type.

archive.get_abandoned_objects_timeline

Returns an Abandoned Object Detector event timeline.

Request shape follows the corresponding Object Detector timeline/list pattern for this detector type.

archive.get_abandoned_objects_list

Returns Abandoned Object Detector events for the requested interval.

Request shape follows the corresponding Object Detector timeline/list pattern for this detector type.

archive.get_crossings_timeline

Returns a Crossing / Visitor Counting event timeline.

Request shape follows the corresponding Object Detector timeline/list pattern for this detector type.

archive.get_crossings_list

Returns Crossing / Visitor Counting events for the requested interval.

Request shape follows the corresponding Object Detector timeline/list pattern for this detector type.

Resource

Archive JPEG Frame

Protocol version 90 allows an archive JPEG frame to be requested through the image resource using the time parameter.

Archive MP4

Archive video can be requested through the MP4 resource using time and the related export parameters.

Archive Events

Resource

Create Archive Event

URI: /events
MIME-types: application/json
Methods: POST

JSON request format:

 { "time" : /*string*/,
   "source" : /*string*/,
   "name" : /*string*/,
   "device": /*number*/,
   "data" : /*string*/ }

Parameters:
time - Archive Event start time in ISO 8601 format. Optional. Default value is the present time on the server.
source - Archive Event source. Optional. Default value is an empty string.
name - Archive Event name. Optional. Default value is an empty string.
device - Ordinal number of the camera. Optional. Default value is -1 indicating the event is not tied to any camera.
data - Archive Event data. Optional. Default value is an empty string.

Server response:

HTTP/1.1 201 Created
Location: <URI Archive Event object>

JSON response example:

POST /events HTTP/1.1
Host: localhost:9786
Content-Type: application/json

{
  "time" : "2005-08-09T18:31:42.201",
  "source" : "test source",
  "name" : "test name",
  "device": 0,
  "data" : "test data" 
}

HTTP/1.1 201 Created
Date: Mon, 23 May 2009 23:15:27 GMT
Location: events/gds2w8sd1w

Location header contains the address of the Archive Event object which can be accessed later.

Modifying Archive Events

URI: <URI Archive Event object>
MIME-types: application/json
Methods: PUT

All parameters in the "Create Archive Event" section may also be used in this request.

JSON request format:

PUT /events/gds2w8sd1w HTTP/1.1
Host: localhost:9786
Content-Type: application/json

{
  "endtime" : "2005-08-09T18:31:42.201" 
}

HTTP/1.1 204 No content
Date: Mon, 23 May 2005 23:15:27 GMT

User Log

RPC

userlog.get_messages

Getting event log messages.

Request parameters:

  • backward – reverse order of recordings (new to old), by default: true;
  • offset – initial offsetting of message selection, in forward order by default: 0, in reverse order: -1 (most recent message);
  • count – maximum number of messages for selection by default: 1000;
  • filter – filtering of selection using full-text search algorithm.

Possible filtering fields:

  • timestamp – list of substrings for full-text search by message time;
  • level – list of substrings for full-text search by message level;
  • text – list of substrings for full-text search by message text.

Response content:

  • message – array where each element corresponds to one message.

Content of "messages" array element:

  • id – message identifier;
  • timestamp - time;
  • level – level, possible values: "info", "warn", "error";
  • text – text.

Example of request for list of messages:

1{
2    "method" : "userlog.get_messages",
3    "params" : 
4    {
5        "count" : 2,
6        "filter" : 
7        {
8            "text" : [ "signal Camera+2" ] 
9        }
10    }
11}

Response Example:

1{
2    "result" : 
3    {
4        "messages" : 
5        [
6            {
7                "id" : 7297,
8                "level" : "warn",
9                "text" : "Restored signal from camera 'Camera 2'",
10                "timestamp" : [2019,3,26,15,50,14,0]
11            },
12            {
13                "id" : 7296,
14                "level" : "warn",
15                "text" : "Lost signal from camera 'Camera 2'",
16                "timestamp" : [2019,3,26,15,49,56,0]
17            }
18        ]
19    }
20}

Monitoring

RPC

monitoring.get_server_state

Getting server state (server part of software).

Response content:

  • local_time – local server time;
  • start_time – time of launch of server part of software.

Request Example:

1{
2    "method" : "monitoring.get_server_state",
3}

Response Example:

1{
2    "result" : 
3    {
4        "state" :
5        {
6            "local_time" : [2019,3,29,14,34,26,889],
7            "start_time" : [2019,3,29,8,8,29,651]
8
9        }
10    }
11}

monitoring.get_network_state

Response content:

  • clients - list of active networks connected to the server.

Content of "clients" array element:

  • address – client IP address;
  • user – user ID;
  • connect_time –connection time;
  • archive_access – days in archive to which client was granted access.

Request Example:

1{
2    "method" : "monitoring.get_network_state",
3}

Response Example:

1{
2    "result" : 
3    {
4        "state" :
5        {
6            "clients" : 
7            [
8                {
9                    "address" : "192.168.1.230",
10                    "connect_time" : [2019,3,27,8,17,51,418],
11                    "user" : "00000000" 
12                },
13                {
14                    "address" : "192.168.1.233",
15                    "archive_access" : [[2019,3,28],[2019,3,29]],
16                    "connect_time" : [2019,3,27,8,17,50,32],
17                    "user" : "00000001" 
18                }
19            ]
20        }
21    }
22}

monitoring.get_media_state

Response content:

  • cameras - dictionary containing state of each server camera.

Content of "cameras" dictionary element:

  • enabled - whether camera is enabled or not;
  • streams - dictionary containing state of each camera stream.

Content of "streams" dictionary element:

  • enabled – whether the stream is enabled or not;
  • active – whether media streams are updated or not;
  • datarate – average number of data bytes in the stream over the last few seconds;
  • framerate – average number of frames in the stream over the last few seconds.

Request Example:

1{
2    "method" : "monitoring.get_media_state",
3}

Response Example:

1{
2    "result" : 
3    {
4        "state" :
5        {
6            "cameras" : 
7            {
8                "0" : 
9                {
10                    "enabled" : true,
11                    "streams" : 
12                   {
13                        "audio" : 
14                        {
15                            "datarate" : 0.0000,
16                            "enabled" : false,
17                            "framerate" : 0.0000
18                        },
19                        "video" : 
20                        {
21                            "active" : true,
22                            "datarate" : 49302.3810,
23                            "enabled" : true,
24                           "framerate" : 4.1667
25                        },
26                        "video2" : 
27                        {
28                            "active" : true,
29                            "datarate" : 4772.2654,
30                            "enabled" : true,
31                            "framerate" : 4.1841
32                       }
33                    }
34                }
35            }
36        }
37    }
38}

monitoring.get_archive_state

Response content:

  • storages - list of storages used by server.

Content of "storages" array element:

  • path – path to storage;
  • available – storage availability flag;
  • free_space – amount of free space in megabytes;
  • write – dictionary with data about archive record.

Content of "write" dictionary:

  • datarate – average number data bytes written to storage over the last few seconds;
  • queue_size – maximum relative value for storage write queue size from maximum possible over the last few seconds;
  • last_error_time – time of last write error in storage.

Request Example:

1{
2    "method" : "monitoring.get_archive_state",
3}

Response Example:

1{
2    "result" : 
3    {
4        "state" : 
5        {
6            "storages" : 
7            [
8                {
9                    "available" : true,
10                    "free_space" : 719937,
11                    "path" : "X:\\myvms_archive\\",
12                    "write" : 
13                    {
14                        "datarate" : 2186664.4444,
15                        "last_error_time" : [2019,3,29,8,1,23,211],
16                        "queue_size" : 0.0045
17                    }
18                }
19            ]
20        }
21    }
22}

The response structure of monitoring.get_archive_state was extended in protocol version 83 with archive date-range information.

Visitor Counting / Crossing Detector

RPC

crossing_detector.report_start

Minimum API version: 84

Minimum MyVMS version: 8.3.2

Starts creation of a visitor-counting report.

{
  "method": "crossing_detector.report_start",
  "params": {
    "camera": "0",
    "start_time": [2024,11,1],
    "period": "month",
    "directions": ["in","out"],
    "format": "csv"
  },
  "version": 84
}
{
  "result": {}
}
  • period : day , week , month .
  • format : pdf or csv .
  • directions : in , out .

crossing_detector.report_progress

Minimum API version: 84

Minimum MyVMS version: 8.3.2

Returns report generation progress.

{
  "method": "crossing_detector.report_progress",
  "version": 84
}
{
  "result": {
    "active": false,
    "progress": 1.0000
  }
}

progress ranges from 0.0 to 1.0.

crossing_detector.report_result

Minimum API version: 84

Minimum MyVMS version: 8.3.2

Returns the generated report.

PDF is returned as binary data through MessagePack. JSON serialization of PDF is not supported. CSV is returned as text records in index,direction,count format.

{
  "method": "crossing_detector.report_result",
  "version": 84
}
{
  "result": {
    "csv": "0,in,0\\r\\n0,out,0\\r\\n1,in,0\\r\\n1,out,0\\r\\n2,in,4\\r\\n2,out,7\\r\\n"
  }
}

For a day report, index is 0. For a monthly report it represents the day index.

crossing_detector.report_stop

Minimum API version: 84

Minimum MyVMS version: 8.3.2

Stops report generation.

{
  "method": "crossing_detector.report_stop",
  "version": 84
}
{
  "result": {}
}

Eco Mode

Data Model / Configuration

Channel configuration includes the boolean fields ecomode and ecomode2 .

These are configuration fields, not separate RPC method names.

Automation / MyVMS Parking

Data Model / Configuration

MyVMS Parking automation uses configuration type myvms-parking .

Configuration fields include:

  • token
  • camera
  • actions.open_barrier
  • actions.offline

This is a configuration structure; no additional RPC method name is defined here.