Nimble REST API (v1)

Download OpenAPI specification:Download

Nimble's REST API (Application Programming Interface) enables users to configure and query analytics workloads executing within Nimble. Behind this API is a software layer that routes data, arbitrates resources and executes Deep Learning and analytics functions to enable enriched business insights at world-class speed.

The latest online documentation can be found here.

What is a REST API?

API is short for "Application Programming Interface". An API is a set of rules that lets programs talk to each other, exposing data and functionality across the Internet in a consistent format.

REST stands for "Representational State Transfer". This is an architectural pattern that describes how distributed systems can expose a consistent interface. When people use the term "REST API", they are generally referring to an API accessed using the HTTP protocol at a predefined set of URLs.

These URLs represent various resources - any information or content accessed at that location, which can be returned as JSON, HTML, or media files. Often resources have one or more methods that can be performed on them over HTTP, like GET, POST, PUT, PATCH, and DELETE. The action represented by the first and last of these is clear, but POST, PUT, and PATCH have specific meanings. How they are defined is confusing, but the general rule is: use POST to create resources, PUT to update resources, and PATCH to modify resources.

The Key Elements of Nimble

Nimble and the REST API have six key elements: Configuration, Source, Sink, Pipeline, Channel, and Stream.
A Configuration is a collection of Sources, Sinks and Pipeline Elements arranged to execute the desired analytic behaviour.
A Source brings data into Nimble.
A Sink pushes data out of Nimble.
A Pipeline is made up of processing elements that perform some analytics task.
Since a Source can be shared between multiple Pipelines, a Channel is an abstraction of both a Source and a Pipeline that can be thought of as "the data brought in by this Source is operated on by this Pipeline".
A Stream is a proxied fMP4 video stream from a Source.

Configuration

Nimble is controlled by a Configuration. A Configuration is a collection of Sources, Sinks and Pipeline Elements arranged to execute the desired analytic behaviour.

Fetch the Configuration

Retrieve the Configuration from Nimble.

Responses

Response samples

Content type
application/json
{
  • "sources": {
    },
  • "sinks": {
    },
  • "pipelines": {
    }
}

Deploy a Configuration

Deploy a Configuration to Nimble.

Request Body schema: application/json

The new Configuration in list-based format, see config.yaml.

Array ()
required
Array of objects non-empty
Array of objects
required
Array of strings or objects non-empty
names (string) or null
Array of objects

Responses

Request samples

Content type
application/json
Example

Deployment with short-form pipeline elements

[
  • {
    }
]

Source

A Source brings in data and pushes it to one or more Pipelines. Sources are generally URLs to video streams or other media but can also be other Nimble instances or files for offline processing.

Fetch all Sources

Retrieve all Sources in the Configuration.

Responses

Response samples

Content type
application/json
{
  • "0": {
    },
  • "1": {
    }
}

Create a Source

Create a Source in the Configuration.

header Parameters
object
Examples:
  • return=minimal - Request minimal response (ID only)
  • return=representation - Request full representational response

The preferred response (minimal or full)

Request Body schema: application/json

The new Source.

type
required
string (schemas)
Enum: "video" "file" "youtube" "zmqinternal" "zmq" "inf"
required
string or object (address)
rate
required
number <float> (schemas) [0 .. 0]
timeout
number <float> (schemas)
Default: -1

If source is disconnected, then try to reconnect for the specified number of minutes; -1 is try indefinitely.

proxy
boolean (schemas)
Default: true

Responses

Request samples

Content type
application/json
{
  • "type": "video",
  • "address": "rtsp://localhost:554/axis-media/media.amp",
  • "rate": 25,
  • "timeout": -1
}

Response samples

Content type
application/json
{
  • "id": 0,
  • "type": "video",
  • "address": "rtsp://localhost:554/axis-media/media.amp",
  • "rate": 25,
  • "timeout": -1,
  • "proxy": true
}

Fetch a Sources information

Retrieve all of the information about a Source (by ID) in the Configuration.

path Parameters
id
required
integer <int32> (id) >= 0

The ID of the Source.

Responses

Response samples

Content type
application/json
{
  • "type": "video",
  • "address": "rtsp://localhost:554/axis-media/media.amp",
  • "rate": 25,
  • "timeout": -1,
  • "proxy": true
}

Update a Source

Update a Source (by ID) in the Configuration.

path Parameters
id
required
integer <int32> (id) >= 0

The ID of the Source.

header Parameters
object
Examples:
  • return=minimal - Request minimal response (ID only)
  • return=representation - Request full representational response

The preferred response (minimal or full)

Request Body schema: application/json

The Source's information.

type
required
string (schemas)
Enum: "video" "file" "youtube" "zmqinternal" "zmq" "inf"
required
string or object (address)
rate
required
number <float> (schemas) [0 .. 0]
timeout
number <float> (schemas)
Default: -1

If source is disconnected, then try to reconnect for the specified number of minutes; -1 is try indefinitely.

proxy
boolean (schemas)
Default: true

Responses

Request samples

Content type
application/json
{
  • "type": "file",
  • "address": "input.mp4",
  • "rate": 30,
  • "proxy": false
}

Response samples

Content type
application/json
{
  • "type": "file",
  • "address": "input.mp4",
  • "rate": 30,
  • "timeout": -1,
  • "proxy": false
}

Modify a Source

Modify a Source (by ID) in the Configuration.
JSON merge patch (RFC7386) is used to apply the modifications to the Source's information.

path Parameters
id
required
integer <int32> (id) >= 0

The ID of the Source.

header Parameters
object
Examples:
  • return=minimal - Request minimal response (ID only)
  • return=representation - Request full representational response

The preferred response (minimal or full)

Request Body schema: application/merge-patch+json

The Source's information

type
string (schemas)
Enum: "video" "file" "youtube" "zmqinternal" "zmq" "inf"
string or object (address)
rate
number <float> (schemas) [0 .. 0]
timeout
number <float> (schemas)
Default: -1

If source is disconnected, then try to reconnect for the specified number of minutes; -1 is try indefinitely.

proxy
boolean (schemas)
Default: true

Responses

Request samples

Content type
application/merge-patch+json
{
  • "type": "file",
  • "address": "input.mp4"
}

Response samples

Content type
application/json
{
  • "type": "file",
  • "address": "input.mp4",
  • "rate": 25,
  • "timeout": -1,
  • "proxy": true
}

Delete a Source

Delete a Source (by ID) in the Configuration.

path Parameters
id
required
integer <int32> (id) >= 0

The ID of the Source.

query Parameters
force
boolean
Default: false

Whether to force deletion of the Source even if it is being referenced by a Pipeline. If true, the Source will be automatically removed from any Pipelines that reference it.

Responses

Response samples

Content type
application/json
{
  • "pipelines": [
    ]
}

Sink

A Sink takes data from a Pipeline and pushes it out. Apart from the WebSocket API, which is always active and can be found here, other Sinks such has ZMQ sockets or file can be created.

Fetch all Sinks

Retrieve all Sinks in the Configuration.

Responses

Response samples

Content type
application/json
{
  • "0": {
    },
  • "1": {
    }
}

Create a Sink

Create a Sink in the Configuration.

header Parameters
object
Examples:
  • return=minimal - Request minimal response (ID only)
  • return=representation - Request full representational response

The preferred response (minimal or full)

Request Body schema: application/json

The Sink.

type
required
string (schemas)
Enum: "video" "zmq" "zmqinternal" "inf"
address
required
string <url> (schemas)
"*" (string) or integer or Array of integers (filter)

Responses

Request samples

Content type
application/json
{
  • "type": "video",
  • "address": "output.mp4"
}

Response samples

Content type
application/json
{
  • "id": 0,
  • "type": "video",
  • "address": "output.mp4",
  • "filter": "*"
}

Fetch a Sinks information

Retrieve all of the information about a Sink (by ID) in the Configuration.

path Parameters
id
required
integer <int32> (sink_id) >= 0

The ID of the Sink.

Responses

Response samples

Content type
application/json
{
  • "type": "zmq",
  • "address": "tcp://*:22952",
  • "filter": "*"
}

Update a Sink

Update a Sink (by ID) in the Configuration.

path Parameters
id
required
integer <int32> (sink_id) >= 0

The ID of the Sink.

header Parameters
object
Examples:
  • return=minimal - Request minimal response (ID only)
  • return=representation - Request full representational response

The preferred response (minimal or full)

Request Body schema: application/json

The Sink's information.

type
required
string (schemas)
Enum: "video" "zmq" "zmqinternal" "inf"
address
required
string <url> (schemas)
"*" (string) or integer or Array of integers (filter)

Responses

Request samples

Content type
application/json
{
  • "type": "video",
  • "address": "output.mp4",
  • "filter": 1
}

Response samples

Content type
application/json
{
  • "type": "video",
  • "address": "output.mp4",
  • "filter": 1
}

Modify a Sink

Modify a Sink (by ID) in the Configuration.
JSON merge patch (RFC7386) is used to apply the modifications to the Sink's information.

path Parameters
id
required
integer <int32> (sink_id) >= 0

The ID of the Sink.

header Parameters
object
Examples:
  • return=minimal - Request minimal response (ID only)
  • return=representation - Request full representational response

The preferred response (minimal or full)

Request Body schema: application/merge-patch+json

The Sink's information.

type
string (schemas)
Enum: "video" "zmq" "zmqinternal" "inf"
address
string <url> (schemas)
"*" (string) or integer or Array of integers (filter)

Responses

Request samples

Content type
application/merge-patch+json
{
  • "type": "video",
  • "address": "output.mp4"
}

Response samples

Content type
application/json
{
  • "type": "video",
  • "address": "output.mp4",
  • "filter": "*"
}

Delete a Sink

Delete a Sink (by ID) in the Configuration.

path Parameters
id
required
integer <int32> (sink_id) >= 0

The ID of the Sink.

query Parameters
force
boolean
Default: false

Whether to force deletion of the Sink even if it is being referenced by a Pipeline. If true, the Sink will be automatically removed from any Pipelines that reference it.

Responses

Response samples

Content type
application/json
{
  • "pipelines": [
    ]
}

Pipeline

A Pipeline is a list elements or operations that perform the desired analytics task. Pipelines can be constructed for a number of different elements that execute Deep Learning, Machine Learning, OpenCV-based functions or custom algorithms.

Fetch all Pipelines

Retrieve all Pipelines in the Configuration.

Responses

Response samples

Content type
application/json
{
  • "0": {
    }
}

Create a Pipeline

Create a Pipeline in the Configuration.

header Parameters
object
Examples:
  • return=minimal - Request minimal response (ID only)
  • return=representation - Request full representational response

The preferred response (minimal or full)

Request Body schema: application/json

The Pipeline.

required
Array of strings or objects (schemas) non-empty

Sequence of processing stages

sources
Array of integers <int32> (schemas)

IDs of input sources to the pipeline

sinks
Array of integers <int32> (schemas)

IDs of output sinks from the pipeline

Responses

Request samples

Content type
application/json
{
  • "elements": [
    ],
  • "sources": [
    ],
  • "sinks": [
    ]
}

Response samples

Content type
application/json
{
  • "id": 0,
  • "elements": [
    ],
  • "sources": [
    ],
  • "sinks": [
    ]
}

Fetch a Pipelines information

Get information about a Pipeline (by ID) in the Configuration.

path Parameters
id
required
integer <int32> (pipeline_id) >= 0

The ID of the Pipeline.

Responses

Response samples

Content type
application/json
{
  • "elements": [
    ],
  • "sources": [
    ],
  • "sinks": [
    ]
}

Update a Pipeline

Update a Pipeline (by ID) in the Configuration.

path Parameters
id
required
integer <int32> (pipeline_id) >= 0

The ID of the Pipeline.

header Parameters
object
Examples:
  • return=minimal - Request minimal response (ID only)
  • return=representation - Request full representational response

The preferred response (minimal or full)

Request Body schema: application/json

The Pipeline information.

required
Array of strings or objects (schemas) non-empty

Sequence of processing stages

sources
Array of integers <int32> (schemas)

IDs of input sources to the pipeline

sinks
Array of integers <int32> (schemas)

IDs of output sinks from the pipeline

Responses

Request samples

Content type
application/json
{
  • "elements": [
    ],
  • "sources": [
    ],
  • "sinks": [
    ]
}

Response samples

Content type
application/json
{
  • "elements": [
    ],
  • "sources": [
    ],
  • "sinks": [
    ]
}

Modify a Pipeline

Modify a Pipeline (by ID) in the Configuration.

path Parameters
id
required
integer <int32> (pipeline_id) >= 0

The ID of the Pipeline.

header Parameters
object
Examples:
  • return=minimal - Request minimal response (ID only)
  • return=representation - Request full representational response

The preferred response (minimal or full)

Request Body schema: application/merge-patch+json

The Pipeline information.

Array of strings or objects (schemas) non-empty

Sequence of processing stages

sources
Array of integers <int32> (schemas)

IDs of input sources to the pipeline

sinks
Array of integers <int32> (schemas)

IDs of output sinks from the pipeline

Responses

Request samples

Content type
application/merge-patch+json
{
  • "elements": [
    ],
  • "sinks": [
    ]
}

Response samples

Content type
application/json
{
  • "elements": [
    ],
  • "sources": [
    ],
  • "sinks": [
    ]
}

Delete a pipeline

Delete a Pipeline (by ID) in the Configuration.

path Parameters
id
required
integer <int32> (pipeline_id) >= 0

The ID of the Pipeline.

Responses

Add Sources to Pipeline

Assign Sources as input to a Pipeline (by ID) in the Configuration.

path Parameters
id
required
integer <int32> (pipeline_id) >= 0

The ID of the Pipeline.

Request Body schema: application/json

The Sources to add.

Array ()
integer <int32> (id) >= 0

Source ID

Responses

Request samples

Content type
application/json
[
  • 0,
  • 1,
  • 2
]

Remove Source from Pipeline

Unassign Sources from a Pipeline (by ID) in the Configuration.

path Parameters
id
required
integer <int32> (pipeline_id) >= 0

The ID of the Pipeline.

Request Body schema: application/json

The Sources to remove.

Array ()
integer <int32> (id) >= 0

Source ID

Responses

Request samples

Content type
application/json
[
  • 1,
  • 2
]

Add Sinks to a Pipeline

Assign Sinks as output to a Pipeline (by ID) in the Configuration.

path Parameters
id
required
integer <int32> (pipeline_id) >= 0

The ID of the Pipeline.

Request Body schema: application/json

The Sinks to add.

Array ()
integer <int32> (sink_id) >= 0

Sink ID

Responses

Request samples

Content type
application/json
[
  • 1,
  • 2
]

Remove Sinks from Pipeline

Unassign Sinks from a Pipeline (by ID) in the Configuration.

path Parameters
id
required
integer <int32> (pipeline_id) >= 0

The ID of the Pipeline.

Request Body schema: application/json

The Sinks to remove.

Array ()
integer <int32> (sink_id) >= 0

Sink ID

Responses

Request samples

Content type
application/json
[
  • 2
]

Exports

Exports allow you to inspect Channel properties such as its current Configuration, processing rate (FPS), and latency.

Fetch Channels and Streams

Retrieve the Channels and Streams from the Configuration.

Responses

Response samples

Content type
application/json
{
  • "streams": {
    },
  • "channels": {
    }
}

Fetch a Channel's static metadata

Retrieve the Channel's static metadata Configuration.

path Parameters
id
required
number <int32> (channel_id) >= 0

The ID of the Channel.

query Parameters
format
string (formatter)
Default: "megh"
Enum: "aws" "megh"

The formatter to use to output the static metadata.

Responses

Response samples

Content type
application/json
Example
{
  • "name": "fire-detection"
}

Fetch a Channel's FPS

Retrieve the estimated processing frame rate of the Channel (measured in frames per second).

path Parameters
id
required
number <int32> (channel_id) >= 0

The ID of the Channel.

Responses

Response samples

Content type
{
  • "fps": 24.98
}

Fetch a Channel's latency

Retrieve the estimated end-to-end processing latency of the Channel (measured in milliseconds).

path Parameters
id
required
number <int32> (channel_id) >= 0

The ID of the Channel.

Responses

Response samples

Content type
{
  • "latency": 134.1
}

Fetch all Channel properties

Retrieve the properties of all Channels.

query Parameters
ids
Array of numbers <int32> (channel_id)

The Channel IDs to query.

props
Array of strings
Items Enum: "pipeline" "usecase" "fps" "latency"

The requested properties for each Channel.

Responses

Response samples

Content type
application/json
{
  • "0": {
    },
  • "1": {
    }
}

Statistics

Statistics allows you to inspect Nimble's system-level details such as current CPU and Memory load.

Fetch all statistics

Retrieve all performance statistics of Nimble.

Responses

Response samples

Content type
application/json
{
  • "cpu": 7.92,
  • "memory": {
    }
}

Fetch CPU usage

Retrieve estimated CPU usage of Nimble over the last minute (measured in virtual cores).

Responses

Response samples

Content type
{
  • "cpu": 7.92
}

Fetch memory usage

Retrieve estimated memory usage of Nimble (measured in bytes).

Responses

Response samples

Content type
application/json
{
  • "memory": {
    }
}

About

General information about Nimble.

Fetch all information

Retrieve all general information about Nimble.

Responses

Response samples

Content type
application/json
{
  • "version": "0.11"
}

Fetch version

Fetch the version of Nimble.

Responses

Response samples

Content type
application/json
{
  • "version": "0.11"
}