Overview

The API for VXG Streaming Server is almost identical to VXG Cloud Video API

Root URL for VXG Streaming Server's API:
http://%vxg_server_ip%:%api_port%/api
where:

Typical architectire diagram

Screenshot

Authorization

To authorize your requests to Admin API you need to use your API Key. It can be found on the Settings page of VXG Server Admin console.

The API Key should be injected to Authorization header of every request to Admin API like this:

Authorization: LKey %api_key%

For example, if the API key is "X9tKpuXq0btatj":

Authorization: LKey X9tKpuXq0btatj

Functions

Create a channel
Get a channel list
Get a channel info
Update a channel info
Delete a channel
Get usage limits
Update usage limits Get statistics Get statistics per channel

Interactive API reference (Swagger): AdminAPI.html

Create a channel

Send a POST-request to:

/v3/channels/

With the headers:

Authorization: LKey %api_key%
Content-Type: application/json

And a JSON body as below.

For a Mobile or VXG-enabled IP camera channel:

{
    "name": "Channel name",
    "rec_mode": "on"
}

For a Generic IP camera channel:

{
    "name": "Channel name",
    "rec_mode": "on",
    "source": {
         "url": "rtsp://username:password@hostname:port/path"
    }
}

Where

Example using curl:

curl -X POST \
    -H "Authorization: LKey %api_key%" \
    -H "Content-Type: application/json" \
    -d '{"name":"Test","rec_mode":"off"}' \
    http://%vxg_server_ip%:%api_port%/api/v3/channels/

Example of a JSON response:

{
    "access_tokens": {
        "all": "eyJhY2N....MxOTQ0fQ==",
        "watch": "eyJhY2Nlc3...E5NDR9"
    },
    "created": "2018-01-17T12:57:01.268425",
    "id": 131594,
    "name": "Test",
    "rec_mode": "off",
    "timezone": "UTC"
}

Where:

Get a channel list

Send a GET-request to:

/v3/channels/

With the header:
Authorization: LKey %api_key%

Example using curl:

curl \
    -H "Authorization: LKey %api_key%" \
    "http://%vxg_server_ip%:%api_port%/api/v3/channels/"

Example of a JSON response is below:

{
    "meta": {
        "limit": 20,
        "next": null,
        "offset": 0,
        "previous": null,
        "total_count": 2
    },
    "objects": [
        {
            "access_tokens": {
                "all": "eyJhY2N....MxOTQ0fQ==",
                "watch": "eyJhY2Nlc3...E5NDR9"
            },
​
            "created": "2018-01-17T12:57:01.268425",
            "id": 131594,
            "name": "Camera, 2017-12-12T07:45:18",
            "rec_mode": "off",
            "timezone": "UTC"
        },
        {
            "access_tokens": {
                "all": "eyJhY2Nl...IjogMTMxOTQ3fQ==",
                "watch": "eyJhY2Nlc3M....QiOiAxMzE5NDd9"
            },
            "created": "2018-01-17T13:12:17.700075",
            "id": 131597,
            "name": "Name of channel",
            "rec_mode": "off",
            "source": {
                "login": "",
                "password": "",
                "url": "rtsp:\/\/your.public.rtsp.camera.address\/live"
            },
            "timezone": "UTC"
        }]
}

Get a channel info

Send a GET-request to:

/v3/channels/%channel_id%/

With the header:
Authorization: LKey %api_key%

Example using curl:

curl -X GET \
    -H "Authorization: LKey %api_key%" \
    "http://%vxg_server_ip%:%api_port%/api/v3/channels/%channel_id%/"

Example of a JSON response is below:

{
        {
            "access_tokens": {
                "all": "eyJhY2N....MxOTQ0fQ==",
                "watch": "eyJhY2Nlc3...E5NDR9"
            },
            "created": "2018-01-17T12:57:01.268425",
            "id": 131594,
            "name": "Camera, 2017-12-12T07:45:18",
            "rec_mode": "off",
            "timezone": "UTC"
        }
}

Update a channel info

Send a PUT-request to:

/v3/channels/%channel_id%/

With the headers:
Authorization: LKey %api_key%
Content-Type: application/json

Example using curl:

curl -X PUT \
    -H "Authorization: LKey %api_key%" \
    -H "Content-Type: application/json" \
    -d '{"name": "New name"}'
    "http://%vxg_server_ip%:%api_port%/api/v3/channels/%channel_id%/"

Example of a JSON response is below:

{
        {
            "access_tokens": {
                "all": "eyJhY2N....MxOTQ0fQ==",
                "watch": "eyJhY2Nlc3...E5NDR9"
            },
            "created": "2018-01-17T12:57:01.268425",
            "id": 131594,
            "name": "New name",
            "rec_mode": "off",
            "timezone": "UTC"
        }
}

Delete a channel

Send a DELETE-request to:

/v3/channels/%channel_id%/

With the header:
Authorization: LKey %api_key%

Example using curl:

curl -X DELETE \
    -H "Authorization: LKey %api_key%" \
    "http://%vxg_server_ip%:%api_port%/api/v3/channels/%channel_id%/"

Get usage limits

Send a GET-request to:

/v3/channels/%channel_id%/limits/

With the header:
Authorization: LKey %api_key%

Example using curl:

curl -X GET \
    -H "Authorization: LKey %api_key%" \
    "http://%vxg_server_ip%:%api_port%/api/v3/channels/%channel_id%/limits/"

Example of a JSON response is below:

{
  "storage_size": 1073741824,
  "download_size": 1073741824,
  "live_size": 1073741824,
  "records_max_age": 72,
  "issued": "2018-03-12T12:25:13.815",
  "used": {
    "storage_size": 1001741824,
    "download_size": 773741824,
    "live_size": 856732
  }
}

Update usage limits

Send a PUT-request to:

/v3/channels/%channel_id%/limits/

With the header:
Authorization: LKey %api_key%

Followed with the following JSON body:

{
  "storage_size": "storage size in bytes",
  "download_size": "downloading in bytes",
  "live_size": "live streaming in bytes",
  "records_max_age": "storage depth in hours"
}

Get statistics

Send a GET-request to:

/v3/statistics/

With the header:
Authorization: LKey %api_key%
and optional parameters
start - start date
end - end date

Example using curl:

curl -X GET \
    -H "Authorization: LKey %api_key%" \
    "http://%vxg_server_ip%:%api_port%/api/v3/statistics/?start=2018-05-10&end=2018-05-13"

Example of a JSON response is below:

{
  "records_duration": 5,
  "records_size": 18104123,
  "clips_duration": 1,
  "clips_size": 2343112,
  "images_size": 112034,
  "downloaded_duration": 2,
  "downloaded_size": 3813422,
  "live_duration": 7,
  "live_size": 27103144
}

Get statistics per channel

Send a GET-request to:

/v3/statistics/%channel_id%/

With the header:
Authorization: LKey %api_key%
and optional parameters
start - start date
end - end date

Example using curl:

curl -X GET \
    -H "Authorization: LKey %api_key%" \
    "http://%vxg_server_ip%:%api_port%/api/v3/statistics/%channel_id%/?start=2018-05-10&end=2018-05-13"

Example of a JSON response is below:

{
  "records_duration": 5,
  "records_size": 18104123,
  "clips_duration": 1,
  "clips_size": 2343112,
  "images_size": 112034,
  "downloaded_duration": 2,
  "downloaded_size": 3813422,
  "live_duration": 7,
  "live_size": 27103144
}