Skip to content

HTTP API

Connecting to the server

Operations to interact with the Sagitech VMS server are performed with the HTTP API. The module responsible for HTTP connections (HTTP server) is enabled by default, accepting connections on port 11012. You can change its settings by using the Server Configuration Wizard.

General parameters

For all commands to interact with the server authentication is required. The commands support authorization with URL, or Basic Auth. For example, for the command "/rsapi / cameras” (load camera list), the following options are possible:

URL authorization with password. The user and password parameters are added to the connection string, and the password is not encrypted.

http://localhost:11012/rsapi/cameras?user=admin&password=123

URL authorization with password encrypted by MD5 algorithm. The userand MD5 password hash are added to the connection string. Note that the hash uses Unicode, not ASCII.

http://localhost:11012/rsapi/cameras?user=admin&password=1e00d0a88c54404910d7b21397c59b39

You can get the password hash using the utility RSInstall.exe included in the delivery package:

"C:\Program Files\Sagitech VMS\RSInstall.exe" -hashpassword test

Basic Auth. It is performed in the usual way for HTTP using the "Authorization" field of the HTTP request.

GET /rsapi/cameras/ HTTP/1.1
Authorization: Basic aHR0cHdhdGNoOmY=

For all commands, the "rand" parameter can be used to avoid caching by the browser.

http://localhost:11012/rsapi/cameras?user=admin&password=123&rand=12343

For all commands that use a unique camera ID in the system, it is possible to replace the ID with the order number of the camera in the configuration.

http://localhost:11012/rsapi/mjpeg?id=1

Verification of authorization

Command:

/rsapi/auth

Description:

Allows you to check whether the username and password are correct. If authorization was successful, HTTP 200 OK is returned, if not, 401 Unauthorized.

Request example

GET http://localhost:11012/auth

Getting list of cameras

Command:

/rsapi/cameras

Description:

The command allows you to download the list of cameras from the server in XML format.

Request example

GET http://localhost:11012/rsapi/cameras

Example of a server response (configuration of two cameras):

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Cameras>
    <Camera>
        <ID>6b658ca5-f23b-40fa-a898-4415ba93ac13</ID>
        <Name>Beward B1062xx</Name>
        <Description></Description>
        <Disabled>false</Disabled>
        <ModelName>Beward B1062xx</ModelName>
        <ReceiveAudio>true</ReceiveAudio>
        <SecondSourceEnabled>true</SecondSourceEnabled>
        <PtzMoveEnabled>false</PtzMoveEnabled>
        <PtzZoomEnabled>false</PtzZoomEnabled>
        <ArchiveStart>2013-07-11T10:06:46.17</ArchiveStart>
        <ArchiveEnd>2013-07-12T17:02:44.737</ArchiveEnd>
    </Camera>
    <Camera>
        <ID>34690399-9a7a-4c1f-99ea-097498a84c0d</ID>
        <Name>Beward BD4330RVZH</Name>
        <Description></Description>
        <Disabled>false</Disabled>
        <ModelName>Beward BD4330xx</ModelName>
        <ReceiveAudio>false</ReceiveAudio>
        <SecondSourceEnabled>false</SecondSourceEnabled>
        <PtzMoveEnabled>false</PtzMoveEnabled>
        <PtzZoomEnabled>true</PtzZoomEnabled>
        <ArchiveStart>2013-07-11T04:22:08.277</ArchiveStart>
        <ArchiveEnd>2013-07-11T11:40:59.117</ArchiveEnd>
    </Camera>
</Cameras>

Comments:

  • ID – unique identifier of the camera in the system.

  • Name – camera’s name.

  • Description – camera’s description.

  • Disabled – flag, that determines whether the camera is disabled on the server or not.

  • ModelName – model’s name.

  • SecondSourceEnabled – flag is “true” if camera has 2 sources.

  • PtzMoveEnabled – flag is “true” if camera's driver supports PTZ managing.

  • PtzZoomEnabled – flag is “true” if camera’s driver supports PTZ optical zoom.

  • ArchiveStart – date and time when the camera started recording.

  • ArchiveEnd – date and time when the camera ended recording.

Getting a list of unavailable camera IDs

Command:

/rsapi/unavailablecameraids

Description:

Returns the list of camera IDs that are currently unavailable (it is not possible to get at least one video or audio stream).

Request example

GET http://localhost:11012/rsapi/unavailablecameraids

Response example:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<CameraIDs>
    <CameraID>6c640962-7e41-49b7-9d40-09433eec6057</CameraID>
    <CameraID>b4319e50-b99b-4057-b098-4e651179ef9c</CameraID>
</CameraIDs>

Getting camera state

Command:

/rsapi/camerastate?id=[CameraID]

Description:

Returns camera status. The ‘State’ field can be one of the following values: Disabled (camera is disabled), Error (connection error), RecordingIsOff (recording is disabled), Writing (recording is in process), NotWriting (recording is not active).

Request example

GET http://localhost:11012/rsapi/camerastate?id=a3300d2c-4771-4fcc-b31d-fe0085fc4712

Response example:

<CameraStateInfo>
    <ID>a3300d2c-4771-4fcc-b31d-fe0085fc4712</ID>
    <Name>FR-Camera</Name>
    <FullGroupName>GroupN2</FullGroupName>
    <State>Writing</State>
</CameraStateInfo>

User web interface configuration access

Command:

/rsapi/configuration/userwebconfig

Description:

Provides access to user’s web interface configuration with REST API. GET command returns saved configuration, POST or PUT command saves configuration, DELETE command removes saved configuration.

Request example

GET http://localhost:11012/rsapi/configuration/userwebconfig

Response example:

<Configuration>
    <Settings>
        <SelectedProfileID>00000000-0000-0000-0000-000000000000</SelectedProfileID>
    </Settings>
    <ViewProfiles/>
</Configuration>

Start recording

Command:

/rsapi/startrecord?id=[CameraID]&length=[timeduration]

Description:

Enables data recording from the specified camera for the requested number of seconds.

Request example

GET http://localhost:11012/rsapi/startrecord?id=7f019a68-c364-430e-9934-7dc458e98066&length=3600

Parameters:

  • id – unique id of the camera in the system.

  • length – required recording duration in seconds. Available values: from 10 to 86400.

Stop recording

Command:

/rsapi/stoprecord?id=[CameraID]

Description:

Stops a record started by a command or operator. This would not stop a recording process started by the detector and would not work in constant recording mode.

Request example

GET http://localhost:11012/rsapi/stoprecord?id=7f019a68-c364-430e-9934-7dc458e98066

Parameters:

  • id – unique id of the camera in the system.

Getting the current frame

Command:

/rsapi/snapshot?id=[CameraId]{&viewSize=[width]x[height]}

Description:

Getting a single current frame from the camera in JPEG format.

Request example

GET http://localhost:11012/rsapi/snapshot?id=7f019a68-c364-430e-9934-7dc458e98066&viewSize=320x240

Parameters:

  • id – unique id of the camera in the system.

  • viewSize – an optional parameter that allows to resize the frame to the size of the specified viewport. Since the frame is compressed with a factor that is a multiple of 2, the adjustment does not occur to the exact size of the area. If this parameter is omitted, the command returns the frame in its original resolution.

Getting the video in original format

Command:

/rsapi/stream?id=[CameraID]&framerate=[fps]&streamIndex=[StreamID]

Description:

In response to this request, the server starts sending the video over HTTP in the format in which the camera sends it. The format is specified in the header of each frame in the Content-Type field. One of four values is possible. For H.264, H.265 and mpeg4, the frame type is also specified:

  • Content-Type: image/jpeg

  • Content-Type: rsvid/h264; frametype=I

  • Content-Type: rsvid/h265; frametype=I

  • Content-Type: rsvid/mpeg4; frametype=I

Request example

GET http://localhost:11012/rsapi/stream?id=7f019a68-c364-430e-9934-7dc458e98066&framerate=10

Parameters:

  • id –unique id of the camera in the system.

  • framerate – frames per second.

  • streamIndex – stream index (0 – main, 1 – sub).

Getting the video in MJPEG format

Command:

/rsapi/mjpeg?id=[CameraID]&framerate=[fps]{&viewSize=[width]x[height]}

Description:

In response to this request, the server starts sending the video in the MJPEG format. If the camera returns the video in a different format then the server reencodes the video.

Request example

GET http://localhost:11012/rsapi/mjpeg?id=7f019a68-c364-430e-9934-7dc458e98066&framerate=10&viewSize=320x240

Parameters:

  • id – unique id of the camera in the system.

  • framerate – frames per second.

  • viewSize – an optional parameter indicates the need to adjust the frame size to the size of the specified viewport. Since the frame is compressed with a factor that is a multiple of 2, the adjustment does not occur to the exact size of the area. If this parameter is omitted, the command returns the frame in its original resolution.

Getting the video in MPEG-TS format

Command:

/rsapi/mpeg-ts/stream.m3u8?id=[CameraID]&streamIndex=[StreamID]

Description:

In response to this request, the server starts sending the video over HTTP in MPEG-TS format. This feature is only available if the camera encodes the video stream in H.264.

Request example

GET http://localhost:11012/rsapi/mpeg-ts/stream.m3u8?id=7f019a68-c364-430e-9934-7dc458e98066

Parameters:

  • id – unique id of the camera in the system.

  • streamIndex – stream index. Available values: 0 – main, 1 – sub.

Getting the audio in PCM or AAC format

Command:

/rsapi/audio?id=[CameraID]&format=[AudioFormat]

Description:

In response to this request, the server starts sending audio over HTTP in the specified format. The format and parameters of the audio frame are specified in the header of each frame in the Content-Type field:

Content-Type: PCM; sampleFrequency=8000; bitsPerSample=16; numberOfChannels=1; specificParam=0

Request example

GET http://localhost:11012/rsapi/audio?id=7f019a68-c364-430e-9934-7dc458e98066&format=PCM

Parameters:

  • id – unique id of the camera in the system.

  • format – audio format. Available values: PCM, AAC.

PTZ control

Command:

/rsapi/ptzcontrol?id=[CameraID]&action=[Action]{&presetNum=[PresetNumber]}

Description:

Control of the rotary module and the optical zoom of the camera.

Request example

GET http://localhost:11012/rsapi/ptzcontrol?id=b7893da9-572e-4ca9-aaa0-abdeb09ea55d&action=left

Parameters:

  • id – unique id of the camera in the system.

  • action – PTZ action. Available values: Home, Right, RightUp, Up, LeftUp, Left, LeftDown, Down, RightDown, ZoomIn, ZoomOut, FocusIn, FocusOut, FocusAuto, IrisIn, IrisOut, IrisAuto, SetPreset, ClearPreset, CallPreset.

  • presetNum – preset number for the SetPreset, ClearPreset and CallPreset actions.

Event subscription

Command:

/rsapi/getalarm{?level=[Level]}

Description:

Receive alarm events and server notifications in real time as a text data stream. When a connection is established, the server will push events as they occur. No session duration limit.

Request example

GET http://localhost:11012/rsapi/getalarm?level=alarm

Response example:

HTTP/1.1 200 OK
Content-Type: multipart/x-mixed-replace;boundary=--myboundary
--myboundary
Content-Type: text/plain
Level=Alarm;Type=Sabotage;CameraID=df09b965-96bc-4604-9e34-32b071f282c4;EventID=221356db-ead7-4d07-b4be-297c29580a05;Time=2019-01-24T12:00:01
--myboundary
Content-Type: text/plain
--myboundary
Content-Type: text/plain
--myboundary
Content-Type: text/plain
Level=Notification;Type=LPR;CameraID=e84eac52-4f85-402c-9055-7a4b34360fa9;EventID=6fbaa45d-554f-4430-8486-bd5a92378a78;Time=2019-01-24T12:00:02;Plate=E436EP18
--myboundary
Content-Type: text/plain
.....

Parameters:

  • level – an optional parameter that allows you to specify the alarm level of the event. If not specified, information of all levels will be sent. Available values: alarm, notification, error.

Event polling

Command:

/rsapi/getcurrentevents?sessionid=[SessionID]

Description:

Receive alarm events and server notifications in real time as an XML data stream. The first request creates a session with the given identifier. Subsequent queries return events that have occurred since the last request.

Request example

GET http://localhost:11012/rsapi/getcurrentevents?sessionid={126C98F4-CE73-4825-B9FC-CAEF22AC146B}

Response example:

HTTP/1.1 200 OK
Content-Type: text/xml

<EventInfos>
    <EventInfo>
        <ID>6f87387e-3ea7-4bb2-b361-e3d786c157b9</ID>
        <Type>LPR</Type>
        <TypeDescription>License plate detected</TypeDescription>
        <Level>Notification</Level>
        <Time>2022-10-07T16:42:42.971</Time>
        <CameraID>a33f8200-1b78-4021-8387-8cb5a71e51c5</CameraID>
        <CameraName>LPR</CameraName>
        <ShortDescription>O913XO18</ShortDescription>
        <LongDescription>Plate: O913XO18 Direction: Top to down Passage:Undefined</LongDescription>
        <CsvDescription>Plate=O913XO18;Direction=TopDown;Passage=None</CsvDescription>
        <IsFrameAttached>false</IsFrameAttached>
        <Rect/>
    </EventInfo>
</EventInfos>

Parameters:

  • sessionId – session identifier.

It is used either to create a new session or to search for an already established session.

Event search

Command:

/rsapi/searchevents?timeFrom={[StartTime]}{&timeTo=[EndTime]}{&levels=[Levels]}{&cameraids=[CameraIDList}{&lastminutes=[Minutes]}

Description:

Load alarm events and server notifications from the archive in XML format.

Request example

GET http://localhost:11012/rsapi/searchevents?lastminutes=30&levels=1,0

Response example:

HTTP/1.1 200 OK
Content-Type: text/xml

<EventInfos>
    <EventInfo>
        <ID>6f87387e-3ea7-4bb2-b361-e3d786c157b9</ID>
        <Type>LPR</Type>
        <TypeDescription>License plate detected</TypeDescription>
        <Level>Notification</Level>
        <Time>2022-10-07T16:42:42.971</Time>
        <CameraID>a33f8200-1b78-4021-8387-8cb5a71e51c5</CameraID>
        <CameraName>LPR</CameraName>
        <ShortDescription>O913XO18</ShortDescription>
        <LongDescription>Plate: O913XO18 Direction: Top to down Passage:
        Undefined</LongDescription>
        <CsvDescription>Plate=O913XO18;Direction=TopDown;Passage=None</CsvDescription>
        <IsFrameAttached>false</IsFrameAttached>
        <Rect/>
    </EventInfo>
</EventInfos>

Parameters:

  • timeFrom – the beginning of the time interval for data loading. To not be specified if lastMinutes is set.

  • timeTo – the end of the time interval for data loading. To not be specified if lastMinutes is set.

  • levels – optional parameter. A list of event alarm levels separated by commas.

  • cameraIds – optional parameter. A list of camera identifiers separated by commas.

  • lastMinutes – alternative option for specifying the time interval (a number of minutes before now).

Getting a frame linked to event

Command:

/rsapi/ geteventsnapshot?eventid=[EventID]&eventtime=[EventTime]

Description:

Get a JPEG frame linked to the specified event.

Request example

GET http://localhost:11012/rsapi/geteventsnapshot?eventid=221356db-ead7-4d07-b4be-297c29580a05&eventtime=2019-01-24T12:00:01

Parameters:

  • eventid – unique event ID in the system.

  • eventtime – event time.

Note

Applicable only to events from license plate recognition and face recognition modules.

Event generation

Command:

/rsapi/raiseevent

Description:

Allows you to generate an alarm or notification on the server. The body of the request contains an EventInfo structure containing information about the event.

Request example

POST http://localhost:11012/rsapi/raiseevent

Request body:

Content-Type: text/xml

<EventInfo>
    <ID>6f87387e-3ea7-4bb2-b361-e3d786c157b9</ID>
    <Type>External</Type>
    <Level>Alarm</Level>
    <Time>2022-10-07T16:42:42.971</Time>
    <CameraID>a33f8200-1b78-4021-8387-8cb5a71e51c5</CameraID>
    <ExternalType>My event</ExternalType>
    <Description>Something has happened</Description>
    <FrameData>*[BASE64IMAGE]*</FrameData>
    <Rect/>
</EventInfo>

Response example:

HTTP/1.1 200 OK

Parameters:

  • ID – unique identifier of the event.

  • Type – event type. Only the value “External” is supported.

  • Level – alarm level (Notification/Alarm/Error).

  • Time – time.

  • CameraID – an unique identifier of the camera (can be empty if the event is not associated with a camera).

  • ExternalType – name of the event.

  • Description – advanced event description.

  • FrameData – attached Jpeg image in Base64 format (optional).

  • Rect – coordinates of the object found on the image (optional).

Archive: frame by frame playing in JPEG format

Session initialization

Command:

/rsapi/archive/start?id=[CameraID]&time=[Time]&direction=[DirectionOfPlay]

Description:

To start playing the archive, open the playback session using this command.

Request example

GET http://localhost:11012/rsapi/archive/start?id=b7893da9-572e-4ca9-aaa0-abdeb09ea55d&time=2013-01-24T12:00:01&direction=Forward

Response example:

sessionid=250a21a1-ec9c-49d3-a761-f3d50e1a635e

Parameters:

  • id – unique id of the camera in the system.

  • time – start time of playback in the format 2013-01-24T12:00:01, or 2013/01/24T12:00:01.

  • direction – direction of play. Available values: ‘Forward’ (default), ‘Backward’.

Note

If there is no access to the archive, the session closes automatically. Even if there is a pause, you need to download either the current image (speed=0) or the current time once a second.

Getting the current/next video frame

Command:

/rsapi/archive/snapshot?sessionid=[ARCHIVESESSIONID]&speed=[Speed]{&viewSize=[width]x[height]}

Description:

Get the current or next video frame in JPEG format.

Request example

GET http://localhost:11012/rsapi/archive/snapshot?sessionid=b7893da9-572e-4ca9-aaa0-abdeb09ea55d&viewSize=320x240

Parameters:

  • sessionid – id of the archive playback session.

  • speed – playback speed, from 0 to 64. If the speed is 0, the current frame will be returned. Default: 1.

  • viewSize – an optional parameter indicates the need to adjust the frame size to the size of the specified viewport. Since the frame is compressed with a factor that is a multiple of 2, the adjustment does not occur to the exact size of the area. If this parameter is omitted, the command returns the frame in its original resolution.

Getting the current time

Command:

/rsapi/archive/time?sessionid=[ARCHIVESESSIONID]

Description:

Get the current time for a given archive playback session.

Request example

GET http://localhost:11012/rsapi/archive/time?sessionid=b7893da9-572e-4ca9-aaa0-abdeb09ea55d

Parameters:

  • sessionid – id of the archive playback session.

Getting the current audio frames

Command:

/rsapi/archive/audio?sessionid=[ARCHIVESESSIONID]&format=[FORMAT]

Description:

Get a list of audio frames that are actual at the time of playing a given session. The format and parameters of the audio frames are specified in the header of each frame in the Content-Type field.

Request example

GET http://localhost:11012/rsapi/archive/audio?sessionid=b7893da9-572e-4ca9-aaa0-abdeb09ea55d?format=PCM

Parameters:

  • sessionid – id of the archive playback session.

  • format – audio format. Available values: PCM, AAC.

Session close

Command:

/rsapi/archive/stop?sessionid=[ARCHIVESESSIONID]

Description:

Close the archive playback session.

Request example

GET http://localhost:11012/rsapi/archive/stop?sessionid=b7893da9-572e-4ca9-aaa0-abdeb09ea55d

Parameters:

  • sessionid – id of the archive playback session.

Archive: original format streaming

Session initialization

Command:

/rsapi/archive/stream/init?id=[CameraID]&startTime=[StartTime]&stopTime=[StopTime]&direction=[PlayDirection]&speed=[Speed]{&audioFormat=[AudioFormat]}

Description:

Initializes an archive reading session without data transcoding. Server will response with the identifier of the session, which can be used to get the actual data or to pause or change the playback speed.

Server response example:

sessionid=250a21a1-ec9c-49d3-a761-f3d50e1a635e

Parameters:

  • id – unique id of the camera in the system.

  • startTime – start time of playback in the format ‘2013-01-24T12:00:01’, or ‘2013/01/24T12:00:01’.

  • stopTime – end time of playback in the format ‘2013-01-24T12:00:01’, or ‘2013/01/24T12:00:01’ (if not set, do not stop playback.). Instead of this parameter, an alternative parameter "duration" can be used, which determines the duration of the recording relative to startTime (example: duration=00:00:45).

  • direction – direction of play. Possible values: ‘Forward’ (default), ‘Backward’.

  • speed - the playback speed, from 0 to 64. Default: 1. If zero speed is specified, the video will be paused after the first frame is sent.

  • audioFormat - audio format. Available values: PCM, AAC. The audio will not be sent if the parameter is missing.

Getting a data stream

Command:

/rsapi/archive/stream/get?sessionid=[SessionID]

Description:

Starts video and audio streaming. The data is to be sent as a continuous sequence of not-transcoded frames. The frame format is specified in a separate header of each frame in the Content-Type field. One of the values ​​below is possible. Additional frame parameters are located after the semicolon and may vary depending on the encoding settings. The AAC profile number is returned in the specificParam variable.

Content-Type: image/jpeg

Content-Type: rsvid/h264; frametype=I

Content-Type: rsvid/h265; frametype=I

Content-Type: rsvid/mpeg4; frametype=I

Content-Type: PCM; sampleFrequency=44100; bitsPerSample=16;
numberOfChannels=1

Content-Type: AAC; bitrate=64000; sampleFrequency=32000;
numberOfChannels=1; specificParam=0;

When playback is paused or finished, the server will send a text packet describing the stream state (“State=Paused” or “State=StreamEnd”):

--myboundary

Content-Type: text/html

Content-Length: 12

State=Paused

Request example

GET http://localhost:11012/rsapi/archive/stream/get?sessionid=250a21a1-ec9c-49d3-a761-f3d50e1a635e

Parameters:

  • sessionid – unique session identifier.

Speed control

Command:

rsapi/archive/stream/update?sessionid=[SessionID]&speed=[Speed]

Description:

This allows you to change the speed of a stream requested via /rsapi/archive/stream/get. When using a zero value for the speed, the playback of the stream will be paused. To unpause, execute a request with a non-zero speed.

Request example

GET http://localhost:11012/rsapi/archive/stream/update?sessionid= 84e7fe06-b75d-4439-b988-744b9edd00b4&speed=2

Parameters:

  • sessionid – unique session identifier.

  • speed – the playback speed, from 0 (pause) to 64.

Session close

Command:

/rsapi/archive/stream/stop?sessionid=[SessionID]

Description:

This allows you to stop the stream requested via /rsapi/archive/stream/get.

Request example

GET http://localhost:11012/rsapi/archive/stream/stop?sessionid= 84e7fe06-b75d-4439-b988-744b9edd00b4

Parameters:

  • sessionid – unique session identifier.

Archive: getting the video stream in MJPEG format

Command:

/rsapi/archive/mjpeg?id=[CameraID]&startTime=[StartTime]&stopTime=[StopTime]&direction=[PlayDirection]&speed=[Speed]{&viewSize=[width]x[height]}{&audioFormat=[AudioFormat]}

Description:

Request an archive as a continuous sequence of JPEG frames.

Request example

GET http://localhost:11012/rsapi/archive/mjpeg?id=b7893da9-572e-4ca9-aaa0-abdeb09ea55d&startTime=2013-01-24T12:00:01&direction=Forward&speed=2&viewSize=320x240

Parameters:

  • id – unique id of the camera in the system.

  • startTime – start time of playback in the format ‘2013-01-24T12:00:01’, or ‘2013/01/24T12:00:01’.

  • stopTime – end time of playback in the format ‘2013-01-24T12:00:01’, or ‘2013/01/24T12:00:01’ (if not set, do not stop playback.). Instead of this parameter, an alternative parameter "duration" can be used, which determines the duration of the recording relative to startTime (example: duration=00:00:45).

  • direction – direction of play. Possible values: ‘Forward’ (default), ‘Backward’.

  • speed - the playback speed, from 0.20 to 64. Default: 1.

  • viewSize – an optional parameter indicates the need to adjust the frame size to the size of the specified viewport. Since the frame is compressed with a factor that is a multiple of 2, the adjustment does not occur to the exact size of the area. If this parameter is omitted, the command returns the frame in its original resolution.

  • audioFormat - audio format. Available values: PCM, AAC. The audio will not be sent if the parameter is missing.

Archive: getting a list of records for a date

Command:

/rsapi/archive/sequences?id=[CameraID]&date=[Date]

Description:

Get a list of video sequences (records) for the specified camera for the specified date.

Request example

GET http://localhost:11012/rsapi/archive/sequences?id=a5a3e771-d98a-4022-8799-6b150b699f7b&date=2017-09-21

Response example:

HTTP/1.1 200 OK
Content-Type: text/xml

<Sequences>
    <Sequence>
        <RecordStart>2017-09-20T18:48:43.277</RecordStart>
        <RecordEnd>2017-09-20T18:48:57.647</RecordEnd>
        <DiskID>809141b8-15b1-44eb-962b-12e7d6259f69</DiskID>
        <Reason>Motion</Reason>
        <IsFinished>true</IsFinished>
    </Sequence>
    <Sequence>
        <RecordStart>2017-09-20T18:49:01.603</RecordStart>
        <RecordEnd>2017-09-20T18:49:21.757</RecordEnd>
        <DiskID>809141b8-15b1-44eb-962b-12e7d6259f69</DiskID>
        <Reason>Motion</Reason>
        <IsFinished>true</IsFinished>
    </Sequence>

.....

</Sequences>

Parameters:

  • id – unique id of the camera in the system.

  • date – date in format 2013-01-24, or 2013/01/24.

Archive export

Initialization

Command:

/rsapi/archive/export/start

Description:

Launches an export of a section of the camera archive to an MP4 file. Returns the export session ID in response.

Request example

http://localhost:11012/rsapi/archive/export/start?id=04d1a4b0-c6af-40c4-adb8-28f59af19411&startTime=2022-05-27T15:00:00&endTime=2022-05-27T15:10:00

Response example:

sessionId=04d1a4b0-c6af-40c4-adb8-28f59af19411

Parameters:

  • id – unique id of the camera in the system.

  • startTime – period start time and date.

  • endTime – period end time and date.

Check state

Command:

/rsapi/archive/export/status

Description:

Returns: export state (possible values are: NotFound, Exporting, Error, Canceled, Success), percent of progress and error status (if applicable).

Request example

http://localhost:11012/rsapi/archive/export/status?sessionId=c15b8ec2-ea1f-422b-a1ea-dd7dab810de7

Response example:

status=Exporting; percent=50

Parameters:

  • sessionId – identifier of the export session.

Download file

Command:

/rsapi/archive/export/download

Description:

Downloads exported file contents.

Request example

http://localhost:11012/rsapi/archive/export/download?sessionId=c15b8ec2-ea1f-422b-a1ea-dd7dab810de7

Parameters:

  • sessionId – identifier of the export session.

Cancel

Command:

/rsapi/archive/export/cancel

Description:

Allows to cancel an incomplete export.

Request example

http://localhost:11012/rsapi/archive/export/cancel?sessionId=c15b8ec2-ea1f-422b-a1ea-dd7dab810de7

Parameters:

  • sessionId – identifier of the export session.

Getting a single frame from archive

Command:

/rsapi/archive/exportsnapshot?id=[CameraId]&time=[Time]{&viewSize=[width]x[height]}

Description:

Getting a single current frame from the camera in JPEG format.

Request example

GET http://localhost:11012/rsapi/archive/exportsnapshot?id=7f019a68-c364-430e-9934-7dc458e98066&time=2024-04-06T10:00&viewSize=320x240

Parameters:

  • id – unique id of the camera in the system.

  • time – needed archive time.

  • viewSize – an optional parameter that allows to resize the frame to the size of the specified viewport. Since the frame is compressed with a factor that is a multiple of 2, the adjustment does not occur to the exact size of the area. If this parameter is omitted, the command returns the frame in its original resolution.

Getting current user rights

Command:

/rsapi/configuration/users/roles/select

Description:

Returns current user rights in XML format.

Request example

http://localhost:11012/rsapi/configuration/users/roles/select

Response example:

<SecurityRoles>
    <SecurityRole>
        <ID>2435f711-e430-4b1f-8d32-a05936524588</ID>
        <Name>Administration</Name>
    </SecurityRole>
    …
    <SecurityRole>
        <ID>70343d0b-6079-4c77-bc45-6902422bc18a</ID>
        <Name>WebArchiveExport</Name>
    </SecurityRole>
</SecurityRoles>

Getting a list of cameras

Command:

/rsapi/configuration/cameras

Description:

Returns an XML document with a list of cameras.

Request example

http://localhost:11012/rsapi/configuration/cameras

Response example:

<Cameras>
    <Camera>
        <ID>9436d3e1-0410-4cc1-8383-c88099a9d3f7</ID>
        <Name>AXIS 211 - 00408C93666B - 192.168.1.87</Name>
        <Description/>
        <Address>192.168.1.87</Address>
        <Port>80</Port>
        <RtspPort>554</RtspPort>
        <RtspUseUdp>false</RtspUseUdp>
        <User>root</User>
        <Password>admin</Password>
        <CameraNumber>0</CameraNumber>
        <ModelID>ef740a24-2f84-4f49-b481-009693b66514</ModelID>
        <RecProfileID>b9884849-dfab-44fa-94d8-c42d68b70365</RecProfileID>
        <ReceiveAudio>true</ReceiveAudio>
        <Disabled>true</Disabled>
        <UseIntelDecoder>false</UseIntelDecoder>
        <ClientUseDXVA>false</ClientUseDXVA>
        <ExternalAudioUrl>dshow://2</ExternalAudioUrl>
        <ArchiveMinStorageHours>0</ArchiveMinStorageHours>
        <ArchiveMaxStorageHours>0</ArchiveMaxStorageHours>
        <BaseSource>
            <Resolution/>
            <Compression>Default</Compression>
            <Fps>0</Fps>
            <Protocol>Rtsp</Protocol>
            <UrlParams/>
        </BaseSource>
        <SecoundSource/>
    </Camera>
</Cameras>

Getting a list of display profiles

Command:

/rsapi/configuration/viewprofiles

Description:

Returns an XML document with a list of display profiles (layouts) of the authorized user.

Request example

GET http://localhost:11012/rsapi/configuration/viewprofiles

Response example:

<ViewProfiles>
    <ViewProfile>
        <ID>ea7b4be3-25ff-4ca3-aff2-473020066baa</ID>
        <Name>Profile 1 (1 x 1)</Name>
        <RowCount>1</RowCount>
        <ColumnCount>1</ColumnCount>
        <Cells>
            <Cell>
                <ColSpan>1</ColSpan>
                <RowSpan>1</RowSpan>
                <CameraID>00000000-0000-0000-0000-000000000000</CameraID>
                <SourceSwitchWidth>640</SourceSwitchWidth>
            </Cell>
        </Cells>
    </ViewProfile>
    <ViewProfile>
        <ID>799fa59f-23d2-4b55-a99b-4fcbe879ab02</ID>
        <Name>Profile 3 (5 + 1)</Name>
        <RowCount>3</RowCount>
        <ColumnCount>3</ColumnCount>
        <Cells>
            <Cell>
                <ColSpan>2</ColSpan>
                <RowSpan>2</RowSpan>
                <CameraID>00000000-0000-0000-0000-000000000000</CameraID>
                <SourceSwitchWidth>640</SourceSwitchWidth>
            </Cell>
            <Cell>
                <ColSpan>1</ColSpan>
                <RowSpan>1</RowSpan>
                <CameraID>00000000-0000-0000-0000-000000000000</CameraID>
                <SourceSwitchWidth>640</SourceSwitchWidth>
            </Cell>
            <Cell>
                <ColSpan>1</ColSpan>
                <RowSpan>1</RowSpan>
                <CameraID>00000000-0000-0000-0000-000000000000</CameraID>
                <SourceSwitchWidth>640</SourceSwitchWidth>
            </Cell>
            <Cell>
                <ColSpan>1</ColSpan>
                <RowSpan>1</RowSpan>
                <CameraID>00000000-0000-0000-0000-000000000000</CameraID>
                <SourceSwitchWidth>640</SourceSwitchWidth>
            </Cell>
            <Cell>
                <ColSpan>1</ColSpan>
                <RowSpan>1</RowSpan>
                <CameraID>00000000-0000-0000-0000-000000000000</CameraID>
                <SourceSwitchWidth>640</SourceSwitchWidth>
            </Cell>
            <Cell>
                <ColSpan>1</ColSpan>
                <RowSpan>1</RowSpan>
                <CameraID>00000000-0000-0000-0000-000000000000</CameraID>
                <SourceSwitchWidth>640</SourceSwitchWidth>
            </Cell>
        </Cells>
    </ViewProfile>
</ViewProfiles>

Getting a list of shared display profiles

Command:

/rsapi/configuration/sharedviewprofiles

Description:

Returns an XML document with a list of shared display profiles (layouts) of the authorized user.

Request example

GET http://localhost:11012/rsapi/configuration/sharedviewprofiles

Response example:

<ViewProfiles>
    <ViewProfile>
        <ID>ea7b4be3-25ff-4ca3-aff2-473020066baa</ID>
        <Name>Profile 1 (1 x 1)</Name>
        <RowCount>1</RowCount>
        <ColumnCount>1</ColumnCount>
        <Cells>
            <Cell>
                <ColSpan>1</ColSpan>
                <RowSpan>1</RowSpan>
                <CameraID>00000000-0000-0000-0000-000000000000</CameraID>
                <SourceSwitchWidth>640</SourceSwitchWidth>
            </Cell>
        </Cells>
    </ViewProfile>
    <ViewProfile>
        <ID>799fa59f-23d2-4b55-a99b-4fcbe879ab02</ID>
        <Name>Profile 3 (5 + 1)</Name>
        <RowCount>3</RowCount>
        <ColumnCount>3</ColumnCount>
        <Cells>
            <Cell>
                <ColSpan>2</ColSpan>
                <RowSpan>2</RowSpan>
                <CameraID>00000000-0000-0000-0000-000000000000</CameraID>
                <SourceSwitchWidth>640</SourceSwitchWidth>
            </Cell>
            <Cell>
                <ColSpan>1</ColSpan>
                <RowSpan>1</RowSpan>
                <CameraID>00000000-0000-0000-0000-000000000000</CameraID>
                <SourceSwitchWidth>640</SourceSwitchWidth>
            </Cell>
            <Cell>
                <ColSpan>1</ColSpan>
                <RowSpan>1</RowSpan>
                <CameraID>00000000-0000-0000-0000-000000000000</CameraID>
                <SourceSwitchWidth>640</SourceSwitchWidth>
            </Cell>
            <Cell>
                <ColSpan>1</ColSpan>
                <RowSpan>1</RowSpan>
                <CameraID>00000000-0000-0000-0000-000000000000</CameraID>
                <SourceSwitchWidth>640</SourceSwitchWidth>
            </Cell>
            <Cell>
                <ColSpan>1</ColSpan>
                <RowSpan>1</RowSpan>
                <CameraID>00000000-0000-0000-0000-000000000000</CameraID>
                <SourceSwitchWidth>640</SourceSwitchWidth>
            </Cell>
            <Cell>
                <ColSpan>1</ColSpan>
                <RowSpan>1</RowSpan>
                <CameraID>00000000-0000-0000-0000-000000000000</CameraID>
                <SourceSwitchWidth>640</SourceSwitchWidth>
            </Cell>
        </Cells>
    </ViewProfile>
</ViewProfiles>

Getting a list of recording profiles

Command:

/rsapi/configuration/recprofiles

Description:

Returns an XML document with a list of record profiles.

Request example

GET http://localhost:11012/rsapi/configuration/recprofiles

Response example:

<RecProfiles>
    <RecProfile>
        <ID>b9884849-dfab-44fa-94d8-c42d68b70365</ID>
        <Name>Record by motion detector</Name>
        <Description/>
        <Lines>
            <Line>
                <Days>127</Days>
                <StartTime>00:00:00</StartTime>
                <EndTime>00:00:00</EndTime>
                <BaseSource>true</BaseSource>
                <Fps>60</Fps>
                <Type>Motion</Type>
                <PreTime>5</PreTime>
                <PostTime>10</PostTime>
            </Line>
        </Lines>
    </RecProfile>
</RecProfiles>

Getting a list of disks

Command:

/rsapi/configuration/disks

Description:

Returns an XML document with a list of disks registered in the system.

Request example

http://localhost:11012/rsapi/configuration/disks

Response example:

<Disks>
    <Disk>
        <ID>e2170d0a-7979-4dd2-be69-732ae703550e</ID>
        <Name>D:\\/Name>
        <Description/>
        <Disabled>false</Disabled>
        <Quota>0</Quota>
    </Disk>
</Disks>

Getting a list of user actions

Command:

/rsapi/configuration/useractions

Description:

Returns an XML document with a list of user actions.

Request example

GET http://localhost:11012/rsapi/configuration/useractions

Response example:

<UserActions>
    <UserAction>
        <ID>ccf157b2-b6a6-4235-a369-04d1c8b98cf9</ID>
        <Name>Action1</Name>
        <Description/>
        <Disabled>false</Disabled>
    </UserAction>
</UserActions>

Launching a custom action for execution

Command:

/rsapi/configuration/useractions/execute

Description:

Starts the specified user action.

Request example

GET http://localhost:11012/rsapi/configuration/useractions/execute?id=ccf157b2-b6a6-4235-a369-04d1c8b98cf9

Parameters:

  • id – unique identifier of an action in the system.

Getting basic configuration

Command:

/rsapi/configuration/appconfig

Description:

Returns basic app configuration (contents of the ‘config/Sagitech.config’ file).

Request example

POST http://localhost:11012/rsapi/configuration/appconfig

Response example:

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8

<configuration>
    <appSettings>
        <!-- Common variables. -->
        <add key="Port" value="11011"/>
        <add key="InterfaceLanguage" value="English"/>
        <add key="PreferFFmpegVideoDecoder" value="yes"/>
        <add key="PreferFFmpegAudioDecoder" value="yes"/>
        <!-- Server variables. -->
        <add key="HttpPort" value="11012"/>
        <add key="HttpSourceSwitchWidth" value="640"/>
        <add key="HttpsPort" value=""/>
        <add key="HttpsCertificate" value=""/>
        <add key="RtspPort" value=""/>
        <add key="BindTo" value="Dns"/>
        <add key="CreateFirewallRules" value="yes"/>
        <add key="SkipBrokenJpegOverRtspFrames" value="no"/>
        <add key="SkipBrokenH264OverRtspSequences" value="no"/>
        <add key="EnableArchiveRecompression" value="yes"/>
        <add key="MobileHighResolution" value="800x480"/>
        <add key="MobileHighFps" value="15"/>
        <add key="MobileMediumResolution" value="320x240"/>
        <add key="MobileMediumFps" value="5"/>
        <!-- Client variables. -->
        <add key="DisableScreenSaver" value="yes"/>
    </appSettings>
</configuration>

Getting events from RDC RFID

Command:

/rsapi/modules/rdc_rfid

Description:

Function called by the RDC RFID system to transmit an event to the server.

Request example

GET http://localhost:11012/rsapi/modules/rdc_rfid

Checking the availability of the video analytics module

Command:

/rsapi/modules/getcanaccessmodule?moduleId=[moduleID]

Description:

This function allows you to check whether the specified analytics module is installed and whether the current user has the rights to work with it.

Request example

GET http://localhost:11012/rsapi/modules/getcanaccessmodule?moduleId= 12F7CDA9-EC68-4FA0-A14F-F1C86E22088C

Parameters:

  • moduleId – unique module ID, 12F7CDA9-EC68-4FA0-A14F-F1C86E22088C for Sagitech LPR, or EE272D1D-B29A-4EA3-84EB-6E62B45519AB for Sagitech FR.

People counter module: getting the status

Command:

/rsapi/modules/counter/getstats

Description:

Returns an XML document containing information on the status of the people counter module on all cameras.

Request example

GET http://localhost:11012/rsapi/modules/counter/getstats

Response example:

<CameraStates>
    <CameraState>
        <CameraID>2771ed81-dddc-42ed-af3f-b04a4b478b1c</CameraID>
        <LastResetTime>2020-03-20T11:50:26.591</LastResetTime>
        <In>20</In>
        <Out>10</Out>
    </CameraState>
    <CameraState>
        <CameraID>a10c06b5-3399-44be-934b-49e0bda892c7</CameraID>
        <LastResetTime>2020-03-20T11:50:26.591</LastResetTime>
        <In>15</In>
        <Out>12</Out>
    </CameraState>
</CameraStates>

People counter module: reseting the status

Command:

/rsapi/modules/counter/reset

Description:

Resets the status of the people counter module on all cameras.

Request example

GET http://localhost:11012/rsapi/modules/counter/reset

Queue detector module: getting the status

Command:

/rsapi/modules/queue/getstats

Description:

Returns an XML document containing information on the status of queue detection modules on all cameras.

Request example

GET http://localhost:11012/rsapi/modules/queue/getstats

Response example:

<CameraStates>
    <CameraState>
        <CameraID>1998454d-ac0b-4437-8a05-a679a8863805</CameraID>
        <ZoneStates>
            <ZoneState>
                <ZoneIndex>1</ZoneIndex>
                <QueueLength>4</QueueLength>
                <IsQueue>false</IsQueue>
            </ZoneState>
            <ZoneState>
                <ZoneIndex>2</ZoneIndex>
                <QueueLength>4</QueueLength>
                <IsQueue>false</IsQueue>
            </ZoneState>
        </ZoneStates>
    </CameraState>
</CameraStates>

License plate recognition module: working with cards

Command:

/rsapi/modules/lpr/owners

Description:

Allows you to interact with the card database of the license plate recognition module with the REST API.

Note

For the GET, POST, PUT, DELETE commands, you can specify the card ID in the URL. In the case of GET, this allows you to select only one card from the list. For the rest of the commands, this is left for compatibility and is optional.

Request example

http://localhost:11012/rsapi/modules/lpr/owners/5925d527-48c6-4b67-816c-e13aca2944b4.

Options:

  • GET – get a list or a single item.

Request example

GET http://localhost:11012/rsapi/modules/lpr/owners

Response:

<LPROwners>
    <LPROwner>
        <ID>5925d527-48c6-4b67-816c-e13aca2944b4</ID>
        <FirstName>Andreas</FirstName>
        <FamilyName></FamilyName>
        <MiddleName/>
        <Plate>7463JMF</Plate>
        <Model/>
        <VinCode/>
        <WorkPlace/>
        <Position/>
        <Phone/>
        <Description/>
        <GroupIDs>
            <GroupID>bb31b7a0-4421-40cf-abb4-9f5b86b4dd07</GroupID>
        </GroupIDs>  
        <Pass>
            <ID>90e0b1f4-fca3-4d74-92cc-8e9ead07df8a</ID>
            <PeriodStartTime/>
            <PeriodEndTime/>
            <DayStartTime>08:00:00</DayStartTime>
            <DayEndTime>20:00:00</DayEndTime>
            <Days>All</Days>
            <MaxPassages>0</MaxPassages>
            <MaxInsideSameGroup>0</MaxInsideSameGroup>
            <Description/>
        </Pass>
    </LPROwner>
</LPROwners>
  • POST – add a card.

Request example

POST http://localhost:11012/rsapi/modules/lpr/owners

Request body:

<LPROwner>
    <ID>5925d527-48c6-4b67-816c-e13aca2944b4</ID>
    <FirstName>Andreas/FirstName>
    <FamilyName></FamilyName>
    <MiddleName/>
    <Plate>7463JMF</Plate>
    <Model/>
    <VinCode/>
    <WorkPlace/>
    <Position/>
    <Phone/>
    <Description/>
    <GroupIDs>
        <GroupID>bb31b7a0-4421-40cf-abb4-9f5b86b4dd07</GroupID>
    </GroupIDs>  
    <Pass>
        <ID>90e0b1f4-fca3-4d74-92cc-8e9ead07df8a</ID>
        <PeriodStartTime/>
        <PeriodEndTime/>
        <DayStartTime>08:00:00</DayStartTime>
        <DayEndTime>20:00:00</DayEndTime>
        <Days>All</Days>
        <MaxPassages>0</MaxPassages>
        <MaxInsideSameGroup>0</MaxInsideSameGroup>
        <Description/>
    </Pass>
</LPROwner>
  • PUT – edit a card.

Request example

PUT http://localhost:11012/rsapi/modules/lpr/owners

Request body:

<LPROwner>
    <ID>5925d527-48c6-4b67-816c-e13aca2944b4</ID>
    <FirstName>Andreas</FirstName>
    <FamilyName></FamilyName>
    <MiddleName/>
    <Plate>7463JMF</Plate>
    <Model/>
    <VinCode/>
    <WorkPlace/>
    <Position/>
    <Phone/>
    <Description/>
    <GroupIDs>
        <GroupID>bb31b7a0-4421-40cf-abb4-9f5b86b4dd07</GroupID>
    </GroupIDs>  
    <Pass/>
</LPROwner>
  • DELETE – delete a card.

Request type 1 (with the id in the request body)

DELETE http://localhost:11012/rsapi/modules/lpr/owners

Request body:

<LPROwnerId>5925d527-48c6-4b67-816c-e13aca2944b4</LPROwnerId>

Request type 2 (with the id in the URL)

DELETE http://localhost:11012/rsapi/modules/lpr/owners/5925d527-48c6-4b67-816c-e13aca2944b4

License plate recognition module: working with groups

Command:

/rsapi/modules/lpr/groups

Description:

Allows you to interact with groups of the license plate recognition module with the REST API. Supported HTTP commands:

  • GET – getting a list or an individual item;

  • POST – adding group;

  • PUT – editing group;

  • DELETE – delete group.

Note

For the commands GET, POST, PUT, DELETE you can specify the card ID in the URL. In the case of GET, this allows you to select only one group from the list. For the rest of the commands, this is left for compatibility and is optional.

Request example

GET http://localhost:11012/rsapi/modules/lpr/groups/5925d527-48c6-4b67-816c-e13aca2944b4.

Request example

GET http://localhost:11012/rsapi/modules/lpr/groups

Response example on GET request:

<LPRGroups>
    <LPRGroup>
        <ID>bb31b7a0-4421-40cf-abb4-9f5b86b4dd07</ID>
        <Name>White</Name>
        <Color>FFFFFFFF</Color>
    </LPRGroup>
    <LPRGroup>
        <ID>8a41c537-c50f-497e-a05e-a0347f4de893</ID>
        <Name>Control</Name>
        <Color>FFFF8080</Color>
    </LPRGroup>
    <LPRGroup>
        <ID>efe05502-591c-473f-a07e-7586b65a707b</ID>
        <Name>Black</Name>
        <Color>FF000000</Color>
    </LPRGroup>
</LPRGroups>

License plate recognition module: parking information

Command:

/rsapi/modules/lpr/parkinginfo

Description:

Returns information about cars in the parking area. Also returns the size of the parking lot (the number of parking spaces specified in the configuration file LPR.config).

Request example

GET http://localhost:11012/rsapi/modules/lpr/parkinginfo

Response example:

<ParkingInfo>
    <ParkingSize>100</ParkingSize>
    <LPRInsideInfos>
        <LPRInsideInfo>
            <ID>4627daf4-1700-4607-a6ec-bc000e8e274d</ID>
            <Plate>7463JMF</Plate>
            <EntranceTime>12.07.2023 23:54:06</EntranceTime>
            <CameraID>4ddf26b5-1241-4b8b-84a8-50fa06624c36</CameraID>
        </LPRInsideInfo>
        <LPRInsideInfo>
            <ID>095ccca5-24c4-420e-a7f2-b81aba6a2200</ID>
            <Plate>3263JMF</Plate>
            <EntranceTime>12.07.2023 23:54:18</EntranceTime>
            <CameraID>4ddf26b5-1241-4b8b-84a8-50fa06624c36</CameraID>
        </LPRInsideInfo>
    </LPRInsideInfos>
</ParkingInfo>

Face recognition module: working with cards

Command:

/rsapi/modules/fr/persons

Description:

Allows you to interact with the card file of the face recognition module with the REST API.

Note

For the commands GET, POST, PUT, DELETE you can specify the card ID in the URL. In the case of GET, this allows you to get only one card from the list. For the rest of the commands, this is left for compatibility and is optional.

Request example

GET http://localhost:11012/rsapi/modules/fr/persons/5925d527-48c6-4b67-816c-e13aca2944b4.

Options:

  • GET - getting a list or an individual item. Specify the ‘sendphotos’ flag to receive the photos linked to the card.

Request example

GET http://localhost:11012/rsapi/modules/fr/persons?sendphotos=1

Response:

<FRPersons>
    <FRPerson>
        <ID>5925d527-48c6-4b67-816c-e13aca2944b4</ID>
        <FirstName>Andreas</FirstName>
        <FamilyName></FamilyName>
        <MiddleName/>
        <WorkPlace/>
        <Position/>
        <Phone/>
        <CardNumber>110</CardNumber>
        <CardVersion>0</CardVersion>
        <Description/>
        <GroupIDs>
            <GroupID>bb31b7a0-4421-40cf-abb4-9f5b86b4dd07</GroupID>
        </GroupIDs>
        <Photos>
            <Photo>*[BASE64IMAGE]*</Photo>
        </Photos>
    </FRPerson>
</FRPersons>
  • POST – add a card.

Note

The Photos block is optional.

Request example

POST http://localhost:11012/rsapi/modules/fr/persons

Request body:

<FRPerson>
    <ID>5925d527-48c6-4b67-816c-e13aca2944b4</ID>
    <FirstName>Andreas</FirstName>
    <FamilyName></FamilyName>
    <MiddleName/>
    <WorkPlace/>
    <Position/>
    <Phone/>
    <CardNumber>110</CardNumber>
    <CardVersion>0</CardVersion>
    <Description/>
    <GroupIDs>
        <GroupID>bb31b7a0-4421-40cf-abb4-9f5b86b4dd07</GroupID>
    </GroupIDs>
    <Photos>
        <Photo>*[BASE64IMAGE]*</Photo>
    </Photos>
</FRPerson>
  • PUT – edit a card.

Note

The Photos block is optional.

Request example

PUT http://localhost:11012/rsapi/modules/fr/persons

Request body:

<FRPerson>
    <ID>5925d527-48c6-4b67-816c-e13aca2944b4</ID>
    <FirstName>Andreas</FirstName>
    <FamilyName></FamilyName>
    <MiddleName/>
    <WorkPlace/>
    <Position/>
    <Phone/>
    <CardNumber>110</CardNumber>
    <CardVersion>0</CardVersion>
    <Description/>
    <GroupIDs>
        <GroupID>bb31b7a0-4421-40cf-abb4-9f5b86b4dd07</GroupID>
    </GroupIDs>
    <Photos>
        <Photo>*[BASE64IMAGE]*</Photo>
    </Photos>
</FRPerson>
  • DELETE – delete a card.

Request, type 1 (with the id in the request body)

DELETE http://localhost:11012/rsapi/modules/fr/persons

Request body:

<FRPersonId>5925d527-48c6-4b67-816c-e13aca2944b4</FRPersonId>

Request, type 2 (with the id in the URL)

DELETE http://localhost:11012/rsapi/modules/fr/persons/5925d527-48c6-4b67-816c-e13aca2944b4

Face recognition module: working with groups

Command:

/rsapi/modules/fr/groups

Description:

Allows you to interact with groups of the face recognition module with the REST API.

Supported HTTP commands:

  • GET – getting a list or an individual item;

  • POST – adding group;

  • PUT – editing group;

  • DELETE – deleting group.

Note

For the commands GET, POST, PUT, DELETE you can specify the card ID in the URL. In the case of GET, this allows you to get only one group from the list. For the rest of the commands, this is left for compatibility and is optional.

Request example

GET http://localhost:11012/rsapi/modules/fr/groups/5925d527-48c6-4b67-816c-e13aca2944b4.

Request example

GET http://localhost:11012/rsapi/modules/fr/groups

Response example on GET request:

<FRGroups>
    <FRGroup>
        <ID>bb31b7a0-4421-40cf-abb4-9f5b86b4dd07</ID>
        <Name>White</Name>
        <Color>FFFFFFFF</Color>
    </FRGroup>
    <FRGroup>
        <ID>8a41c537-c50f-497e-a05e-a0347f4de893</ID>
        <Name>Control</Name>
        <Color>FFFF8080</Color>
    </FRGroup>
        <FRGroup>
        <ID>efe05502-591c-473f-a07e-7586b65a707b</ID>
        <Name>Black</Name>
        <Color>FF000000</Color>
    </FRGroup>
</FRGroups>

Face recognition module: verification by ACS card number

Command:

/rsapi/modules/fr/checkpresence

Description:

Allows you to check that a face in front of the camera matches the specified card. Reconciliation is performed by the ACS card number passed in the body of the POST request. The camera identifier should be specified with the ‘CameraID’ parameter. The response contains a set of four variables:

  • Result – result type. Available values: MatchPositive (the face is uniquely matched), NoCardInDB (the card with the specified ID was not found in the database), NoPhotoInCard (the card with the specified ID was found, but the photo is not linked to the card), NoFaceDetected (the face was not detected in the video stream), MatchNegative (the face is not matched to any face in the database), MatchIncorrect (the face is matched to another face in the DB).

  • ResultCode – digital representation of the result type. Available values: 0 (MatchPositive), 1 (NoCardInDB), 2 (NoPhotoInCard), 3 (NoFaceDetected), 4 (MatchNegative), 5 (MatchIncorrect).

  • MatchFactor – the accuracy with which the face is matched.

  • MatchCardNumber – the number of the ACS card that the person is associated with.

Request example

POST http://localhost:11012/rsapi/modules/fr/checkpresence

Request body:

CameraID={1B8E4CB5-FCDF-4FC3-A45C-F21065CFEE71}

CardNumber=110

Response example:

Result=MatchPositive

ResultCode=0

MatchFactor=99

MatchCardNumber=110

Face recognition module: verification by photo

Command:

/rsapi/modules/fr/checkfacepresence

Description:

Allows to check that the face in front of the camera lens matches the face in the photo transmitted in the request. The image is encoded in Base64 and passed in the body of the POST request in the text format: "ImageData=[Base64Image]". The camera identifier should be specified with the ‘CameraID’ parameter. The response contains aset of four variables:

  • Result – result type. Available values: MatchPositive (the face is uniquely matched), NoFaceDetected (the face was not detected in the video stream), MatchNegative (the face in front of the camera lens does not match the face in the transmitted image).

  • ResultCode – digital representation of the result type. Available values: 0 (MatchPositive), 3 (NoFaceDetected), 4 (MatchNegative).

  • MatchFactor – the accuracy with which the face is matched..

Request example

POST http://localhost:11012/rsapi/modules/fr/checkfacepresence

Request body:

CameraID={1B8E4CB5-FCDF-4FC3-A45C-F21065CFEE71}

ImageData=*[Base64Image]*

Response example:

Result=MatchPositive

ResultCode=0

MatchFactor=99

Face recognition module: external system recognition control

Command:

/rsapi/modules/fr/ondemand

Description:

Allows you to perform face recognition in front of the camera lens. It is used when the "Recognition on demand" mode is selected in the module settings (in this mode, the module analyzes faces in front of the lens only on an external command, and spends the rest of the time waiting).

The ‘RequestID’ variable contains a unique request identifier and can be passed in any format. The ‘Timeout’ variable specifies a face search timeout in milliseconds. The ‘CameraID’ variable contains unique camera identifier. The command terminates immediately without returning the recognition result, but the passed request ID is bound to the face recognition event and can be obtained both with scripts or with the event subscription command from the server.

Request example

POST http://localhost:11012/rsapi/modules/fr/ondemand

Request body:

CameraID={1B8E4CB5-FCDF-4FC3-A45C-F21065CFEE71}

RequestID=123-ABC

Timeout=10000

Face recognition module: getting the events

Command:

/rsapi/modules/fr/events?format=[Format]

Request example 1

GET http://localhost:11012/rsapi/modules/fr/events?format=plain

Response example 1:

HTTP/1.1 200 OK

Content-Type: multipart/x-mixed-replace;boundary=--myboundary

--myboundary

Content-Type: text/plain

level=Notification;type=FaceRecognition;cameraId=a3300d2c-4771-4fcc-b31d-fe0085fc4712;eventId=cf647529-372a-455a-9129-175b758f4dfc;time=2020-04-14T17:34:00.140;personId=9515ac2c-e34d-4b2a-a051-35fbea17efe2;recognized=true;passage=None;realtime=2020-04-14T17:33:59.363;state=unknown;requestId=;factor=99.33;cardNumber="101"

--myboundary

Content-Type: text/plain

…

Request example 2

GET http://localhost:11012/rsapi/modules/fr/events?format=json

Response example 2:

HTTP/1.1 200 OK

Content-Type: multipart/x-mixed-replace;boundary=--myboundary

--myboundary

Content-Type: application/json

{

"level": "Notification",

"type": "FaceRecognition",

"cameraId": "a3300d2c-4771-4fcc-b31d-fe0085fc4712",

"eventId": "20b175af-7741-493b-af08-796818682614",

"time": "2020-04-14T17:24:19.452",

"personId": "946d5717-e2c7-4f7b-b85b-da6361d4bf53",

"recognized": "true",

"passage": "None",

"realtime": "2020-04-14T17:24:19.024",

"state": "unknown",

"requestId": "",

"factor": 99.0,

"cardNumber": "111"

}

--myboundary

Content-Type: application/json

…

Description:

Returns real-time events from the face recognition module.

Parameters:

  • format – formatting option. Available values: plain (default), json.