Skip to main content

Stream status API

Description

The Stream status API makes it possible to list streams on a device.

Model

The API implements streamstatus.cgi as its communications interface and supports the following methods:

MethodDescription
getAllStreamsLists all running streams on a device.
getSupportedVersionsRetrieves a list of supported API versions.

Identification

  • API Discovery: id=streamstatus

Limitations

  • Currently, the API can only handle RTSP streams.
  • If there is something wrong with the information of a stream, that stream will be excluded from the 200 OK response of the CGI. Additionally an error print will be printed to the syslog.

Use cases

List all running streams on a device

  1. Request all running streams.

  2. Parse the JSON response that contains all running streams on the device.

See getAllStreams

API specification

getAllStreams

Use this method to list all running streams on a device.

Request

  • Security level:
    • DigestAuth: Admin
    • BasicAuth: Admin
  • Method: POST
http://<servername>/axis-cgi/streamstatus.cgi

Request body syntax

{
"apiVersion": "1.0",
"context": "my context",
"method": "getAllStreams"
}
ParameterDescription
apiVersionThe requested API version in the format "Major.Minor".
context=<string>The user sets this value and the application echoes it back in the response (optional).
method="getAllStreams"The method that should be used.

Return value - Success

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "1.0",
"context": "my context",
"method": "getAllStreams",
"data": {
"streams": [
{
"destination_address": "192.168.0.1",
"destination_port": 32986,
"direction": "outgoing",
"encrypted": false,
"id": 11,
"media": "video",
"mime": "video/x-h264",
"multicast": false,
"options": {
"audio": "0",
"video": "1"
},
"path": "/axis-media/media.amp",
"source_address": "192.168.0.141",
"source_port": 50000,
"state": "playing",
"stream_protocol": "RTP",
"transport_protocol": "UDP",
"user_agent": "GStreamer/1.22.0"
}
]
}
}
ParameterData typeDescription
apiVersionstringThe requested API version in the format "Major.Minor".
contextstringThe user sets this value and the application echoes it back in the response (optional).
methodstringThe method that should be used.
dataobjectContainer for streams.
streamsarrayArray of streams.
destination_addressstringThe IPv4 or IPv6 address of the client.
destination_portintegerThe port of the client.
directionstringDirection of the stream. Enum values: incoming, outgoing
encryptedbooleanIndicates whether the stream is encrypted or not.
idintegerThe ID of the stream. It should be one or greater than one.
mediastringThe media type. Enum values: audio, metadata, video
mimestringThe MIME type. Enum values: audio/mpeg, application/x-onvif-metadata+xml, video/x-h264, audio/x-opus, audio/x-adpcm, audio/x-mulaw, audio/x-raw, image/jpeg, video/x-h265
multicastbooleanOptional. Indicates whether the stream uses multicast or not.
optionsobjectContainer for URL options in a stream request. See Public parameter description and Parameter specification RTSP URL.
pathstringThe server path.
source_addressstringThe IPv4 or IPv6 address of the server.
source_portintegerThe port of the server.
statestringThe current state of the streaming pipeline. Enum values: paused, playing
stream_protocolstringThe stream protocol that is used.
transport_protocolstringThe transport protocol that is used. Enum values: TCP, UDP
user_agentstringInformation about the client.

Return value - Error

  • HTTP Code: 400, 401, 403, 405, 411, 413, 500
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "1.0",
"context": "my context",
"method": "getAllStreams",
"error": {
"code": <integer>,
"message": <string>
}
}
ErrorCodeDescription
Invalid JSON2101The request is not in valid Json format.
Method not supported2102The method in the request is not supported.
Required parameter missing2103Some required parameters are missing in the request.
Invalid parameter value specified2104Some parameters have an invalid value.
Authentication failed2106Couldn't authenticate.
Transport level error2107There is an error on the transport level.
Internal error1100There is an internal error.

getSupportedVersions

The API method can be used to retrieve a list of available supported API versions.

Request

  • Security level:
    • DigestAuth: Admin
    • BasicAuth: Admin
  • Method: POST
http://<servername>/axis-cgi/streamstatus.cgi

Request body syntax

{
"apiVersion": "1.0",
"context": "my context",
"method": "getSupportedVersions"
}
ParameterDescription
apiVersionThe requested API version in the format "Major.Minor".
context=<string>The user sets this value and the application echoes it back in the response (optional).
method="getSupportedVersions"The method that should be used.

Return value - Success

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "1.0",
"context": "my context",
"method": "getSupportedVersions",
"data": {
"apiVersions": [
"<Major1>.<Minor1>",
"<Major2>.<Minor2>"
]
}
}
ParameterDescription
apiVersionThe requested API version in the format "Major.Minor".
context=<string>The user sets this value and the application echoes it back in the response (optional).
method="getSupportedVersions"The method that should be used.
apiVersions=<list of versions>Lists all supported major versions along with their highest supported minor version. e.g. ["1.4", "2.5"].

Return value - Error

  • HTTP Code: 400, 401, 403, 405, 411, 413, 500
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "1.0",
"context": "my context",
"method": "getSupportedVersions",
"error": {
"code": <integer>,
"message": <string>
}
}
ErrorCodeDescription
API version not supported2100The API version is not supported.
Invalid JSON2101The request is not in valid Json format.
Method not supported2102The method in the request is not supported.
Required parameter missing2103Some required parameters are missing in the request.
Invalid parameter value specified2104Some parameters have an invalid value.
Authorization failed2105Authorization failure.
Authentication failed2106Authentication failure.
Transport level error2107There is an error on the transport level.
Internal error1100There is an internal error.