Haut

CamTrace Sirion 16 API v1.2 documentation

This document describes the HTTP API available on CT-Server versions 9.16 (or higher). Please note: the functionalities available in the API change according to the CT-Server version. For example, the API for obtaining camera network information is only available for CT-Server 9.16.2 (or higher).

Document updates

Version Date Author Reason
1.2-01 08/01/2020 Romain RIGOT Draft 01
1.2-02 09/03/2020 Romain RIGOT Groups (mosaics) update in cycle mode, correction of requests examples
1.2-03 17/06/2020 Romain RIGOT Addition of slices, correction of requests examples
1.2-04 02/12/2020 Romain RIGOT Add missing fields to group (mosaics) queries
1.2-05 08/12/2020 Romain RIGOT Feature Folders
1.2-06 15/04/2021 Romain RIGOT RTSP and Push HTTP services
1.2-07 26/07/2021 Romain RIGOT Feature Logs
1.2-08 04/10/2021 Romain RIGOT Feature Tasks
1.2-09 19/07/2022 Romain RIGOT New features for CT-Server 9.16.0 : RTSP URLs and streams information
1.2-10 27/07/2022 Romain RIGOT New feature for CT-Server 9.16.0 : Metadata events
1.2-11 28/09/2022 Romain RIGOT New features for CT-Server 9.16.0 : Triggering and activating scenarios
1.2-12 12/10/2022 Romain RIGOT Push HTTP mosaic service, features : snapshots
1.2-13 22/12/2022 Romain RIGOT Additional information on triggering and acknowledging alarms
1.2-14 10/07/2023 Romain RIGOT New Feature for CT-Server 9.16.2 : information on camera features
1.2-15 31/07/2023 Romain RIGOT New Feature for CT-Server 16.2 : information on camera network
1.2-16 05/09/2023 Romain RIGOT Standardizing wording: groups become mosaics
1.2-17 14/02/2024 Romain RIGOT Additional information on metadata events (search)
1.2-18 27/04/2024 Romain RIGOT Improved description of authentication methods

RTSP and PUSH HTTP video services

The RTSP service lets you view live and replay video streams of the latest alarms from cameras registered on the CT-Server. This service is available for live versions of CamTrace Nova 14 from 14.1.0 and CamTrace Sirion 16 from 16.0. Following the discontinuation of support for ActiveX technology on Windows workstations, the CamTrace display component can be replaced by an RTSP-compatible display component (VLC is a good choice). You can also access camera feeds from the Camtrace server using the PUSH HTTP technique, which enables video to be displayed directly in a web browser, for example. In this case, the streams displayed are recompressed into MJPEG by the server.

Access to RTSP video streams

Access to a video stream, respectively :

is done via an RTSP URL composed as follows:

rtsp://<server>:<rtsp-port>/live/view/<stream-id>
rtsp://<server>:rtsp-port>/live/delayed/<stream-id>
rtsp://<server>:<rtsp-port>/live/alarm/<stream-id>
rtsp://<server>:<rtsp-port>/replay/view/<stream-id>

The components of this URL are :

Parameter Description
server DNS name or IP address of CT-Server
rtsp-port RTSP port of CT-Server as defined in system setup (default : 8554)
stream-id Video stream identifier

The video stream identifier is of the form X.Y. It can be found by various methods.

The stream identifier is obtained via the HTTP API request : GET /api/v1.2/cameras which contains an array with the list of cameras. Each element of the table contains the camera ID in the id field as well as an array of streams containing the ID of each stream in the id field. (see part Retrieving a camera)

Alternatively, the list of stream identifiers is available in the camera administration page when stream information display is selected (“Display/hide streams” - id column).

Example of RTSP live stream access:

rtsp://192.168.1.100:8554/live/view/2.6

Authentication

When accessing the feed, the server requires login and password authentication corresponding to a user declared in the CT-Server and with access rights to the feed. Digest authentication is preferred. It is also possible to enter this information directly in the URL used to access the RTSP stream, in the following form :

rtsp://<user>:<pass>@<server>:<rtsp-port>/<stream-id>

Access to PUSH HTTP video streams

Access to a video stream is via the same URL as for Camtrace video streams, with the following difference in protocol (http instead of ws):

http://<server>:<http-port>/<live_view_stream_path>

The components of this URL are :

Parameter Description
server DNS name or IP address of CT-Server
http-port HTTP server port of the CT-Server as defined in system setup (default : 80 or 443)
live_view_stream_path path to live stream

If the stream has an assigned role, the path to the live feed can be obtained via the HTTP API request: GET /api/v1.2/cameras in the fields hdStream, mdStream, ldStream or alStream. Alternatively, you can obtain the generic path to live streams via the request : GET /api/v1.2/users/login in the services section. Then you can find the stream ID you want to display in the list on the camera administration page (see the RTSP section above).

Example:

http://192.168.1.100/live/view/2.6

Authentication

When accessing the stream, the server requires login and password authentication corresponding to a CamTrace-declared user with access rights to the stream. It is possible to enter this information directly as a parameter of the URL used to access the PUSH HTTP feed, in the following format:

http://<server>:<http-port>/<live_view_stream_path>?user=<user>&pass=<password>

PUSH HTTP mosaic creation

It is possible to create a mosaic, compressed in MJPEG, consisting of a stream from different cameras (potentially several times the same). This mosaic is accessible via PUSH HTTP.

http://<server>:<http-port>/m?ids=cam1_id,cam2_id,...&compr=compr_rt

The components of this URL are :

Parameter Description
server DNS name or IP address of CT-Server
port-http HTTP server port of the CT-Server as defined in system setup (default : 80 or 443)
ids List of camera identifiers to make up the mosaic.
compr (optionnal) A value between 1 and 99 to indicate the level of compression of the jpeg images making up the stream sent. The higher the value, the more compressed the images.

The camera ID is obtained via the HTTP API request: GET /api/v1.2/cameras. You can find the stream ID you want to display in the list on the camera administration page. (see the RTSP section above).

Example:

http://192.168.1.100/m?ids=3,1,2&compr=20

Authentication

Authentication works in the same way as for viewing a PUSH HTTP stream (see above).

REST HTTP API

The HTTP service is a REST type API (Application Programming Interface). It lets application developers retrieve and use various items like cameras, mosaics, screens, etc. on the CT-server.

Structure

All requests are made via HTTP or HTTPS, depending on your server configuration.

All requests begin with /api/v1.2.

All data sent or received is formatted in JSON (JavaScript Object Notation).

Dates are returned in ISO-8601 format: YYYY-MM-DDTHH:MM:SSZ.

# Example request:
GET /api/v1.2/servers HTTP/1.1
Host: <your-server>

# Response:
HTTP/1.1 200 OK
Date: Wed, 12 Mar 2014 16:12:37 GMT
Server: Apache/2.2.15 (FreeBSD) mod_ssl/2.2.15 OpenSSL/0.9.8n PHP/5.3.2 with Suhosin-Patch
X-Powered-By: PHP/5.3.2
Content-Length: 124
Content-Type: application/json

{"servers":[...]}

HTTP methods

The CamTrace API uses HTTP methods to define the type of request action.

Method Description
HEAD This method retrieves HTTP headers without the resource.
GET Used to retrieve a resource.
POST Used to add a resource.
PUT Used to modify a resource.
DELETE Used to delete a resource.

JSON-P

You can send parameter ?_callback= with GET requests to get the result wrapped in a javascript function. This is useful in browsers for cross-domain queries. The data returned is the same as for conventional queries.

$ curl http://demo.camtrace.com/api/v1.2/servers?_callback=pop
pop({
  "meta": {
    "status": 200
  },
  "data": {
    "servers": [...]
  }
});

Authentication

Requests requiring authentication return an HTTP code 401 Unauthorized. If the user’s rights are not high enough to access a resource, the answer is 403 Forbidden or may be 404 Not Found in some cases.

If you are using HTTPS, then the HTTP Basic method may be sufficient. On the other hand, if your server isn’t configured for HTTPS, then you need to be aware that your credentials will circulate in cleartext between the client and the server, so any person or machine intercepting the request will be able to see the credentials used. Using the WSSE method ensures that no one will be able to identify themselves in the user’s place, even if the request is intercepted. In addition, the user password is stored securely in the database. It is therefore advisable to use WSSE authentication method in all cases.

HTTP Basic method

CamTrace servers support the standard HTTP Basic authentication method. (see details on wikipedia). Below is an example of a query with authentication:

GET /api/v1.2/cameras HTTP/1.1
Host: demo.camtrace.com
Authorization: Basic ZGVtbzpkZW1v

HTTP/1.1 200 OK
Date: Wed, 12 Mar 2014 18:40:36 GMT
Server: Apache/2.2.15 (FreeBSD) mod_ssl/2.2.15 OpenSSL/0.9.8n PHP/5.3.2 with Suhosin-Patch
X-Powered-By: PHP/5.3.2
Content-Length: 14
Content-Type: application/json

{"cameras":[]}

WSSE Username Token method

The WSSE Username Token algorithm was originally part of the WS-Security de SOAP. This is the preferred method, as it is more secure than the HTTP Basic one. To authenticate, you must send the following two headers with each request:

Authorization: WSSE profile="UsernameToken"
X-WSSE: UsernameToken
  Username="<username>",
  PasswordDigest="base64(sha1(<nonce><created-at><hashed-password>))",
  Nonce="<nonce>",
  Created="<created-at>"

<username> corresponds to the user’s name. <nonce> is a random string generated for each request. <created-at> is the date in ISO-8601 format at the time of the request. Finally PasswordDigest contains strings <nonce>, <created-at> and the user password <hashed-password>, all encoded with sha1.

When the authentication method is not accompanied by a salt parameter, the PasswordDigest must be calculated with <hashed-password> generated by the MD5 function.

When the authentication method is accompanied by the salt parameter, the PasswordDigest must be calculated with <hashed-password> generated by the Bcryt function. This method is preferred if available.

Here is an example of how to calculate the password demo and a BCrypt hash:

let salt = "$2y$10$ECHujA0Fstk2yBkVmuwV4O" // Retrieved via GET /api/v1.2/users/demo/auth
let password = bcrypt.hash('demo', salt)

let nonce = "LquMOTwiov5/LoKzy3Ru0bpTWvM=" // Must be "unic" at each authentication
let created = '2024-03-13T19:45:00Z' // Date ISO 8601 date at the time of the request

let passwordDigest = b64_sha1(nonce + created + password);
// => E/sIi5aIbon0zkqly7JwnmoqVjE=

The string E/sIi5aIbon0zkqly7JwnmoqVjE= is therefore the value PasswordDigest to dens to the server for authentication. This password is valid for 10 seconds and must be recalculated for each request.

You must ensure that the client time is synchronized with the server time. Otherwise, if there is more than a 10-second time difference between the ISO date sent as a parameter and the server time, authentication will be refused.

You can retrieve the server’s timestamp and timezone via an (unauthenticated) request to the CT-Server HTTP REST API. See Server date and time

Example of a query for user demo and password demo:

GET /api/v1.2/cameras HTTP/1.1
Host: demo.camtrace.com
Authorization: WSSE profile="UsernameToken"
X-WSSE: UsernameToken Username="demo", PasswordDigest="E/sIi5aIbon0zkqly7JwnmoqVjE=", Nonce="LquMOTwiov5/LoKzy3Ru0bpTWvM=", Created="2024-03-13T19:45:00Z"

HTTP/1.1 200 OK
Date: Wed, 13 Mar 2024 19:44:01 GMT
Server: Apache/2.2.15 (FreeBSD) mod_ssl/2.2.15 OpenSSL/0.9.8n PHP/5.3.2 with Suhosin-Patch
X-Powered-By: PHP/5.3.2
Content-Length: 14
Content-Type: application/json

{"cameras":[]}

Use URLs rather than HTTP headers

Sometimes it’s necessary to pass identification parameters in the URL rather than in HTTP headers. Below are details of the parameters for the HTTP Basic and WSSE Username Token.

HTTP Basic method

GET /api/v1.2/cameras?_username=demo&_password=demo
Parameters
Name Description
_username User name.
_password User password.

WSSE Username Token mathod

GET /api/v1.2/cameras?_username=demo&_password=bc%2BAAFOSnebE96iEilMMquA7l8E%3D&_nonce=UHQJ5DN947AEAMPQN1H3G&_created_at=2014-03-13T19:45:00Z
Parameters
Name Description
_username User name.
_password See WSSE Username Token method.
_nonce See WSSE Username Token method.
_created_at See WSSE Username Token method.

Language

You can select the language used by the API. To do this, use the HTTP header Accept-Language. The languages currently accepted are French (fr), English (en), German (de), Spanish (es), Italian (it) and Dutch (nl). English is used by default.

Example of a query without specifying language:

$ curl -i -u pop:pop http://demo.camtrace.com/api/v1.2/cameras
HTTP/1.1 401 Unauthorized
Date: Wed, 13 Mar 2014 20:40:36 GMT
Server: Apache/2.2.15 (FreeBSD) mod_ssl/2.2.15 OpenSSL/0.9.8n PHP/5.3.2 with Suhosin-Patch
X-Powered-By: PHP/5.3.2
Content-Length: 29
Content-Type: application/json

{"error":"Invalid password!"}

The same request, but requesting a response in French:

$ curl -i -u pop:pop -H 'Accept-Language: fr' http://demo.camtrace.com/api/v1.2/cameras
HTTP/1.1 401 Unauthorized
Date: Wed, 13 Mar 2014 20:40:36 GMT
Server: Apache/2.2.15 (FreeBSD) mod_ssl/2.2.15 OpenSSL/0.9.8n PHP/5.3.2 with Suhosin-Patch
X-Powered-By: PHP/5.3.2
Content-Length: 35
Content-Type: application/json

{"error":"Mot de passe invalide !"}

Reference of available functions

Open the web interface banner

This request enables the banner to be opened from a simple link, without the user having to enter his or her login and password. The identifiers must therefore be passed in the query parameters using the method described above: Use URLs rather than HTTP headers.

GET /api/v1.2/openheadband

Users

Authentication methods list

The list of authentication methods shows which types of authentication are authorized for a given user, along with any associated parameters. This query can be accessed without authentication.

GET /ap1/v1.2/users/:name/auth
Request example
GET /ap1/v1.2/users/admin/auth
Content-Type: application/json
Response example
HTTP/1.1 200 OK
Content-Length: 211
Content-Type: application/json
{
    "auth": [
      {
        "type": "wsse",
        "salt": "$2y$10$1Ym5LlN4Sc3VANyZFSp/Eu"
      },
      {
        "type": "wsse"
      },
      {
        "type": "basic"
      }
    ]
}
Description of authentication method attributes
Name Type Description
type liste Authentication type (basic or wsse)
salt string “salt” to be used for the bcrypt hash method

Servers

Server date and time

This information is particularly useful when using WSSE authentication.

GET /api/v1.2/getservertime
Response
HTTP/1.1 200 OK
Content-Length: 88
Content-Type: application/json
{
  "serverTime": {
    "timestamp": 1711475612,
    "timezone": "Europe/Berlin"
  }
}

Server list

The server list shows the ports used by the local server and the other servers in the CamTrace cluster. The server with id 0 is the local server.

GET /api/v1.2/servers
Response
HTTP/1.1 200 OK
Content-Length: 126
Content-Type: application/json
{
  "servers": [
    {
      "id": 0,
      "name": "Local",
      "host": "demo.camtrace.com",
      "httpPort": 80,
      "livePort": 8000,
      "controlPort": 8001,
      "recordsPort": 8002
    }
  ]
}

Cameras

All camera requests must be made with a user name and password. (see part Authentication).

Camera list

GET /api/v1.2/cameras
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "cameras": [
    {
      "id": 2,
      "name": "Vivo8000",
      ...
    },
    {
      "id": 3,
      "name": "Axis214",
      ...
    }
  ]
}

Retrieve a camera

GET /api/v1.2/cameras/:camera_id
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "id": 2,
  "name": "Vivo8000",
  "hdStream": "/live/view/2.1",
  "hdId": "1",
  "hdEncoding": "H264",
  "hdWidth": 352,
  "hdHeight": 288,
  "mdStream": null,
  "mdEncoding": null,
  "mdWidth": null,
  "mdHeight": null,
  "ldStream": null,
  "ldEncoding": null,
  "ldWidth": null,
  "ldHeight": null,
  "alStream": "/live/view/2.2",
  "alId": 2,
  "alEncoding": "H264",
  "alWidth": 352,
  "alHeight": 288,
  "rpStream": "/r?id=2",
  "rpId": 2,
  "rpEncoding": "H264",
  "rpWidth": 352,
  "rpHeight": 288,
  "displayCode": null,
  "isIgnored": false,
  "isRecording": false,
  "isRecordingAlarm": false,
  "isRecordingForced": false,
  "isRemote": false,
  "isReplayEnabled": false,
  "isUpsideDown": false,
  "model": "vivo7000",
  "playLiveAllowed": true,
  "playRecordsAllowed": true,
  "streams": [
    {
        "id": 1,
        "name": "MsMediaProfile1",
        "encoding": "H264",
        "width": 1920,
        "height": 1080,
        "connected": true,
        "roles": [
            "detect",
            "rrecord",
            "index",
            "arecord",
            "mosaic"
        ],
        "quality": 3,
        "ignored": false,
        "onDemand": false
    },
    {
        "id": 2,
        "name": "MsMediaProfile3",
        "encoding": "H264",
        "width": 640,
        "height": 480,
        "connected": true,
        "roles": [],
        "quality": 2,
        "ignored": false,
        "onDemand": false
    }
  ],
  "ptz": {
    "click": true,
    "areazoom": false,
    "zoomback": true,
    "continuous": true,
    "presets": [
      {
        "id": "Button",
        "name": "Button"
      },
      {
        "id": "Light",
        "name": "Light"
      },
      {
        "id": "Webcam",
        "name": "Webcam"
      }
    ],
    "tours": []
  },
  "ptzAllowed": false,
  "refUrl": null,
  "status": 2,
  "deviceInfo": {
    "host": "192.168.0.107",
    "port": 80,
    "https": false
  },
}
Camera attributes description
Name Type Description
id integer Camtrace camera ID.
name text Camera name on CT-Server.
hdStream text High-Quality stream path.
hdId integer High-Quality stream ID.
hdEncoding text High-quality stream format (MPEG4, H264 ou JPEG).
hdWidth integer High-quality stream width.
hdHeight integer High-quality stream height.
mdStream text Medium-Quality stream path.
mdId integer Medium-Quality stream ID.
mdEncoding text Medium-quality stream format (MPEG4, H264 ou JPEG).
mdWidth integer Medium-quality stream width.
mdHeight integer Medium-quality stream height.
ldStream text Low-Quality stream path.
ldId integer Low-Quality stream ID
ldEncoding text Low-quality stream format (MPEG4, H264 ou JPEG).
ldWidth integer Low-quality stream width.
ldHeight integer Low-quality stream height.
alStream text Alarm stream path (stream is active in case of alarm).
alId integer Alarm stream ID.
alEncoding text Alarm stream format (MPEG4, H264 ou JPEG).
alWidth integer Alarm stream width.
alHeight integer Alarm stream height.
rpStream text Path of the last alarm replay stream.
rpId integer Last alarm replay stream ID.
rpEncoding text Last alarm replay stream format (MPEG4, H264 ou JPEG).
rpWidth integer Last alarm replay stream width.
rpHeight integer Last alarm replay stream height.
displayCode integer Code used to display the camera in a mosaic.
isIgnored boolean True if the camera is ignored in the configuration.
isRecording boolean True if the camera is recording.
isRecordingAlarm boolean True if the camera is recording an alarm.
isRecordingForced boolean True if the camera is in forced recording mode.
isRemote boolean True if the camera is a remote camera (connected if at least one client is watching the stream).
isReplayEnabled boolean True whether last alarm replay mode is enabled or not.
isUpsideDown boolean True if image orientation is reversed.
model text Camera model name.
playLiveAllowed boolean True if live visualization is authorized for the current user.
playRecordsAllowed boolean True if the current user is authorized to read records.
ptz.click boolean True if the click in the image is supported by the camera.
ptz.areazoom boolean True if clipping is supported by the camera.
ptz.zoomback boolean True if return to initial zoom is supported by the camera.
ptz.continuous boolean True if continuous movements are supported by the camera.
ptz.presets liste List of predefined positions.
ptz.tours liste List of tours.
ptzAllowed boolean True if PTZ actions are authorized for the current user.
refUrl text Reference image path if available.
status integer Camera status: -2 for ignored by server, -1 for error, 0 for video service off, 1 for camera read-only and 2 for all ok.
streams tableau Camera stream information.
ptz tableau Description of the camera’s PTZ features.
deviceId uuid Identifier of ONVIF / VAPI or ISAPI connector associated with the camera.
isIndexingRegul boolean True if the camera is indexed on the regular recording stream.
networkInfo objet Network information (host, port, protocol) for the camera as added to the CT-Server

Retrieve a camera reference image

GET /api/v1.2/cameras/:camera_id/ref.jpg
Response

The response is a JPEG image. If the reference image does not exist, the server replies 404 Not Found with no content.

Moving a PTZ camera

GET /api/v1.2/cameras/:camera_id/ptz
Commands
Name Associated parameters Description
area x0, y0, x1, y1, w et h Allows you to zoom-in on an area.
center x, y, w et h Allows you to center the camera on a point.
cptm x, y, w et h Allows the camera to be moved continuously. Parameters x and y must be between -100 and 100. If x and y are 0, then movement stops.
czm q Allows continuous zooming in and out. Parameters x and y must be between -100 and 100. If x and y are 0, then movement stops.
preset arg Position the camera on a predefined point.
ptz arg Moves the camera in a particular direction.
tour arg Launches a predefined guard tour in the camera.
zoom q Allows you to zoom in or out. The q parameter must be between -10 and 10.
Parameters
Name Associated commands Description
cmd PTZ command requested.
x center and cptm x coordinate in the image.
y center and cptm y coordinate in the image.
x0 area x coordinate of the top left point.
y0 area y coordinate of the top left point.
x1 area x coordinate of the bottom right point.
y1 area y coordinate of the bottom right point.
w center, cptm and area Image width. This dimension is used to locate points (x,y or x0,y0 or x1,y1).
h center, cptm and area Image heigth. This dimension is used to locate points (x,y or x0,y0 or x1,y1).
q zoom and czm Zoom value to be performed. If q < 0 zoom out otherwise zoom in. If q == 0 then continuous zoom stops.
arg ptz, preset and tour For the ptz command, arg can take the values ‘down’, ‘left’, ‘right’, ‘up’, ‘plus’ and ‘minus’. For preset and tour commands, arg corresponds to the id of the requested preset or tour.
Examples
$ curl -u demo:demo 'http://demo.camtrace.com/api/v1.2/cameras/2/ptz?cmd=center&w=640h=480&x=200&y=400'
$ curl -u demo:demo 'http://demo.camtrace.com/api/v1.2/cameras/2/ptz?cmd=zoom&q=4'
$ curl -u demo:demo 'http://demo.camtrace.com/api/v1.2/cameras/2/ptz?cmd=preset&arg=Porte'

Mosaics (groups)

All requests concerning mosaics (formerly groups) must be made with a user and password. (see part Authentication). For consultation, the user profile must have the corresponding associated right defined for each mosaic. It is also important to ensure that the user has Visualization rights to the cameras inserted in the cycles.

Mosaics list

GET /api/v1/groups
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "groups": [
    {
      "id": 1,
      "name": "FourByFour",
      "rows": 2,
      "cols": 2,
      "pushMode": false,
      "fullScreen": false,
      "stayOnTop": false,
      "displayCode": null,
      "layout": [
        [0,1],
        [2,3]
      ],
      "levels": [
        {
          "name": "FourByFour 0",
          "duration": 10,
          "elements": [
            {
              "position": 0,
              "serverId": 0,
              "cameraId": 2,
              "quality": 1,
              "mode": "v",
              "type": "c",
              "url": null,
              "showMargin": true,
              "showMenu": true,
              "keepRatio": true,
              "alignment": 0
            }, {
              "position": 1,
              "serverId": 0,
              "cameraId": 1,
              "quality": 1,
              "mode": "v",
              "type": "c",
              "url": null,
              "showMargin": true,
              "showMenu": true,
              "keepRatio": true,
              "alignment": 0
            }, {
              "position": 2,
              "serverId": 0,
              "cameraId": 1,
              "quality": 1,
              "mode": "v",
              "type": "c",
              "url": null,
              "showMargin": true,
              "showMenu": true,
              "keepRatio": true,
              "alignment": 0
            }, {
              "position": 3,
              "serverId": 0,
              "cameraId": 2,
              "quality": 1,
              "mode": "v",
              "type": "c",
              "url": null,
              "showMargin": true,
              "showMenu": true,
              "keepRatio": true,
              "alignment": 0
            }
          ]
        }
      ],
      "href": "/api/v1/groups/1"
    }
  ]
}

Retrieving a mosaic

GET /api/v1/groups/:group_id
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "id": 1,
  "name": "FourByFour",
  "rows": 2,
  "cols": 2,
  "pushMode": false,
  "fullScreen": false,
  "stayOnTop": false,
  "displayCode": null,
  "layout": [
    [0,1],
    [2,3]
  ],
  "levels": [
    {
      "name": "FourByFour 0",
      "duration": 10,
      "elements": [
        {
          "position": 0,
          "serverId": 0,
          "cameraId": 2,
          "quality": 1,
          "mode": "v",
          "type": "c",
          "url": null,
          "showMargin": true,
          "showMenu": true,
          "keepRatio": true,
          "alignment": 0
        }, {
          "position": 1,
          "serverId": 0,
          "cameraId": 1,
          "quality": 1,
          "mode": "v",
          "type": "c",
          "url": null,
          "showMargin": true,
          "showMenu": true,
          "keepRatio": true,
          "alignment": 0
        }, {
          "position": 2,
          "serverId": 0,
          "cameraId": 1,
          "quality": 1,
          "mode": "v",
          "type": "c",
          "url": null,
          "showMargin": true,
          "showMenu": true,
          "keepRatio": true,
          "alignment": 0
        }, {
          "position": 3,
          "serverId": 0,
          "cameraId": 2,
          "quality": 1,
          "mode": "v",
          "type": "c",
          "url": null,
          "showMargin": true,
          "showMenu": true,
          "keepRatio": true,
          "alignment": 0
        }
      ]
    }
  ]
}

See attributs description of mosaics for more information.

Creating a mosaic

Requires Admin profile.

POST /api/v1.2/groups
Parameters
Name Description
group mosaic content
Request example
POST /api/v1.2/groups
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "group" : {
    "name": "AllCamera",
    "rows": 3,
    "cols": 3,
    "fullScreen": false,
    "pushMode": false,
    "layout": [
        [
            0,
            0,
            1
        ],
        [
            0,
            0,
            2
        ],
        [
            3,
            4,
            5
        ]
    ],
    "levels": [
        {
            "name": "AllCamera 0",
            "duration": 10,
            "elements": [
                {
                    "position": 0,
                    "serverId": 0,
                    "cameraId": 15,
                    "streamId": 45,
                    "mode": "v",
                    "type": "c",
                    "url": null,
                    "showMargin": true,
                    "showMenu": true,
                    "keepRatio": true,
                    "alignment": 0
                },
                {
                    "position": 1,
                    "serverId": 0,
                    "cameraId": 10,
                    "streamId": 30,
                    "mode": "v",
                    "type": "c",
                    "url": null,
                    "showMargin": true,
                    "showMenu": true,
                    "keepRatio": true,
                    "alignment": 0
                },
                {
                    "position": 2,
                    "serverId": 0,
                    "cameraId": 9,
                    "quality": 1,
                    "mode": "v",
                    "type": "c",
                    "url": null,
                    "showMargin": true,
                    "showMenu": true,
                    "keepRatio": true,
                    "alignment": 0
                },
                {
                    "position": 3,
                    "serverId": 0,
                    "cameraId": 8,
                    "streamId": 24,
                    "mode": "v",
                    "type": "c",
                    "url": null,
                    "showMargin": true,
                    "showMenu": true,
                    "keepRatio": true,
                    "alignment": 0
                },
                {
                    "position": 4,
                    "serverId": 0,
                    "cameraId": 2,
                    "quality": 2,
                    "mode": "v",
                    "type": "c",
                    "url": null,
                    "showMargin": true,
                    "showMenu": true,
                    "keepRatio": true,
                    "alignment": 0
                },
                {
                    "position": 5,
                    "serverId": 0,
                    "cameraId": 4,
                    "streamId": 12,
                    "mode": "v",
                    "type": "c",
                    "url": null,
                    "showMargin": true,
                    "showMenu": true,
                    "keepRatio": true,
                    "alignment": 0
                }
            ]
        }
    ]
  }
}  

See attributs description of mosaics for more information.

Response example
HTTP/1.1 201 Created
Content-length: 180
Content-Type: application/json
Location: /api/v1.2/groups/2
{
    "group": {
        "id": 2,
        "name": "AllCamera",
        "rows": 3,
        "cols": 3,
        "fullScreen": false,
        "pushMode": false
    }
}

The link to the resource created is in the Location header.

Modifying a mosaic

Requires the Admin profile or that the edit right is checked for this mosaic in the user profile. There are 2 levels of mosaic modification :

PUT /api/v1.2/goups/:group_id
Parameters

For in-depth modification :

Name Description
group Mosaic content. The previous content is completely replaced by the new content.

For cycle modification :

Name Description
levels New cycle definition
In-depth modification request example
PUT /api/v1.2/groups/5
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "group" : {
    "name": "AllCameraBis",
    "pushMode": true,
    "layout": [
        [
            0,
            0,
            1
        ],
        [
            0,
            0,
            2
        ],
        [
            3,
            4,
            5
        ]
    ],
    "levels": [
        {
            "name": "AllCamera 0",
            "duration": 10,
            "elements": [
                {
                    "position": 0,
                    "serverId": 0,
                    "cameraId": 15,
                    "quality": 2,
                    "mode": "v",
                    "type": "c",
                    "url": null,
                    "showMargin": true,
                    "showMenu": true,
                    "keepRatio": true,
                    "alignment": 0
                },
                {
                    "position": 1,
                    "serverId": 0,
                    "cameraId": 10,
                    "streamId": 31,
                    "mode": "v",
                    "type": "c",
                    "url": null,
                    "showMargin": true,
                    "showMenu": true,
                    "keepRatio": true,
                    "alignment": 0
                },
                {
                    "position": 2,
                    "serverId": 0,
                    "cameraId": 9,
                    "streamId": 27,
                    "mode": "v",
                    "type": "c",
                    "url": null,
                    "showMargin": true,
                    "showMenu": true,
                    "keepRatio": true,
                    "alignment": 0
                },
                {
                    "position": 3,
                    "serverId": 0,
                    "cameraId": 8,
                    "quality": 3,
                    "mode": "v",
                    "type": "c",
                    "url": null,
                    "showMargin": true,
                    "showMenu": true,
                    "keepRatio": true,
                    "alignment": 0
                },
                {
                    "position": 4,
                    "serverId": 0,
                    "cameraId": 2,
                    "quality": 1,
                    "mode": "v",
                    "type": "c",
                    "url": null,
                    "showMargin": true,
                    "showMenu": true,
                    "keepRatio": true,
                    "alignment": 0
                },
                {
                    "position": 5,
                    "serverId": 0,
                    "cameraId": 4,
                    "quality": 1,
                    "streamId": 12,
                    "mode": "v",
                    "type": "c",
                    "url": null,
                    "showMargin": true,
                    "showMenu": true,
                    "keepRatio": true,
                    "alignment": 0
                }
            ]
        }
    ]
  }
}

See attributs description of mosaics for more information.

Cycle modification request example
PUT /api/v1.2/groups/5
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "levels": [
      {
          "name": "AllCamera 0",
          "duration": 10,
          "elements": [
              {
                  "position": 0,
                  "serverId": 0,
                  "cameraId": 15,
                  "streamId": 46,
              },
              {
                  "position": 1,
                  "serverId": 0,
                  "cameraId": 10,
                  "streamId": 30,
              },
              {
                  "position": 2,
                  "serverId": 0,
                  "cameraId": 9,
                  "streamId": 27,
              },
              {
                  "position": 3,
                  "serverId": 0,
                  "cameraId": 8,
                  "streamId": 26,
              },
              {
                  "position": 4,
                  "serverId": 0,
                  "cameraId": 2,
                  "streamId": 10,
              },
              {
                  "position": 5,
                  "serverId": 0,
                  "cameraId": 4,
                  "streamId": 12,
              }
          ]
      }
  ]
}
Response example
HTTP/1.1 200 OK
Content-length: 180
Content-Type: application/json
Content-Location: /api/v1.2/groups/2
{
    "group": {
        "id": 2,
        "name": "AllCameraBis",
        "rows": 3,
        "cols": 3,
        "fullScreen": false,
        "stayOnTop": false,
        "displayCode": 201,
        "pushMode": true
    }
}

The link to the modified resource is in the Content-Location header.

Mosaic attributes and properties

Mosaic attributes
Name Type Description Add Modification
id integer Camtrace mosaic ID No No
name text Mosaic name Mandatory Optional
pushMode boolean Whether the mosaic accepts Push mode or not, false by default Optional Optional
rows integer Number of horizontal positions (before possible merge) Mandatory Optional
cols integer Number of vertical positions (before possible merge) Mandatory Optional
defaultLevelDuration integer Default level duration Optional Optional
displayCode integer Mosaic view code Optional Optional
layout array Positioning of cells, 2-dimensional array of sizes cols and rows respectively Mandatory Optional
levels array List of levels making up the stream chain Mandatory Optional
fullScreen boolean Not applicable Optional Optional
stayOnTop boolean Not applicable Optional Optional
comments text Description or comments about the mosaic Optional Optional

Layout is an array of rows x cols positions. Each position is assigned an integer numerical identifier corresponding to a cell, starting with 0. A cell can occupy several positions in the table in order to merge (both vertically and horizontally). The final number of cells is therefore less than or equal to cols * rows. Each position must receive a cell identifier.

Levels attributes

List of the various attributes included in the definition of each level (levels) in the mosaic.

Name Type Description Mandatory
name text Level ID Yes
duration integer Duration of level display before switching to next level No
elements array Level properties for each mosaic cell Yes *

* Mandatory attribute but may be empty. If a cell definition (identified by its position) is not present in the table, it will remain empty when this level is displayed.

Level elements properties

List of the various attributes included in the definition of each level cell (levels) in the mosaic.

Name Type Description Presence (in-depth mod. ) Presence (cycles mod.)
position integer cell position Mandatory Mandatory
serverId integer Server id in the case of a cluster Optionnelle Optional
cameraId integer Camtrace ID of the camera in case of type c. Optional Mandatory
streamId integer Stream ID corresponding to the camera to be used Mandatory * in case of v mode Mandatory *
quality integer Stream quality (1 to 3) Optional * Optional *
type character type of element in cell c for camera,i for image,w for web browser Optional, c by default No
mode character Mode dépendant du type d’élément v pour vidéo, a pour alarme Optional, v by default No
url text url depending on element type if type = w or i No
showMargin boolean Not applicable Optional No
showMenu boolean CT-Client cell menu display Optional No
keepRatio boolean Display image without distortion (otherwise full cell, possibly distorted) Optional No
alignment integer Not applicable Optional No

* At least one of the 2 fields must be present. If both are present, the quality field is preferred. Eventually, for the sake of consistency, the streamId field will be mandatory.

Real-time mosaic modifications

Real-time modification allows you to temporarily or permanently alter the behavior of a mosaic currently being viewed, in order to display a camera stream. Requires the Admin profile or that the edit right is checked for this mosaic in the user profile.

GET /api/v1.2/goups/:group_id/override
Parameters
Name Description Note
position Overridden cell ID Mandatory
cameraId Identifiant de la Caméra à visionner Optional
streamId Identifiant du flux de la Caméra à visionner Mandatory if cameraId is present
duration Display time in seconds before return to normal cycle for this cell Optional

If duration is absent, the override is permanent for the duration of the mosaic display without reloading the configuration. To cancel a cell override (e.g. in the case of indefinite overrides), call the method for the mosaic only with the position parameter.

Request example
GET /api/v1.2/groups/2/override?position=0&cameraId=15&streamId=34&duration=20
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 204 No Content
Content-Type: text/html

Passive screens

All requests for passive screens must be made with a user name and password. (see part Authentication).

List of passive screens

GET /api/v1.2/screens
Response
HTTP/1.1 200 OK
Content-Length: 161
Content-Type: application/json
{
  "screens": [
    {
      "id": 1,
      "num": 2,
      "name": "PassScreen1",
      "host": "10.5.0.38",
      "serverId": 0,
      "cameraId": 1,
      "groupId": null,
      "displayCode": null,
      "href": "/api/v1.2/screens/1"
    }
  ]
}

Retrieving a passive screen

GET /api/v1.2/screens/:screen_id
Response
HTTP/1.1 200 OK
Content-Length: 116
Content-Type: application/json
{
  "id": 1,
  "num": 2,
  "name": "PassScreen1",
  "host": "10.5.0.38",
  "serverId": 0,
  "cameraId": 1,
  "groupId": null,
  "displayCode": null
}

Modifying a passive screen

PUT /api/v1.2/screens/:screen_id
Parameters
Name Description
serverId The ID of the cluster server where to find the camera or mosaic to be displayed.
cameraId ID of camera to be displayed.
groupId ID of the mosaic to be displayed.
Request
PUT /api/v1.2/screens/1
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "screen": {
    "serverId": 0,
    "groupId": 2
  }
}
Response
HTTP/1.1 200 OK
Content-Length: 116
Content-Type: application/json
{
  "id": 1,
  "num": 2,
  "name": "PassScreen1",
  "host": "10.5.0.38",
  "serverId": 0,
  "cameraId": null,
  "groupId": 2,
  "displayCode": null
}

Commands

All requests concerning orders must be made with a user name and password. (see part Authentication).

List of commands

GET /api/v1.2/exturls
Response
HTTP/1.1 200 OK
Content-Length: 373
Content-Type: application/json
{
    "exturls": [
        {
            "id": 7,
            "name": "Allume_Etteind",
            "href": "/api/v1.2/exturls/7"
        },
        {
            "id": 2,
            "name": "Allume_ProjoIR_Prise1",
            "href": "/api/v1.2/exturls/2"
        },
        {
            "id": 3,
            "name": "Eteint_ProjoIR_Prise1",
            "href": "/api/v1.2/exturls/3"
        },
        {
            "id": 4,
            "name": "Allume_Halogène_Prise2",
            "href": "/api/v1.2/exturls/4"
        },
        {
            "id": 5,
            "name": "Eteint_Halogène_Prise2",
            "href": "/api/v1.2/exturls/5"
        }
    ]
}

Details of a command

GET /api/v1.2/exturls/:exturls_id
Response
HTTP/1.1 200 OK
Content-Length: 198
Content-Type: application/json
{
    "exturls": {
        "id": 7,
        "name": "Allume_Eteint",
        "urls": [
            "http://10.2.50.100/tgi/control.tgi?l=p:admin:admin&port=u1uu",
            "delay=10",
            "http://10.2.50.100/tgi/control.tgi?l=p:admin:admin&port=u0uu"
        ]
    }
}

Trigger a command

GET /api/v1.2/exturls/:exturls_id/trigger
Response
HTTP/1.1 200 OK
Content-Length: 18
Content-Type: application/json
{"triggered": true}

Alarms

All requests concerning alarms must be made with a user and password. (see part Authentication), except for thumbnails.

List of the alarms

GET /api/v1.2/cameras[/:camera_id]alarms

The camera_id parameter is optional. If it is present, the search will be made only on the alarms of the corresponding camera, otherwise all cameras will be taken into account.

Response
HTTP/1.1 200 OK
Content-Length: 5106
Content-Type: application/json
Link: <//demo.camtrace.com/api/v1.2/cameras/alarms?limit=20&offset=20>; rel="next"
{
    "alarms": [
        {
            "id": 219739,
            "time": "2014-09-12T09:44:21Z",
            "recordTime": null,
            "cameraId": 21,
            "description": "MOTION Alarm",
            "snapshot": "/api/v1.2/cameras/alarms/219739.jpg",
            "thumbnail": "/api/v1.2/cameras/alarms/219739.jpg?w=50&h=50"
        },
        {
            "id": 219738,
            "time": "2014-09-12T09:44:12Z",
            "recordTime": "2014-09-12T09:44:07Z",
            "cameraId": 31,
            "description": "MOTION Alarm starts at 12/09/2014 at 11:44:07, with 5s pre-alarm",
            "snapshot": "/api/v1.2/cameras/alarms/219738.jpg",
            "thumbnail": "/api/v1.2/cameras/alarms/219738.jpg?w=50&h=50"
        },
        {
            "id": 219737,
            "time": "2014-09-12T09:44:11Z",
            "recordTime": null,
            "cameraId": 21,
            "description": "MOTION Alarm",
            "snapshot": "/api/v1.2/cameras/alarms/219737.jpg",
            "thumbnail": "/api/v1.2/cameras/alarms/219737.jpg?w=50&h=50"
        }
    ]
}
Parameters
Name Type Description
q text Filter to be applied to description field.
from text GMT start date in ISO-8601 format (see Wikipedia, ex: 2014-09-12T06:00:00Z).
to text GMT end date in ISO-8601 format (see Wikipedia, ex: 2014-09-12T06:00:00Z).
limit integer Number of requested results.
offset integer Position in results set after filters applied. Zero corresponds to the latest alarms.
Examples
# All alarms since 14:00 on September 12, 2014:
$ curl -u demo:demo 'http://demo.camtrace.com/api/v1.2/cameras/alarms?from=2014-09-12T14:00:00Z'

# All alarms on September 12, 2014 for camera ID 2:
$ curl -u demo:demo 'http://demo.camtrace.com/api/v1.2/cameras/2/alarms?from=2014-09-12T00:00:00Z&to=2014-09-12T23:59:59Z'

Triggering an alarm

An alarm condition can be triggered on one or more cameras at the same time.

GET /api/v1.2/cameras/alarms/trigger
Parameters
Name Type Description
cameraId integer or list of integers Camera or cameras ID (separated with a ,) for which to trigger the alarm (mandatory)
type text Personalized alarm type (optional)
Request example
GET /api/v1.2/cameras/alarms/trigger?cameraId=1,3&type=porte1
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/html

Acknowledging an alarm

It is possible to acknowledge an alarm status on one or more cameras at the same time.

GET /api/v1.2/cameras/alarms/untrigger
Parameters
Name Type Description
cameraId integer or list of integers Camera or cameras ID (separated with a ,) for which to trigger the alarm (mandatory)
Request example
GET /api/v1.2/cameras/alarms/untrigger?cameraId=1,3
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/html

Exports

All export requests must be made with a user name and password (see part Authentication). The user must have a profile with the specific Admin or Protection level. In the latter case, he must also have viewing rights on the camera corresponding to the export.

List of externa storage devices

GET /api/v1.2/exports/disks
Parameters

None

Request example
GET /api/v1.2/exports/disks
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 200 OK
Content-Type: application/json
{
    "disks": [
        {
            "id": 1,
            "name": "newVol",
            "fstype": "ext4",
            "totalSpace": 32737501184,
            "freeSpace": 32737501184,
        }
    ]
}

List of exports

GET /api/v1.2/exports
Parameters
Name Description
CameraId Camera or cameras ID (separated with a ,) for which to find exports (optional)
from Filter by search start date in ISO8601 format (optional)
to Filter by search end date in ISO8601 format (optional)
Request example
GET /api/v1.2/exports?cameraId=1,2&from=2018-09-17T13:19:57Z&to=2018-09-18T00:00:00Z
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 200 OK
Content-Type: application/json
{
    "exports": [
        {
            "id": 5,
            "cameraId": 1,
            "diskId": null,
            "from": "2018-09-17T13:24:25Z",
            "to": "2018-09-17T13:32:56Z",
            "type": "a",
            "comment": "",
            "downloadUrl": "/api/v1.2/exports/5/download",
            "size": 0,
            "p100": 100,
            "md5sum": null,
            "archived": false,
            "createdAt": "2018-09-17T13:36:37Z",
            "url": "/api/v1.2/exports/5"
        },
        {
            "id": 6,
            "cameraId": 1,
            "diskId": null,
            "from": "2018-09-17T13:19:57Z",
            "to": "2018-09-17T13:39:57Z",
            "type": "r",
            "comment": "",
            "downloadUrl": "/api/v1.2/exports/6/download",
            "size": 0,
            "p100": 100,
            "md5sum": null,
            "archived": false,
            "createdAt": "2018-09-17T13:40:10Z",
            "url": "/api/v1.2/exports/6"
        }
    ]
}
Description of export attributes
Nom Type Description
id integer Camtrace ID of the export
cameraId integer Camtrace camera ID
diskId integer Camtrace ID of the external medium on which the export is stored. If this field is null, the export is stored in the default directory mounted on the server.
from date ISO8021 sequence start date.
to date ISO8021 sequence end date.
type char Export type ID.
comment text Export comments.
downloadUrl text URL for export download.
size integer Export size in bytes.
p100 integer Export creation percentage (worth 100 when export creation is complete).
md5sum text MD5 hash of export file.
archived boolean Indicates whether or not the export has been archived.
createdAt text ISO8021 export creation date.
url text URL to retrieve export details see Detail of an export

Detail of an export

GET /api/v1.2/exports/:export_id
Parameters

None

Request example
GET /api/v1.2/exports/5
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 200 OK
Content-Type: application/json
{
    "export": {
        "id": 5,
        "cameraId": 1,
        "diskId": null,
        "from": "2018-09-17T13:24:25Z",
        "to": "2018-09-17T13:32:56Z",
        "type": "a",
        "comment": "",
        "downloadUrl": "/api/v1.2/exports/5/download",
        "size": 0,
        "p100": 100,
        "md5sum": null,
        "archived": false,
        "createdAt": "2018-09-17T13:36:37Z",
        "url": "/api/v1.2/exports/5"
    }
}

See attributes description of exports for more information.

Creating an export

POST /api/v1.2/exports
Parameters
Name Description
CameraId Camera ID for which export is created.
from Sequence start date in ISO8601 format.
to Sequence end date in ISO8601 format.
type Export type (optional): set to “a” (alarm) or “r” (regular), “r” is the default.
diskId Camtrace ID of external disk on which to create export (optional).
comment comment about the export (optional)
Request example
POST /api/v1.2/exports
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "export": {
    "cameraId": 1,
    "from": "2018-09-17T13:24:25Z"
    "to": "2018-09-17T13:26:00Z"
  }
}
Response example
HTTP/1.1 201 CREATED
Content-Type: application/json
{
    "export": {
        "id": 8,
        "cameraId": 1,
        "diskId": null,
        "from": "2018-09-17T13:24:25Z",
        "to": "2018-09-17T13:26:00Z",
        "type": "r",
        "comment": "",
        "downloadUrl": "/api/v1.2/exports/8/download",
        "size": 0,
        "p100": 0,
        "md5sum": null,
        "archived": false,
        "createdAt": "2018-09-17T13:36:37Z",
        "url": "/api/v1.2/exports/8"
    }
}

See attributes description of exports for more information.

Downloading an export

GET /api/v1.2/exports/:export_id/download
Parameters

None

Request example
GET /api/v1.2/exports/8/download
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 200 OK
Content-Type: application/zip

MD5 hash of an export file

This call calculates the MD5 hash of the export file on disk.

GET /api/v1.2/exports/:export_id/md5sum
Parameters

None

Request example
GET /api/v1.2/exports/8/md5sum
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 200 OK
Content-Type: application/json
{
    "md5sum": "d41d8cd98f00b204e9800998ecf8427e"
}

Deleting an export

DELETE /api/v1.2/exports/:export_id
Parameters

None

Request example
DELETE /api/v1.2/exports/8
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 204 NO CONTENT
Content-Type: text/html

Modifying an export

This call archives the export and deletes the export file on the related disk.

PUT /api/v1.2/exports/:export_id
Parameters
Name Description
archived this field must take an equivalent of “true” to archive the export
Request example
PUT /api/v1.2/exports/9
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "export": {
    "archived": 1,
  }
}
Response example
HTTP/1.1 200 OK
Content-Type: application/json
{
    "export": {
        "id": 9,
        "cameraId": 1,
        "diskId": null,
        "from": "2018-09-17T13:24:25Z",
        "to": "2018-09-17T13:32:56Z",
        "type": "a",
        "comment": "",
        "downloadUrl": "/api/v1.2/exports/9/download",
        "size": 0,
        "p100": 100,
        "md5sum": null,
        "archived": true,
        "createdAt": "2018-09-17T13:36:37Z",
        "url": "/api/v1.2/exports/9"
    }
}

See attributes description of exports for more information.

Relaunching an export task

Creating export files can take some time and may eventually fail. This call allows you to make a new attempt to create the export if necessary.

PATCH /api/v1.2/exports/:export_id
Request example
PATCH /api/v1.2/exports/9
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json

Response example

HTTP/1.1 200 OK
Content-Type: application/json
{
    "export": {
        "id": 8,
        "cameraId": 1,
        "diskId": null,
        "from": "2018-09-17T13:24:25Z",
        "to": "2018-09-17T13:26:00Z",
        "type": "r",
        "comment": "",
        "downloadUrl": "/api/v1.2/exports/9/download",
        "size": 0,
        "p100": 0,
        "md5sum": null,
        "archived": false,
        "createdAt": "2018-09-17T13:36:37Z",
        "url": "/api/v1.2/exports/9"
    }
}

See attributes description of exports for more information.

Protected records

All requests concerning protected records must be made with a user name and password. (see part Authentication). The user must have viewing rights on the camera corresponding to the sequence to be protected.

Protecting a record

The user must have a profile with the specific Admin or Protection level.

POST /api/v1.2/precords
Parameters
Name Description
CameraId The camera ID for which the sequence is to be protected.
from Record start date in ISO8601 format.
to Record end date in ISO8601 format
type Recording type (optional): set to “a” (alarm) or “r” (regular), “r” is the default.
comment comment associated with the protected sequence (optional)
Request example
POST /api/v1.2/precords
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "precord": {
    "cameraId": 1,
    "from": "2018-09-17T13:24:25Z",
    "to": "2018-09-17T13:26:00Z",
    "comment": "Test de séquence protégée"
  }
}
Response example
HTTP/1.1 201 CREATED
Content-Type: application/json
{
    "precord": {
            "cameraId": 1,
            "from": "2018-09-17T13:24:25Z",
            "to": "2018-09-17T13:26:00Z",
            "type": "r"
        }
}

Snapshots

All requests for snapshots must be made with a user name and password. (see part Authentication). The user must have a profile with the specific consult level.

Listing snapshots

Only snapshots for cameras on which the user has the viewing rights will be returned.

GET /api/v1.2/snapshots
Parameters
Name Description
cameraId Camera ID(s) separated by "," for which to find snapshots (optional)
from Filter by search start date in ISO8601 format (optional)
to Filter by search end date in ISO8601 format (optional)
userId The user ID who performed the snapshot (optional)
comment All or part of the commentary on the snapshot (optional)
limit Number of results requested. (optional)
offset Position in result set after filters have been applied. Zero corresponds to the most recent snapshots. (optional)
Request example
GET /api/v1.2/snapshots?cameraId=1,2&from=2022-10-09T18:00:00Z&to=2022-10-10T12:30:00Z
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
{
    "snapshots": [
        {
            "id": 19,
            "time": "2022-10-09T19:47:10Z",
            "userId": 1,
            "ip": "197.26.193.27",
            "cameraId": 1,
            "comment": "Un test",
            "updatable": false,
            "imageUrl": "/api/v1.2/snapshots/19.jpg",
            "reportUrl": "/api/v1.2/snapshots/19.pdf"
        },
        {
            "id": 20,
            "time": "2022-10-10T08:14:10Z",
            "userId": 1,
            "ip": "197.26.193.27",
            "cameraId": 1,
            "comment": null,
            "updatable": true,
            "imageUrl": "/api/v1.2/snapshots/20.jpg",
            "reportUrl": "/api/v1.2/snapshots/20.pdf"
        }
    ], "paging": {
        "first": "/api/v1.2/snapshots?limit=20",
        "count": 1,
        "current": 0,
        "last": "/api/v1.2/snapshots?limit=20&offset=0"
    }
}

Details of a snapshot

GET /api/v1.2/snapshots/:snapshot_id
Parameters

None

Request example
GET /api/v1.2/snapshots/19
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 200 OK
Content-Type: application/json
{
    "id": 19,
    "time": "2022-10-09T19:47:10Z",
    "userId": 1,
    "ip": "197.26.193.27",
    "cameraId": 1,
    "comment": null,
    "updatable": true,
    "imageUrl": "/api/v1.2/snapshots/19.jpg",
    "reportUrl": "/api/v1.2/snapshots/19.pdf"
}

Creating a snapshot

The user must have the right to view the camera in question.

POST /api/v1.2/snapshots
Parameters
Name Description
cameraId The camera ID on which to capture the video stream image
time Date and time of snapshot in ISO8601 format (optional). If not specified, date will be set at request time.
comment comment associated with the snapshot (optional)
Request example
POST /api/v1.2/snapshots
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "snapshot": {
    "cameraId": 1,
    "time": "2022-10-10T13:24:25Z"
  }
}
Response example
HTTP/1.1 201 CREATED
Content-Type: application/json
{
    "snapshot": {
        "id": 21,
        "time": "2022-10-10T13:24:25Z",
        "userId": 1,
        "ip": "192.168.0.140",
        "cameraId": 17,
        "comment": null,
        "updatable": true,
        "imageUrl": "/api/v1.2/snapshots/21.jpg",
        "reportUrl": "/api/v1.2/snapshots/21.pdf"
    }
}

Updating a snapshot

The user must have viewing rights for the camera concerned. Only snapshots with no associated comment can be updated.

PUT /api/v1.2/snapshots/:snapshot_id
Parameters
Name Description
comment comment associated with the snapshot
Request example
PUT /api/v1.2/snapshots/21
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "snapshot": {
    "comment": "Test de main courante"
  }
}
Response example
HTTP/1.1 200 OK
Content-Type: application/json
{
    "snapshot": {
        "id": 21,
        "time": "2022-10-10T13:24:25Z",
        "userId": 1,
        "ip": "192.168.0.140",
        "cameraId": 17,
        "comment": "Test de main courante",
        "updatable": false,
        "imageUrl": "/api/v1.2/snapshots/21.jpg",
        "reportUrl": "/api/v1.2/snapshots/21.pdf"
    }
}

Retrieve image from snapshot

The user must have the right to view the camera in question.

GET /api/v1.2/snapshots/:snapshot_id.jpg
Parameters
Nom Description
width Image width in pixels (optional)
height Image height in pixels (optional)
Request example
GET /api/v1.2/snapshots/21.pdf
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example

The response is an image in JPEG format.

Retrieve a report from the snapshot

The user must have the right to view the camera in question.

GET /api/v1.2/snapshots/:snapshot_id.pdf
Parameters

None

Request example
GET /api/v1.2/snapshots/21.pdf
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example

The response is a PDF document.

Scenarios

All requests concerning scenarios must be made with a user name and password (see part Authentication). The user must have a profile with the specific Admin level.

Listing scenarios

GET /api/v1.2/scenarios
Parameters

None

Request example
GET /api/v1.2/scenarios
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 200 OK
Content-Type: application/json
{
    "scenarios": [
        {
            "scenarioId": 1,
            "name": "Scenar 1",
            "ignored": false
        },
        {
            "scenarioId": 2,
            "name": "Scenar 2",
            "ignored": true,
        }
    ]
}
Attributes description of a scenario
Name Type Description
scenarioId integer Scenario Camtrace ID
name text Scenario name
ignored boolean Indicates whether the scenario is ignored or not

Triggering a scenario

GET /api/v1.2/scenarios/:id/trigger
Parameters

None

Request example
GET /api/v1.2/scenarios/1/trigger
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 200 OK
Content-Type: application/json
{
    "triggered": true
}

Ignoring a scenario

PUT /api/v1.2/scenarios/:id
Parameters
Name Description
ignored Boolean which takes the value true to ignore the scenario and false to make it active again.
Request example
PUT /api/v1.2/scenarios/1
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
    "scenario": {
        "ignored": true
    }
}
Response example
HTTP/1.1 200 OK
Content-Type: application/json
{
    "scenario": {
        "scenarioId": 1,
        "name": "Scénario test",
        "ignored": "true"
    }
}

Slices

Recordings from video cameras managed by the CT-server are stored in the form of .mkv format slices of limited duration (generally 10 minutes maximum). The slice API lets you list slices and download them individually. The user must have viewing rights on the camera corresponding to the slices to be viewed and downloaded.

Listing slices

GET /api/v1.2/slices
Parameters
Name Description
CameraId camera ID(s) for which to find the slices, separated by , (optional)
from Filter by search start date in ISO8601 format (optional)
to Filter by search end date in ISO8601 format (optional)
type Type of record: alarm (a) or regular (r)
Request example
GET /api/v1.2/slices?cameraId=1,2&from=2020-06-16T16:25:00Z&to=2020-06-16T16:35:00Z
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
{
    "slices": [
        {
            "cameraId": 1,
            "cameraName": "demo2_Tube_CamTrace_CCTN5EW01",
            "start": "2020-06-16T16:26:36.903Z",
            "stop": "2020-06-16T16:29:46.729Z",
            "type": "a",
            "downloadUrl": "/api/v1.2/slices/1/2020-06-16T16%3A26%3A36.903Z/a/download",
            "size": 144030,
            "protected": false
        },
        {
            "cameraId": 1,
            "cameraName": "demo2_Tube_CamTrace_CCTN5EW01",
            "start": "2020-06-16T16:29:51.458Z",
            "stop": "2020-06-16T16:30:10.828Z",
            "type": "a",
            "downloadUrl": "/api/v1.2/slices/1/2020-06-16T16%3A29%3A51.458Z/a/download",
            "size": 15364,
            "protected": false
        }
    ]
}

Downloading a slice

GET /api/v1.2/slices/:cameraId/:start/:type/download
Parameters

None

Request example
GET /api/v1.2/slices/1/2020-06-16T16%3A29%3A51.458Z/a/download
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 200 OK
Content-Type: video/x-matroska

Maps

All requests concerning plans must be made with a user name and password. (see part Authentication). The user must have a profile with the specific Admin level to create or delete plans. For consultation or modification, the user profile must have the corresponding associated right defined for each plan. Elements (cameras and associated ptz presets, mosaics, controls, passive screens or other maps) for which the user does not have viewing rights will not appear on the map, even if the user does have viewing rights for the map in question. For this service to be available, the Camtrace server must be licensed to use the maps.

Listing maps

Only plans for which the user has viewing rights appear in the response (systematically all for the Admin profile).

GET /api/v1.2/maps
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "maps": [
        {
            "uuid": "edeb519a-9e02-4766-84bc-13dea79b61c8",
            "name": "Parking",
            "version": 4,
            "detailUrl": "/api/v1.2/maps/edeb519a-9e02-4766-84bc-13dea79b61c8"
        },
        {
            "uuid": "5f20a627-c915-42be-895e-865101763dc0",
            "name": "Entrée",
            "version": 9,
            "detailUrl": "/api/v1.2/maps/5f20a627-c915-42be-895e-865101763dc0"
        }
    ]
}

Retrieving a map

Requires the Admin profile or that the view right is checked for this plan in the user profile.

GET /api/v1.2/maps/:uuid
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "map" : {
        "uuid": "edeb519a-9e02-4766-84bc-13dea79b61c8",
        "name": "Parking",
        "version": 4,
        "scale": 1,
        "items": [
          {
                "posX": 336,
                "posY": 279,
                "type": "camera",
                "width": 40,
                "height": 40,
                "zIndex": 1,
                "properties": {
                    "id": "15",
                    "node": "0",
                    "angle": 15.489200556287,
                    "range": 327.07491496598,
                    "direction": 17.018305445794
                }  
          },
          {
            "posX": 1310,
                "posY": 519,
                "type": "map",
                "width": 40,
                "height": 40,
                "zIndex": 1,
                "properties": {
                    "id": "5f20a627-c915-42be-895e-865101763dc0"
                }
          }
        ],
        "backgrounds": [
                {
                  "posX": 622,
                  "posY": 154,
                  "image": "<binary data>",
                  "width": 1175,
                  "height": 744,
                  "zIndex": 0
                }
        ]
  }
}

See attributes description of maps for more information.

Retrieving map elements

Requires the Admin profile or that the view right is checked for this plan in the user profile. Only elements (cameras and associated ptz presets, mosaics, controls, passive screens or maps) for which the user has the visualization right will be returned.

GET /api/v1.2/maps/:uuid/items
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
    "items": [
      {
            "posX": 336,
            "posY": 279,
            "type": "camera",
            "width": 40,
            "height": 40,
            "zIndex": 1,
            "properties": {
                "id": "15",
                "node": "0",
                "angle": 15.489200556287,
                "range": 327.07491496598,
                "direction": 17.018305445794
            }  
      },
      {
        "posX": 1310,
            "posY": 519,
            "type": "map",
            "width": 40,
            "height": 40,
            "zIndex": 1,
            "properties": {
                "id": "5f20a627-c915-42be-895e-865101763dc0"
            }
      }
    ]
}

See attributes description of maps for more information.

Creating a map

Requires Admin profile.

POST /api/v1.2/maps
Parameters
Name Description
map Map content
Request example
POST /api/v1.2/maps
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "map" : {
        "name": "Batiment 2",
        "items": [
          {
                "posX": 332,
                "posY": 271,
                "type": "camera",
                "width": 40,
                "height": 40,
                "zIndex": 1,
                "properties": {
                    "id": "5",
                    "node": "0",
                    "angle": 16.49,
                    "range": 288.1,
                    "direction": 32
                }  
          },
          {
            "posX": 1310,
                "posY": 519,
                "type": "command",
                "width": 40,
                "height": 40,
                "zIndex": 1,
                "properties": {
                    "id": "1"
                }
          }
        ],
        "backgrounds": [
                {
                  "posX": 20,
                  "posY": 19,
                  "image": "<binary data>",
                  "width": 1280,
                  "height": 770,
                  "zIndex": 0
                }
        ]
  }

See attributes description of maps for more information.

Response example
HTTP/1.1 201 CREATED
Content-Type: application/json
{
    "map": {
        "uuid": "6d20a627-d916-41be-835a-865101763ef5",
        "version": 1,
        "name": "Batiment 2",
        "detailUrl": "/api/v1.2/maps/6d20a627-d916-41be-835a-865101763ef5"
    }
}

Updating a map

Requires the Admin profile or that the edit right is checked for this map in the user profile.

PUT /api/v1.2/maps/:uuid
Parameters
Name Description
map Map content. The previous content is completely replaced by the new content.
Request example
PUT /api/v1.2/maps/6d20a627-d916-41be-835a-865101763ef5
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "map" : {
        "name": "Batiment 2",
        "scale": 1.2,
        "items": [
          {
                "posX": 332,
                "posY": 271,
                "type": "camera",
                "width": 40,
                "height": 40,
                "zIndex": 1,
                "properties": {
                    "id": "5",
                    "node": "0",
                    "angle": 16.49,
                    "range": 288.1,
                    "direction": 32
                }  
          },
          {
                "posX": 888,
                "posY": 412,
                "type": "camera",
                "width": 40,
                "height": 40,
                "zIndex": 1,
                "properties": {
                    "id": "6",
                    "node": "0",
                    "angle": 16.49,
                    "range": 288.1,
                    "direction": 256
                }  
          },
          {
            "posX": 1310,
                "posY": 519,
                "type": "command",
                "width": 60,
                "height": 60,
                "zIndex": 1,
                "properties": {
                    "id": "1"
                }
          }
        ],
        "backgrounds": [
                {
                  "posX": 20,
                  "posY": 19,
                  "image": "<binary data>",
                  "width": 1280,
                  "height": 770,
                  "zIndex": 0
                }
        ]
  }

See attributes description of maps for more information.

Response example
HTTP/1.1 200 OK
Content-Type: application/json
{
    "map": {
        "uuid": "6d20a627-d916-41be-835a-865101763ef5",
        "version": 2,
        "name": "Batiment 2",
        "detailUrl": "/api/v1.2/maps/6d20a627-d916-41be-835a-865101763ef5"
    }
}

Deleting a map

DELETE /api/v1.2/maps/:uuid
Parameters

None

Request example
DELETE /api/v1.2/maps/6d20a627-d916-41be-835a-865101763ef5
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 204 NO CONTENT
Content-Type: text/html

Description of attributes and properties of maps

Map attributes
Name Type Description Adding Updating
uuid uuid Map Camtrace ID No No
name text Map name Mandatory Mandatory
scale decimal Global zoom factor for all map elements Optional Optional
version integer Autoincremental version number Non Non
items array List of map elements Mandatory * Optional
backgrounds array List of map background images Mandatory * Optional

* Mandatory attribute but may be empty.

Element types

These are the various elements likely to be contained in the items table of a map.

Name Description Properties
camera Represents a camera declared on the CT-server (or hierarchical) id, node, angle, range, direction, items
group Represents a mosaic declared on the CT-server id
command Represents a command declared on the CT-server id, node
map Represents a map declared on the CT-server id
screen Represents a passive screen declared on the CT-server id
Camera element types

These are the various elements that can be contained in a camera’s items array.

Name Description Properties
preset Represents a ptz preset of a given camera id, node
Elements attributes

List of the various attributes associated with the elements (items) of a map or camera.

Name Type Description Mandatory
type text Type d’élément Yes
posX integer Absolute abscissa (top left point) of element in the map in pixels Yes
posY integer Absolute ordinate (top left point) of element in the map in pixels Yes
width integer Element width in pixels Yes
height integer Element height in pixels Yes
zIndex decimal Relative element depth Yes
Map background attributes

List of the various attributes associated with a map background.

Name Type Description Mandatory
posX integer Absolute abscissa (top left point) of element in the map in pixels Yes
posY integer Absolute ordinate (top left point) of element in the map in pixels Yes
width integer Element width in pixels Yes
height integer Element height in pixels Yes
zIndex decimal Relative element depth Yes
image binary image file content Yes
Element property field attributes

List of possible attributes for the properties (properties) field of elements (items) in a map or camera.

Name Type Description Mandatory
id integer or uuid Yes
node entier server on which the element is located Yes
angle decimal camera beam angle in degrees Yes
range decimal camera beam depth in pixels Yes
direction decimal camera orientation in degrees Yes
items array sub-elements of the element No

Folders

All requests concerning folders must be made with a user name and password. (see part Authentication). The user must have a profile with the specific Admin level to create, modify or delete folders. All users can view a folder, but elements (cameras and associated ptz presets, mosaics, controls, passive screens or shots) for which the user does not have viewing rights will not appear when viewing the folder.

Listing folders

GET /api/v1.2/folders
Parameters
Name Description
details Boolean used to directly receive all elements of folser when its value is true (Optional, false by default).
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "folders": [
        {
            "uuid": "edeb519a-9e02-4766-84bc-13dea79b61c8",
            "name": "Sélection 1",
            "detailUrl": "/api/v1.2/folders/edeb519a-9e02-4766-84bc-13dea79b61c8"
        },
        {
            "uuid": "5f20a627-c915-42be-895e-865101763dc0",
            "name": "Sélection 2",
            "detailUrl": "/api/v1.2/folders/5f20a627-c915-42be-895e-865101763dc0"
        }
    ]
}

Retrieve a folder

GET /api/v1.2/folders/:uuid
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
    "folder" : {
        "uuid": "edeb519a-9e02-4766-84bc-13dea79b61c8",
        "name": "Sélection 1",
        "regex": {
            "id": 1,
            "name": "critères 1",
            "params": {
                "value": "([-]*)-([^-]*)-([^-]*)-([^_]*)_([^_]*)_([^ ]*) ([^_]*)",
                "group": [6,7]
            }
        },
        "items": [
            {
                "serverId": 0,
                "type": "map",
                "uuid": "cc34693f-1e02-336f-34ac-3367d67c31fd",
                "weight": -25
            },
            {
                "type": "folder",
                "name": "folder1",
                "weight": -12,
                "items": [
                    {
                        "serverId": 0,
                        "type": "camera",
                        "id": 1,
                        "weight": 0
                    },
                    {
                        "serverId": 0,
                        "type": "map",
                        "uuid": "ab34693c-9e02-556f-34aa-3467d67c88ec",
                        "weight": 0
                    }
                ]
            },
            {
                "name": "folder2",
                "type": "folder",
                "weight": 3,
                "items": [
                    {
                        "serverId": 0,
                        "type": "camera",
                        "id": 1,
                        "weight": 1
                    },
                    {
                        "serverId": 0,
                        "type": "group",
                        "id": 1,
                        "weight": 2
                    },
                    {
                      "type": "folder",
                      "name": "folder21",
                      "weight": 3,
                      "items": [
                      ]  
                    }
                ]
            }
        ]
    }
}

See attributes description of folders for more information.

Creating a folder

Requires Admin profile.

POST /api/v1.2/folders
Parameters
Name Description
folder Content of the folder
Request example
POST /api/v1.2/folders
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "folder" : {
        "name": "Sélection 3",
        "regexId": 1,
        "items": [
            {
                "type": "map",
                "uuid": "cc34693f-1e02-336f-34ac-3367d67c31fd"
            },
            {
                "type": "folder",
                "name": "folder1",
                "weight": -50,
                "items": [
                    {
                        "serverId": 1,
                        "type": "camera",
                        "id": 1
                    },
                    {
                        "type": "map",
                        "uuid": "ab34693c-9e02-556f-34aa-3467d67c88ec",
                        "weight": 10
                    },
                    {
                        "type": "group",
                        "id": 2
                    }
                ]
            }
        ]
    }
}

See attributes description of folders for more information.

Response example
HTTP/1.1 201 CREATED
Content-Type: application/json
{
    "folder": {
        "uuid": "8b6aa627-e455-aabf-4573-865101745dfc",
        "name": "Sélection 3",
        "detailUrl": "/api/v1.2/folders/8b6aa627-e455-aabf-4573-865101745dfc"
    }
}

Update a folder

Requires Admin profile.

PUT /api/v1.2/folders/:uuid
Parameters
Name Description
folder Content of the folder. The content of the previous items field is completely replaced by the new content.
Request example
PUT /api/v1.2/folders/8b6aa627-e455-aabf-4573-865101745dfc
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "folder" : {
        "regexId": 2,
        "items": [
            {
                "type": "map",
                "uuid": "cc34693f-1e02-336f-34ac-3367d67c31fd"
            },
            {
                "type": "folder",
                "name": "folder1",
                "weight": -50,
                "items": [
                    {
                        "serverId": 1,
                        "type": "camera",
                        "id": 1
                    },
                    {
                        "type": "map",
                        "uuid": "ab34693c-9e02-556f-34aa-3467d67c88ec",
                        "weight": 10
                    },
                    {
                        "type": "group",
                        "id": 2
                    }
                ]
            },
            {
                "type": "folder",
                "name": "folder2",
                "weight": -60,
                "items": [
                ]
            }
        ]
    }
}

See attributes description of folders for more information.

Response example
HTTP/1.1 200 OK
Content-Type: application/json
{
    "folder": {
        "uuid": "8b6aa627-e455-aabf-4573-865101745dfc",
        "name": "Sélection 3",
        "detailUrl": "/api/v1.2/folders/8b6aa627-e455-aabf-4573-865101745dfc"
    }
}

Modify order of several folders

Requires Admin profile.

PATCH /api/v1.2/folders
Parameters
Name Description
folders Table of uuid / weight pairs to be modified.
Request example
PATCH /api/v1.2/folders
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "folders" : [
        {
            "uuid": "d8590675-ade4-4fa2-9b8f-b9a64ead479d",
            "weight": 12
        },
        {
            "uuid": "add3e16f-bf23-438e-ac0b-b216277918e7",
            "weight": -3
        }
    ]
}
Response example
HTTP/1.1 204 NO CONTENT
Content-Type: application/json

Deleting a folder

Requires Admin profile.

DELETE /api/v1.2/folders/:uuid
Parameters

None

Request example
DELETE /api/v1.2/folders/8b6aa627-e455-aabf-4573-865101745dfc
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 204 NO CONTENT
Content-Type: text/html

Description of attributes and properties of folders

Folder attributes
Name Type Description Adding Modifying
uuid uuid Folder Camtrace ID No No
name text Folder name Obligatoire Optional
regexId integer Associated sort criterion ID Optional Optional
regex object Associated sort criterion parameters No No
items array List of folder elements Mandatory * Optional

* Mandatory attribute but may be empty.

Element types

These are the different types of elements contained in the items array of the folder

Name Description
folder Represents a sub-selection of the selection. Sub-selections can be nested in several levels.
camera Represents a camera declared on the CT-server (or hierarchical)
group Represents a mosaic declared on the CT-server
map Represents a map declared on the CT-server
screen Represents a passive screen declared on the CT-server
device Represents a metadata connector
Element attributes

List of attributes associated with items in a folder

Name Type Description Element Presence
type text Type d’élément All Mandatory
serverId integer Server ID where the element is located camera, group, map, screen, device Optional
name text Element name folder Mandatory
id integer Element ID camera, group, screen Mandatory
uuid uuid Element uniq ID map, device Mandatory
weight integer Element relative weight All Optional
items array List of elements contained in the element folder Mandatory *

* Mandatory attribute but may be empty.

Sort criteria

All requests concerning sort criteria must be made with a user name and password. (see part Authentication). The user must have a profile with the specific Admin level to create, modify or delete sort criteria.

Listing sort criteria

GET /api/v1.2/regex
Parameters

None

Response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "regex": [
        {
            "id": 1,
            "name": "Critères 1",
            "default": false,
            "params": {
                "value": "([-]*)-([^-]*)-([^-]*)-([^_]*)_([^_]*)_([^ ]*) ([^_]*)",
                "group": [6,7]
            }
        },
        {
            "id": 2,
            "name": "Critères 2",
            "default": true,
            "params": {
                "value": "([-]*)-([^-]*)-([^-]*)-([^_]*)_([^_]*)_([^ ]*) ([^_]*)",
                "group": [2,1]
            }
        }
    ]
}

See attributes description of sort crtieria for more information.

Creating a sort criteria

Requires Admin profile.

POST /api/v1.2/regex
Parameters
Name Description
regex Definition of the sort criteria
Request example
POST /api/v1.2/regex
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "regex" : {
        "name": "Critères 3",
        "params": {
            "value": "([-]*)-([^-]*)-([^-]*)-([^_]*)_([^_]*)_([^ ]*) ([^_]*)",
            "group": [3,4]
        }
    }
}

See attributes description of sort crtieria for more information.

Response example
HTTP/1.1 201 CREATED
Content-Type: application/json
{
    "regex": {
        "id": 3,
        "name": "Critères 3",
        "default": false,
        "params": {
            "value": "([-]*)-([^-]*)-([^-]*)-([^_]*)_([^_]*)_([^ ]*) ([^_]*)",
            "group": [3,4]
        }
    }
}

Modifying a sort criteria

Requires Admin profile.

PUT /api/v1.2/regex/:id
Parameters
Name Description
regex Definition of the sort criteria. The content of the previous params field is completely replaced by the new one.
Request example
PUT /api/v1.2/regex/3
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "regex" : {
        "params": {
            "value": "([-]*)-([^-]*)-([^-]*)-([^_]*)_([^_]*)_([^ ]*) ([^_]*)",
            "group": [3,5]
        }
    }
}

See attributes description of sort crtieria for more information.

Response example
HTTP/1.1 200 OK
Content-Type: application/json
{
    "regex": {
        "id": 3,
        "name": "Critères 3",
        "default": false,
        "params": {
            "value": "([-]*)-([^-]*)-([^-]*)-([^_]*)_([^_]*)_([^ ]*) ([^_]*)",
            "group": [3,5]
        }
    }
}

Deleting a sort criteria

Requires Admin profile.

DELETE /api/v1.2/regex/:id
Parameters

None

Request example
DELETE /api/v1.2/regex/3
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 204 NO CONTENT
Content-Type: text/html

Description of attributes and properties of sort criteria

Sort criteria properties
Name Type Description Adding Updating
id integer Sort criteria ID No No
name text Sort criteria name Mandatory Optional
default boolean server default sorting (uniq) Optional (false by default) Optional
params object List of sorting parameters Mandatory Optional
Element attributes

List of the various attributes making up the sort items.

Name Type Description Presence
value text Regular expression consisting of one or more groups defining sort criteria Mandatory
group array Ordered list of indexes for the various `value’ groups to be taken into account for the search Mandatory

Metadata events

All requests for metadata events must be made with a user name and password (see part Authentication).

Inserting a metadata event

Inserting a metadata event for an API connector declared on the CT-Server requires the Insert metadata profile right for the corresponding connector. Only events “recognized” by the CamTrace server can be created.

POST /api/v1.2/devices/:uuid/events
Parameters
Name Description
event Event information
Request example
POST /api/v1.2/devices/3000efd7-62b3-4a6e-ac05-a76f0d831a56/events
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "event" : {
        "eventId": "53163f64-0994-4c10-b1ad-44d3c6ff1334",
        "type": "accesscontrol.idpointactivity",
        "description": {"params": {"idPointName": "pt1"}},
        "timestamp": "2022-07-25T16:26:36.903Z"
    }
}

See attributes description of a metadata event for more information.

Response example
HTTP/1.1 201 CREATED
Content-Type: application/json
{
    "event": {
        "eventId": "53163f64-0994-4c10-b1ad-44d3c6ff1334",
        "type": "accesscontrol.idpointactivity",
        "timestamp": "2022-07-25T16:26:36.903Z"
    }
}

Attributes and properties description of a metadata event

Event attributes
Name Type Description
eventId UUID v4 Unique event ID generated by the client (v4 UUID only accepted)
type text Event type
description json specific parameters relative to the event
timestamp date GMT date of event in ISO-8601 format
Recognized event types and their parameters
Type Accepted parameters (params attribute of the event description)
accesscontrol.idpointactivity idPointName
accesscontrol.idpointrequest idPointName
accesscontrol.doormode
accesscontrol.doorphysicalstate
accesscontrol.dooralarm
accesscontrol.accessgranted userName, doorName
accesscontrol.accessdenied userName, doorName
accesscontrol.accessunknown
accesscontrol.accesstaken userName, doorName
accesscontrol.accessnottaken userName, doorName
analytics.motion source, window, state
analytics.presence state
analytics.stationary
analytics.linecross objectId
analytics.multiplelinecross
analytics.scenechange state
analytics.intrusion window, state
analytics.missing
analytics.face state
analytics.counting
analytics.crowd window, state
analytics.running window, state
analytics.videoloss state
analytics.videodefocus state
device.casingopen
device.tamper state
device.networkattack
device.networkconflict state
device.recordingsavailable
device.sdcardmounted state
device.sdcarderror state
lpr.vehicle plate
lpr.whitelist plate
lpr.blacklist plate
io.input id, state
detect.sound state
detect.temperature state
detect.fire state
misc.unknown
misc.illegalaccess
misc.autotracking state

misc.quarantine

Event parameters typing
Parameter Type
idPointName text
userName text
doorName text
source text
window integer
state boolean

Searching for metadata events requires the Metadata consult profile right for the corresponding connector. Each connector has its own search criteria, which must be retrieved beforehand. See part retrieving search criteria of a metadata connector for more information.

POST /api/v1.2/devices/:uuid/proxy/events/search
Parameters
Nom Description
criteria Table of event search criterion

See description of a search criterion for more information.

Request example
POST /api/v1.2/devices/3000efd7-62b3-4a6e-ac05-a76f0d831a56/proxy/events/search
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "criteria" : [
    {
        "name": "type",
        "value": "analytics.motion"
    },
    {
        "name": "analytics.source",
        "value": "internal",
        "comparator": "!="
    }
  ]
}
Response exemple
HTTP/1.1 200 OK
Content-Type: application/json
{
    "events": [
        {
            "id": "b73319ac-2a47-496e-8472-0b40e98c4d0e",
            "sourceId": "dcf9a40e-fbaf-4f3e-accd-165f7c32b817",
            "timestamp": "2024-02-14T12:17:25.669458Z",
            "type": "analytics.motion",
            "description": {
                "params": {
                    "cameraId": "7",
                    "cameraName": "DVR_30_1"
                },
                "onvifParams": {
                    "topic": "VMD",
                    "sourceParams": {
                        "Source": "1"
                    }
                }
            },
            "label": "Motion detection from ? in window ? state ?"
        },
        {
            "id": "cfd4fe8b-4069-4562-acc9-d28cf2453a35",
            "sourceId": "dcf9a40e-fbaf-4f3e-accd-165f7c32b817",
            "timestamp": "2024-02-14T12:17:26.779275Z",
            "type": "analytics.motion",
            "description": {
                "params": {
                    "cameraId": "7",
                    "cameraName": "DVR_30_1"
                },
                "onvifParams": {
                    "topic": "VMD",
                    "sourceParams": {
                        "Source": "1"
                    }
                }
            },
            "label": "Motion detection from ? in window ? state ?"
        }
    ]
}

Retrieving search criteria from a metadata connector

Retrieval of metadata event search criteria requires the Metadata consult profile right for the corresponding connector.

GET /api/v1.2/devices/:uuid/proxy/events/search/criteria
Parameters

None

Response exemple
HTTP/1.1 200 OK
Content-Type: application/json
{
    "criteria": [
       {
            "name": "cameraName",
            "description": "Camera (text)",
            "format": "string"
        },
        {
            "name": "type",
            "description": "Event type",
            "format": "enum",
            "values": [
                "analytics.stationary",
                "analytics.counting",
                "analytics.crowd",
                "analytics.face",
                "analytics.intrusion",
                "analytics.linecross",
                "analytics.missing",
                "analytics.motion",
                "analytics.multiplelinecross",
                "analytics.presence",
                "analytics.running",
                "analytics.scenechange",
                "analytics.videodefocus",
                "analytics.videoloss"
            ],
            "texts": [
                "Abandoned object",
                "Counting",
                "Crowd",
                "Face",
                "Intrusion",
                "Line cross",
                "Missing",
                "Motion detection",
                "Multiple line cross",
                "Presence",
                "Running",
                "Scene change",
                "Video focus loss",
                "Video loss"
            ]
        },
        {
            "name": "analytics.source",
            "description": "Source",
            "format": "enum",
            "values": [
                "camera",
                "internal"
            ],
            "texts": [
                "Camera",
                "Internal"
            ]
        }
    ]
}
Description of search criterion attributes

Each criterion in the criteria table of a metadata event search must be defined as shown below.

Name type Description Mandatory
name string Name of the criterion as returned by the search criteria retrieval request Yes
value combined Criterion value of expected type Yes
comparator string Comparator to use. See table below for possible values. No (default value is “=”).

The possible values for comparator vary according to the type of criterion.

Type Possible values
string =, !=, like, ilike
integer <, >, <=, >=, =, !=
datetime <, >, <=, >=
boolean =, !=
enum =, !=

Monitoring

All monitoring requests must be made with a user name and password (see part Authentication). The user must have a profile with the specific Admin or Monitor level.

License information

Returns information about the current license of the CT-Server.

GET /api/v1.2/license
Parameters

None

Request example
GET /api/v1.2/license
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
{
    "license": {
        "active_modules": [
            "interface_cluster",
            "local_video_relay",
            "maps",
            "messages",
            "metadata",
            "record",
            "scenarios",
            "tags",
            "video_relay"
        ],
        "build": 20210531,
        "current_metadata_sources": 1,
        "current_video_sources": 9,
        "hardware_id": "B6CE4BD4",
        "license_creation_date": "20210210",
        "license_valid": true,
        "licensed_to": "CAMTRACE TEST",
        "max_metadata_sources": 30,
        "max_screens": 30,
        "max_space_usage": 100,
        "max_video_sources": 30,
        "postal_code": "92100",
        "serial_number": "1117",
        "upgrade_expiration_date": "20220225",
        "uuid": "aa0cd092-555f-4b83-8f73-386dbc6eebb7",
        "version": "8.15.2.0"
    }
}

Updating license

Requires Admin profile.

POST /api/v1.2/license

Parameters

Name Description
license License file content
Request example
POST /api/v1.2/license
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
{
  "license" : "license_file_content"
}
Response example
HTTP/1.1 201 CREATED
Content-Type: application/json

System information

Retrieve server hardware information.

GET /api/v1.2/sysinfo
Parameters

None

Request example
GET /api/v1.2/sysinfo
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
{
    "CPU": [
        "Intel(R) Pentium(R) Gold G5400 CPU @ 3.70GHz"
    ],
    "Memory": [
        "3,9G"
    ],
    "Network": [
        "I211 Gigabit Network Connection (enp1s0)",
        "I211 Gigabit Network Connection (enp2s0)"
    ],
    "Controller": [
        "Cannon Lake PCH SATA AHCI Controller"
    ],
    "Disk": [
        "WDC WD20EFRX-68EUZN0 (sda)",
        "FORESEE 128GB SSD (sdb)"
    ],
    "Partition": [
        "1863GiB WDC WD20EFRX-68E (/dev/sda)",
        "93MiB Windows FAT volume (/dev/sdb1)",
        "477MiB EXT4 volume (/dev/sdb2)",
        "14GiB EXT4 volume (/dev/sdb3)",
        "14GiB EXT4 volume (/dev/sdb4)",
        "14GiB EXT4 volume (/dev/sdb5)",
        "3814MiB Linux swap volume (/dev/sdb6)",
        "70GiB EXT4 volume (/dev/sdb7)"
    ]
}

Server health

The server health status consists of 3 different sections: recorder which monitors the video service and database, cameras which monitors the status of cameras and video recording on disk, and hardware which monitors the status of the CT-Server hardware.

GET /ap1/v1.2/health
Parameters

None

Response example
HTTP/1.1 200 OK
Content-Length: 126
Content-Type: application/json
{
  "health":
      {
          "recorder": false,
          "cameras": false,
          "hardware": true,
          "errorDetails":
              {
                  "recorder": [
                      "Video service is inactive"
                  ],
                  "cameras": [
                      {
                        "id": 1,
                        "name": "Camera 1",
                        "streamName": "HD stream",
                        "error": "No image"
                      }
                  ]
              }
      }
}
Response attributes
Name Type Description
recorder boolean Video service (scamd) and database statuses
cameras boolean Camera and disk recording status
hardware boolean Server hardware status, including SMART report
errorDetails array Details of any errors by section (recorder, cameras, hardware)

Logs

All requests concerning the consulation of log items must be made with a user name and password. (see part Authentication). The user must have the specific Admin profile.

User action log

Requires Admin profile.

GET /api/v1.2/users/actions
GET /api/v1.2/users/:id/actions
Parameters
Name Type Description
from text GMT start date in ISO-8601 format (see Wikipedia, ex: 2014-09-12T06:00:00Z).
to text End date GMT in ISO-8601 format (see Wikipedia, ex: 2014-09-12T06:00:00Z).
limit integer Number of results requested.
offset integer Position in result set after filters have been applied. Zero corresponds to the most recent actions.
Request example
POST /api/v1.2/users/1/actions?from=2021-07-17T09:38:53Z&to=2021-07-17T10:43:53Z
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
{
    "actions": [
        {
            "id": 927,
            "userId": 1,
            "userName": "admin",
            "dateTime": "2021-07-17T10:43:53Z",
            "ipAddress": "102.156.162.9",
            "action": "LogUserLogin",
            "description": "Identification de l'utilisateur."
        },
        {
            "id": 926,
            "userId": 1,
            "userName": "admin",
            "dateTime": "2021-07-17T10:02:06Z",
            "ipAddress": "102.156.162.9",
            "action": "LogUserLogin",
            "description": "Identification de l'utilisateur."
        },
        {
            "id": 925,
            "userId": 1,
            "userName": "admin",
            "dateTime": "2021-07-17T10:01:21Z",
            "ipAddress": "102.156.162.9",
            "action": "LogUserLogin",
            "description": "Identification de l'utilisateur."
        },
        {
            "id": 924,
            "userId": 1,
            "userName": "admin",
            "dateTime": "2021-07-17T09:39:24Z",
            "ipAddress": "102.156.162.9",
            "action": "LogUserLogin",
            "description": "Identification de l'utilisateur."
        }
    ],
    "paging": {
        "total": 4,
        "offset": 4,
        "limit": 0
    }
}

Camera connexions log

Requires Admin profile.

GET /api/v1.2/cameras/connections
GET /api/v1.2/cameras/:id/connections
Parameters
Name Type Description
id_cams list Camera ID list, separated by ,
connected boolean Camera state: connected (true) ou disconnected (false)
from text GMT start date in ISO-8601 format (see Wikipedia, ex: 2014-09-12T06:00:00Z).
to text End date GMT in ISO-8601 format (see Wikipedia, ex: 2014-09-12T06:00:00Z).
limit integer Number of results requested.
offset integer Position in result set after filters have been applied. Zero corresponds to the most recent connexions.
Request example
POST /api/v1.2/cameras/2/connections?limit=4
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
{
    "connections": [
        {
            "id": 207,
            "cameraId": 2,
            "cameraName": "CCDM8EF01_24",
            "streamId": 4,
            "streamName": "MsMediaProfile1",
            "dateTime": "2021-07-13T09:41:08Z",
            "connected": true
        },
        {
            "id": 208,
            "cameraId": 2,
            "cameraName": "CCDM8EF01_24",
            "streamId": 6,
            "streamName": "MsMediaProfile3",
            "dateTime": "2021-07-13T09:41:08Z",
            "connected": true
        },
        {
            "id": 209,
            "cameraId": 2,
            "cameraName": "CCDM8EF01_24",
            "streamId": 5,
            "streamName": "MsMediaProfile2",
            "dateTime": "2021-07-13T09:41:08Z",
            "connected": true
        },
        {
            "id": 194,
            "cameraId": 2,
            "cameraName": "CCDM8EF01_24",
            "streamId": 4,
            "streamName": "MsMediaProfile1",
            "dateTime": "2021-07-12T16:10:08Z",
            "connected": true
        }
    ],
    "paging": {
        "total": 41,
        "offset": 4,
        "limit": 4
    }
}

System log

Requires Admin profile.

GET /api/v1.2/system/logs
Parameters
Name Type Description
all boolean Also send information logs.
search text Search search in logs.
negative boolean search must not be present in the logs.
noCase boolean Ne pas tenir compte de la casse pour search.
regex boolean search is case insensitive.
Request example
POST /api/v1.2/system/logs?limit=4
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
{
    "systemLogs": [
        {
            "dateTime": "2021-07-26T17:47:30+02:00",
            "name": "Connect@Connection.cpp",
            "type": "WARNING",
            "event": "connect() to 8383838:4000: Invalid argument [22]"
        },
        {
            "dateTime": "2021-07-26T17:47:12+02:00",
            "name": "SetStatus@SourceStream.cpp",
            "type": null,
            "event": "[4.11] stream status : connected and received frames"
        },
        {
            "dateTime": "2021-07-26T17:47:11+02:00",
            "name": "CheckTimeout@SourceStream.cpp",
            "type": null,
            "event": "[4.11] WARNING: no frame received for 10 seconds"
        },
        ...
    ],
    "paging": {
        "total": 2102,
        "offset": 20,
        "limit": 20
    }
}

Tasks

All tasks requests must be made with a user name and password. (see part Authentication). The user must have the specific Admin profile.

Listing of tasks

The task list shows which server tasks are running, have been completed or are pending.

GET /ap1/v1.2/tasks
Parameters
Name Description Remark
type Type of the task Optional. Possible values: ‘concat’, ‘postindex’, ‘purgecam’, ‘repaircam’,‘sum’,‘kill’
status Status of the task Optional. Possible values: ‘new’, ‘running’, ‘aborted’, ‘killed’, ‘done’
Request example
GET /api/v1.2/tasks?type=concat
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 200 OK
Content-Length: 2423
Content-Type: application/json
{
    "tasks": [
        {
            "id": 26,
            "type": "concat",
            "status": "done",
            "updated": "2021-10-01T14:18:15Z",
            "progress": "100%",
            "userId": 1,
            "userName": "Admin"
        },
        {
            "id": 25,
            "type": "concat",
            "status": "done",
            "updated": "2021-09-29T16:36:35Z",
            "progress": "100%",
            "userId": 12,
            "userName": "norbert_t"
        },
        {
            "id": 24,
            "type": "concat",
            "status": "done",
            "updated": "2021-09-29T16:36:27Z",
            "progress": "100%",
            "userId": 1,
            "userName": "Admin"
        },
        ...

Retrieve a task

When you retrieve a task, you obtain its information by providing the task identifier.

GET /api/v1.2/tasks/:id
Request example
GET /api/v1.2/tasks/26
Authorization: Basic YWRtaW46Y2FtdHJhY2U=
Content-Type: application/json
Response example
HTTP/1.1 200 OK
Content-Length: 2423
Content-Type: application/json
{
    "id": 26,
    "type": "concat",
    "status": "done",
    "updated": "2021-10-01T14:18:15Z",
    "progress": "100%",
    "userId": 1,
    "userName": "Admin"
}
Camtrace SAS - All rights reserved