Skip to main content
Skip table of contents

API for Inspector

Table of Contents

Introduction

The API commands in this document will allow developers to create their own Inspector type applications. This document contains information used to:

  • Check if the DVR+O / SCI application is ready to take API commands.

  • Set directory path(s) as needed for storing recordings and video framegrab.

  • And starting and stopping video recordings and taking video framegrab.

Also, included is a logic flowchart of some basic when it comes to programming with the system.

Quick Commands

The table below shows all of the REST API commands which can be executed in a web browser or a program such as Postman.

Included in the table is:

  • URL - Sample URL + Command (http://127.0.0.1:13000/api/stats/<command>).

  • Method - Command execution (GET/POST).

    • Body - Command syntax use when submitting a POST command.

  • Response(s) - Output examples from the DVR+O REST API commands.

URL

Method

Body (POST Commands)

Response(s)

Description

http://127.0.0.1:13000/api/stats/ping

GET

N/A

Normal - Successful

  • 200 = OK

  • JSON reply of “{ "Ping": true }”

Failed

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

Ping command is used for testing connectivity between hosts and debugging connectivity-related issues.

Ping command sends packets of data to a device and measures the response time.

http://127.0.0.1:13000/api/recordersettings/apply

NEW

POST

CODE
{
  "Bitrate": 1,
  "Directory": null,
  "DirectoryTemplate": "${channelname}\\${yyyy]\\${MM}\\${dd}",
  "Encoder": "n265",
  "Filename": "${hh}${mm}$ss}_${fff}",
  "FrameRate": 0,
  "IsSmartEncoding": true,
  "ReevaluateTagsOnSplit": false,
  "Resolution": "0, 0",
  "RestartOnFailure": false,
  "SplitTimeMinutes": 10
}

Normal - Successful

  • 200 OK

  • No JSON data returned.

Failed

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

  • 500 Internal Server Error

    • Command issued has been typed incorrectly.

    • Commonly will be seen with a browser (GUI or headless)

Master camera settings sync when not using smart encoding.

http://127.0.0.1:13000/api/inspector/createdirectory

NEW

POST

CODE
{
  "Directory": "new_directory_name"
}

Normal - Successful

  • 200 OK

  • No JSON data returned.

Failed

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

  • 500 Internal Server Error

    • Command issued has been typed incorrectly.

    • Commonly will be seen with a browser (GUI or headless)

Create the directory where recording files will be saved.

http://127.0.0.1:13000/api/inspector/recordingdirectory

POST

CODE
{
  "Directory": "target_directory"
}

Normal - Successful

  • 200 OK

  • No JSON data returned.

Failed

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

  • 500 Internal Server Error

    • Command issued has been typed incorrectly.

    • Commonly will be seen with a browser (GUI or headless)

Set the directory on all recordings.

http://127.0.0.1:13000/api/inspector/inspectiondirectory

POST

CODE
{
  "Directory": "target_directory"
}

Normal - Successful

  • 200 OK

  • No JSON data returned.

Failed

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

  • 500 Internal Server Error

    • Command issued has been typed incorrectly.

    • Commonly will be seen with a browser (GUI or headless)

Set the base directory on all channels.

http://127.0.0.1:13000/api/inspector/splittime/{SplitTimeMinutes}

NEW

GET

N/A

Normal - Successful

  • 200 OK

  • No JSON data returned.

Failed

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

  • 500 Internal Server Error

    • Command issued has been typed incorrectly.

    • Commonly will be seen with a browser (GUI or headless)

Set the time duration (in minutes) for when the video file splits / spawns another video recording file.

http://127.0.0.1:13000/api/inspector/reevaluatetags/{ReevaluateTags}

NEW

GET

N/A

Allowed Tags

  • true

  • false

Normal - Successful

  • 200 OK

  • No JSON data returned.

Failed

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

  • 500 Internal Server Error

    • Command issued has been typed incorrectly.

    • Commonly will be seen with a browser (GUI or headless)

Reevaluate tags on split:

When selected, will modify the filename of recorded video files each time it splits according to the tags in the Filename Template.

http://127.0.0.1:13000/api/inspector/pathtemplate

NEW

POST

CODE
{
    "FilenameTemplate": "${yyyy}${MM}${dd}${hh}${mm}${ss}${fff}@${channelname}",
    "DirectoryTemplate": "DATA_${yyyy}${MM}${dd}${hh}${mm}${ss}${fff}",
    "FramegrabTemplate": "${yyyy}${MM}${dd}${hh}${mm}${ss}${fff}@${channelname}",
    "DataLogTemplate": "${yyyy}${MM}${dd}${hh}${mm}${ss}${fff}@current",
    "EventTemplate": "${yyyy}${MM}${dd}${hh}${mm}${ss}${fff}",
    "AnomalyTemplate": "${yyyy}${MM}${dd}${hh}${mm}${ss}${fff}@${channelname}_anomaly"
}

Normal - Successful

  • 200 OK

  • No JSON data returned.

Failed

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

  • 500 Internal Server Error

    • Command issued has been typed incorrectly.

    • Commonly will be seen with a browser (GUI or headless)

Sets the templates for inspection, filename, directory, etc such that the tags (${yyyy}${MM}${dd}${hh}${mm}${ss}${fff}@${channelname}) can be specified for evaluation during inspections.

http://127.0.0.1:13000/api/inspector/pathtemplate

NEW

GET

N/A

Normal - Successful

  • 200 OK

  • No JSON data returned.

Failed

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

  • 500 Internal Server Error

    • Command issued has been typed incorrectly.

    • Commonly will be seen with a browser (GUI or headless)

Get the currently assigned path template.

http://127.0.0.1:13000/api/inspector/startrecording

GET

N/A

Normal - Successful

  • 200 OK

  • No JSON data returned.

Failed

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

  • 500 Internal Server Error

    • Command issued has been typed incorrectly.

    • Commonly will be seen with a browser (GUI or headless)

Master start recording for all channels

http://127.0.0.1:13000/api/inspector/stoprecording

GET

N/A

Normal - Successful

  • 200 OK

    • The request was successfully.

  • No JSON data returned.

Failed

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

  • 500 Internal Server Error

    • Command issued has been typed incorrectly.

    • Commonly will be seen with a browser (GUI or headless)

Master stop recording for all channels

http://127.0.0.1:13000/api/inspector/isrecording

GET

N/A

Normal - Successful

  • 200 OK

  • Reply of true or false

Failed

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

  • 500 Internal Server Error

    • Command issued has been typed incorrectly.

    • Commonly will be seen with a browser (GUI or headless)

Check to confirm the recording is still running.

http://127.0.0.1:8088/api/recording/encoderrunning

(Same as http://127.0.0.1:8088/api/recording/isrecording )

GET

N/A

This REST API command is part of the service running on port 8088 under the path “/api/recording/isrecording” or “/api/recording/encoderrunning“.

Normal - Successful

  • 200 OK

  • JSON reply of “{ "IsRecording": true }”

Failed

  • Reply of “false

    • DVR+O is not currently recording.

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running

    • Firewall blocking access

    • Other network routing issue

  • 500 Internal Server Error

    • Command issued has been typed incorrectly.

    • Commonly will be seen with a browser (GUI or headless)

Returns a value indicating if a video is actively recording.

Both isrecording and encoderrunning perform the same.

http://127.0.0.1:13000/api/inspector/takeframegrab

GET

N/A

Normal - Successful

  • 200 OK

  • Reply of “true” or “false

Failed

  • Reply of “false

    • No channel has been started on the DVR+O

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

  • 500 Internal Server Error

    • Command issued has been typed incorrectly.

    • Commonly will be seen with a browser (GUI or headless)

Take a video framegrab.

http://127.0.0.1:13000/api/inspector/startclip

GET

N/A

Normal - Successful

  • 200 OK

  • No JSON data returned.

Failed

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

  • 500 Internal Server Error

    • Command issued has been typed incorrectly.

    • Commonly will be seen with a browser (GUI or headless)

Start recording a video clip.

  • While doing master recording/inspection recording, you can start an additional recording “clip”.

http://127.0.0.1:13000/api/inspector/stopclip

GET

N/A

Normal - Successful

  • 200 OK

  • No JSON data returned.

Failed

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running

    • Firewall blocking access

    • Other network routing issue

  • 500 Internal Server Error

    • Command issued has been typed incorrectly.

    • Commonly will be seen with a browser (GUI or headless)

Stop recording a video clip.

http://127.0.0.1:13000/api/inspector/iscliprecording

GET

N/A

Normal - Successful

  • 200 OK

  • Reply of “true” or “false”

Failed

  • Reply of “false

    • No channel has been started on the DVR+O

  • 404 Not Found

    • DVR+O software is not running.

    • Firewall blocking access.

    • Other network routing issue

    • Command issued has been typed incorrectly.

  • Error: connect ECONNREFUSED

    • DVR+O software is not running

    • Firewall blocking access

    • Other network routing issue

  • 500 Internal Server Error

    • Command issued has been typed incorrectly.

    • Commonly will be seen with a browser (GUI or headless)

Gets a value confirming if a video clip is actively recording.

Postman Commands

In this section, we show how to use Postman to send Inspector commands to the running DVR+O application.

Check if the REST API is Ready?

You can send a ping command to the DVR+O system to check if the inspector system is ready to start taking commands.

This comes in handy if the DVR+O application was closed, you would be notified the ping failed and then check to ensure the DVR+O application is started.

Steps:

  1. Open Postman.

  2. Login to your Postman account.

  3. Create a new tab.

  4. Ensure the type is GET

  5. Update the textbox to “http://127.0.0.1:13000/api/stats/ping”.
    Remember to change the 127.0.0.1 to the IP address of the PC that is hosting the DVR+O you are targeting.

  6. Click the Send button.

Use Multichannel Recording Feature

@a user Insert a description.

image-20240524-180309.png

Steps:

  1. Open Postman.

  2. Login to your Postman account.

  3. Create a new tab.

  4. Change from GET to POST.

  5. Update the textbox to “http://127.0.0.1:13000/api/recordersettings/apply“.
    Remember to change the 127.0.0.1 to the IP address of the PC that is hosting the DVR+O you are targeting.

  6. Click on the Body sub tab.

  7. Click the option “raw” and change the drop-down from Text to JSON.

  8. Paste in the JSON template..

    CODE
    {
      "Bitrate": 1,
      "Directory": null,
      "DirectoryTemplate": "${channelname}\\${yyyy]\\${MM}\\${dd}",
      "Encoder": "n265",
      "Filename": "${hh}${mm}$ss}_${fff}",
      "FrameRate": 0,
      "IsSmartEncoding": true,
      "ReevaluateTagsOnSplit": false,
      "Resolution": "0, 0",
      "RestartOnFailure": false,
      "SplitTimeMinutes": 10
    }
  9. Click the Send button.

Creating a Directory/Folder

If you wish to create a directory/folder using the API.

image-20240522-143153.png

Steps:

  1. Open Postman.

  2. Login to your Postman account.

  3. Create a new tab.

  4. Change from GET to POST.

  5. Update the textbox to “http://127.0.0.1:13000/api/inspector/createdirectory.
    Remember to change the 127.0.0.1 to the IP address of the PC that is hosting the DVR+O you are targeting.

  6. Click on the Body sub tab.

  7. Click the option “raw” and change the drop-down from Text to JSON.

  8. Paste in the JSON template { "Directory": "new_directory_name" }.

  9. Click the Send button.

Ensure that all backslashes are escaped with an addition backslash "\"

Example: “C:\\tmp\\Data1”

Setting the Recording Directory

It’s important to set the recording directory before starting a recording. If you do not, the system running the DVR+O software will prompt you to select which directory save your recording files.

Also, this must be done each time the DVR+O software is started.

In order to set the recording directory, you need to send a POST REST API command to the system running the DVR+O software. Please ensure you have opened the firewall to access port 13000 to get the request into the system. We will be using Postman to send REST API called to the system.

image-20240216-162209.png

Steps:

  1. Open Postman.

  2. Login to your Postman account.

  3. Create a new tab.

  4. Change from GET to POST.

  5. Update the textbox to “http://127.0.0.1:13000/api/inspector/recordingdirectory”.
    Remember to change the 127.0.0.1 to the IP address of the PC that is hosting the DVR+O you are targeting.

  6. Click on the Body sub tab.

  7. Click the option “raw” and change the drop-down from Text to JSON.

  8. Paste in the JSON template { "Directory": "target_directory" }.

  9. Click the Send button.

Ensure that all backslashes are escaped with an addition backslash "\"

Example: “C:\\tmp\\Data1”

If you set a directory that is not created yet, when you start a recording the DVR+O system will create the directory for you.

Setting the Inspection Directory

This is a POST command to set the Inspection directory. Items included in this are frame grabs and clips.

image-20240216-203233.png

Steps:

  1. Open Postman.

  2. Login to your Postman account.

  3. Create a new tab.

  4. Change from GET to POST.

  5. Update the textbox to “http://127.0.0.1:13000/api/inspector/inspectiondirectory.
    Remember to change the 127.0.0.1 to the IP address of the PC that is hosting the DVR+O you are targeting.

  6. Click on the Body sub tab.

  7. Click the option “raw” and change the drop-down from Text to JSON.

  8. Paste in the JSON template { "Directory": "target_directory" }.

  9. Click the Send button.

Update Split-Time

image-20240522-153902.png

You can change the split time using the API.

Steps:

  1. Open Postman.

  2. Login to your Postman account.

  3. Create a new tab.

  4. Ensure the type is GET

  5. Update the textbox to “http://127.0.0.1:13000/api/inspector/splittime/{SplitTimeMinutes}“.
    Remember to change the 127.0.0.1 to the IP address of the PC that is hosting the DVR+O you are targeting.

  6. Click the Send button.

Enable Re-Evaluate Tags Option

image-20240522-154320.png
  1. Open Postman.

  2. Login to your Postman account.

  3. Create a new tab.

  4. Ensure the type is GET

  5. Update the textbox to “http://127.0.0.1:13000/api/inspector/reevaluatetags/{ReevaluateTags=true/false}“.
    Remember to change the 127.0.0.1 to the IP address of the PC that is hosting the DVR+O you are targeting.

  6. Click the Send button.

Update Path Templates

You can update the path templates

Steps:

  1. Open Postman.

  2. Login to your Postman account.

  3. Create a new tab.

  4. Change from GET to POST.

  5. Update the textbox to “http://127.0.0.1:13000/api/inspector/pathtemplate“.
    Remember to change the 127.0.0.1 to the IP address of the PC that is hosting the DVR+O you are targeting.

  6. Click on the Body sub tab.

  7. Click the option “raw” and change the drop-down from Text to JSON.

  8. Paste in the JSON template

    CODE
    {
        "FilenameTemplate": "${yyyy}${MM}${dd}${hh}${mm}${ss}${fff}@${channelname}",
        "DirectoryTemplate": "DATA_${yyyy}${MM}${dd}${hh}${mm}${ss}${fff}",
        "FramegrabTemplate": "${yyyy}${MM}${dd}${hh}${mm}${ss}${fff}@${channelname}",
        "DataLogTemplate": "${yyyy}${MM}${dd}${hh}${mm}${ss}${fff}@current",
        "EventTemplate": "${yyyy}${MM}${dd}${hh}${mm}${ss}${fff}",
        "AnomalyTemplate": "${yyyy}${MM}${dd}${hh}${mm}${ss}${fff}@${channelname}_anomaly",
        "Directory": "C:\\tmp2"
    }
  9. Click the Send button.

You can provided one of the items in the object or more to be updated.

Get the Current Path Templates Set

If you not sure what path templates are set, the GET version of the command will provide the current values.

Steps:

  1. Open Postman.

  2. Login to your Postman account.

  3. Create a new tab.

  4. Ensure the type is GET

  5. Update the textbox to “http://127.0.0.1:13000/api/inspector/pathtemplate”.
    Remember to change the 127.0.0.1 to the IP address of the PC that is hosting the DVR+O you are targeting.

  6. Click the Send button.

Start a Recording

image-20240216-205812.png

You can send a GET command from Postman or a browser to start a recording. See the steps below for details.

Steps:

  1. Open Postman.

  2. Login to your Postman account.

  3. Create a new tab.

  4. Ensure the type is GET

  5. Update the textbox to “http://127.0.0.1:13000/api/inspector/startrecording”.
    Remember to change the 127.0.0.1 to the IP address of the PC that is hosting the DVR+O you are targeting.

  6. Click the Send button.

Stop a Recording

image-20240216-210832.png

You can send a GET command to stop the recording using the command: “http://127.0.0.1:13000/api/inspector/stoprecording”.

See the steps below for details.

Steps:

  1. Open Postman.

  2. Login to your Postman account.

  3. Create a new tab.

  4. Ensure the type is GET

  5. Update the textbox to “http://127.0.0.1:13000/api/inspector/stoprecording”.
    Remember to change the 127.0.0.1 to the IP address of the PC that is hosting the DVR+O you are targeting.

  6. Click the Send button.

Check if the Recording has Started.

image-20240220-013533.png

You can check if the recording has started by using the “isrecording” or “encoderrunning“ commands.

Steps:

  1. Open Postman.

  2. Login to your Postman account.

  3. Create a new tab.

  4. Ensure the type is GET

  5. Update the textbox to “http://127.0.0.1:13000/api/inspector/encoderrunning” or “http://127.0.0.1:13000/api/inspector/isrecording”.
    Remember to change the 127.0.0.1 to the IP address of the PC that is hosting the DVR+O you are targeting.

  6. Click the Send button.

Take a Framegrab

image-20240217-230014.png

You have the option of taking a framegrab of the current image being displayed.

Steps:

  1. Open Postman.

  2. Login to your Postman account.

  3. Create a new tab.

  4. Ensure the type is GET

  5. Update the textbox to “http://127.0.0.1:13000/api/inspector/takeframegrab”.
    Remember to change the 127.0.0.1 to the IP address of the PC that is hosting the DVR+O you are targeting.

  6. Click the Send button.

Start a Video Clip

image-20240217-231123.png

Steps:

  1. Open Postman.

  2. Login to your Postman account.

  3. Create a new tab.

  4. Ensure the type is GET

  5. Update the textbox to “http://127.0.0.1:13000/api/inspector/startclip”.
    Remember to change the 127.0.0.1 to the IP address of the PC that is hosting the DVR+O you are targeting.

  6. Click the Send button.

Stop a Video Clip

image-20240217-231246.png

Steps:

  1. Open Postman.

  2. Login to your Postman account.

  3. Create a new tab.

  4. Ensure the type is GET

  5. Update the textbox to “http://127.0.0.1:13000/api/inspector/stopclip”.
    Remember to change the 127.0.0.1 to the IP address of the PC that is hosting the DVR+O you are targeting.

  6. Click the Send button.

Check if the Video Clip Recording has Started.

image-20240220-013308.png

You can check if the video clip recording has started by using the “iscliprecording” command.

Steps:

  1. Open Postman.

  2. Login to your Postman account.

  3. Create a new tab.

  4. Ensure the type is GET

  5. Update the textbox to “http://127.0.0.1:13000/api/inspector/iscliprecording”.
    Remember to change the 127.0.0.1 to the IP address of the PC that is hosting the DVR+O you are targeting.

  6. Click the Send button.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.