Media

Recorded video access and remote playback. Captures keep a copy of the next playback of a channel so it can be reviewed or archived later.

The Recording Model

A recorded audio/video resource reported by a device (JT/T 1078 0x1205)

Scheme

  • Name
    channel
    Type
    integer
    Description
    Logical channel number (1-31)
  • Name
    startTime
    Type
    string <date-time>
    Description
    Recording start time
  • Name
    endTime
    Type
    string <date-time>
    Description
    Recording end time
  • Name
    alarmFlag
    Type
    integer
    Description
    Alarm flags associated with the recording
  • Name
    type
    Type
    integer
    Description
    0: audio and video, 1: audio, 2: video
  • Name
    streamType
    Type
    integer
    Description
    1: main stream, 2: sub-stream
  • Name
    memoryType
    Type
    integer
    Description
    1: primary memory, 2: backup memory
  • Name
    size
    Type
    integer
    Description
    File size in bytes

The Playback Capture Model

A recording being written to a file on the server as the device plays it back

Scheme

  • Name
    id
    Type
    string
    Description
    Identifier used to poll this capture
  • Name
    deviceId
    Type
    integer
    Description
  • Name
    channel
    Type
    integer
    Description
  • Name
    fileName
    Type
    string
    Description
  • Name
    url
    Type
    string
    Description
    Where the file can be fetched once the capture is complete
  • Name
    startedAt
    Type
    string <date-time>
    Description
  • Name
    completedAt
    Type
    string <date-time>
    Description
  • Name
    status
    Type
    string
    Description
    RECORDING: the device is still streaming, or has not started yet. COMPLETE: the stream ended and the file is complete. FAILED: the stream never started, or ended without producing anything
  • Name
    size
    Type
    integer
    Description
    Bytes written so far

GET/recordings/{deviceId}

Fetch the most recent recording list reported by a Device

Returns the recording list from the device's latest response to a videoPlaybackList command (JT/T 1078 0x1205). The device answers out of band, so dispatch videoPlaybackList via /commands/send first and then poll this endpoint. Returns an empty array until a response arrives.

Authorizations

BasicAuth or ApiKey

  • Name
    BasicAuth
    Type
    scheme
    Description
    HTTP Authorization Scheme: basic
  • Name
    ApiKey
    Type
    scheme
    Description
    HTTP Authorization Scheme: bearer

Path parameters

  • Name
    deviceId
    Type
    integer required
    Description

Response schema

  • Name
    application/json
    Type
    schema
    Description

Responses

  • Name
    200
    Type
    success
    Description
    Recording
  • Name
    401
    Type
    error
    Description
    Unauthorized

Request

GET
/recordings/{deviceId}
curl --location 'https://gw.onemap8.com/api/recordings/<integer>' \
--header 'Accept: application/json' \
--header 'Authorization: Basic {your_access_token}'

Response

[
{
  "channel": 0,
  "startTime": "<date-time>",
  "endTime": "<date-time>",
  "alarmFlag": 0,
  "type": 0,
  "streamType": 0,
  "memoryType": 0,
  "size": 0
}
]

GET/captures

Fetch the captures made for a Device

Captures made since the server last started, newest first. Captures are not persisted across a restart, though the files they produced are.

Authorizations

BasicAuth or ApiKey

  • Name
    BasicAuth
    Type
    scheme
    Description
    HTTP Authorization Scheme: basic
  • Name
    ApiKey
    Type
    scheme
    Description
    HTTP Authorization Scheme: bearer

Query Parameters

  • Name
    deviceId
    Type
    integer required
    Description

Response schema

  • Name
    application/json
    Type
    schema
    Description

Responses

  • Name
    200
    Type
    success
    Description
    PlaybackCapture
  • Name
    401
    Type
    error
    Description
    Unauthorized

Request

GET
/captures
curl --location 'https://gw.onemap8.com/api/captures?deviceId=<integer>' \
--header 'Accept: application/json' \
--header 'Authorization: Basic {your_access_token}'

Response

[
{
  "id": "<string>",
  "deviceId": 0,
  "channel": 0,
  "fileName": "<string>",
  "url": "<string>",
  "startedAt": "<date-time>",
  "completedAt": "<date-time>",
  "status": "RECORDING",
  "size": 0
}
]

POST/captures

Keep a copy of the next playback of a channel

A device does not serve its recordings as files: the only way to read one is to ask it to play the recording back and to write the stream down as it arrives. This arms a capture that does exactly that, and the file is at the returned url once its status is COMPLETE.

Arm the capture first and dispatch videoPlayback via /commands/send immediately afterwards, in that order. The device can begin streaming as soon as it accepts the request, and anything that arrives before the capture exists is not kept. A capture takes as long as the recording lasts, so poll /captures/{id} rather than waiting on it.

Authorizations

BasicAuth or ApiKey

  • Name
    BasicAuth
    Type
    scheme
    Description
    HTTP Authorization Scheme: basic
  • Name
    ApiKey
    Type
    scheme
    Description
    HTTP Authorization Scheme: bearer

Query Parameters

  • Name
    deviceId
    Type
    integer required
    Description
  • Name
    channel
    Type
    integer required
    Description
    Logical channel number

Response schema

  • Name
    application/json
    Type
    schema
    Description

Responses

  • Name
    200
    Type
    success
    Description
    PlaybackCapture
  • Name
    401
    Type
    error
    Description
    Unauthorized
  • Name
    404
    Type
    error
    Description
    Device not found

Request

POST
/captures
curl --location --request POST 'https://gw.onemap8.com/api/captures?deviceId=<integer>&channel=<integer>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic {your_access_token}'

Response

{
"id": "<string>",
"deviceId": 0,
"channel": 0,
"fileName": "<string>",
"url": "<string>",
"startedAt": "<date-time>",
"completedAt": "<date-time>",
"status": "RECORDING",
"size": 0
}

GET/captures/{id}

Fetch the progress of a capture

Poll until status is no longer RECORDING. size is what shows a capture is progressing rather than stalled.

Authorizations

BasicAuth or ApiKey

  • Name
    BasicAuth
    Type
    scheme
    Description
    HTTP Authorization Scheme: basic
  • Name
    ApiKey
    Type
    scheme
    Description
    HTTP Authorization Scheme: bearer

Path parameters

  • Name
    id
    Type
    string required
    Description

Response schema

  • Name
    application/json
    Type
    schema
    Description

Responses

  • Name
    200
    Type
    success
    Description
    PlaybackCapture
  • Name
    401
    Type
    error
    Description
    Unauthorized
  • Name
    404
    Type
    error
    Description
    Capture not found

Request

GET
/captures/{id}
curl --location 'https://gw.onemap8.com/api/captures/<string>' \
--header 'Accept: application/json' \
--header 'Authorization: Basic {your_access_token}'

Response

{
"id": "<string>",
"deviceId": 0,
"channel": 0,
"fileName": "<string>",
"url": "<string>",
"startedAt": "<date-time>",
"completedAt": "<date-time>",
"status": "RECORDING",
"size": 0
}

DELETE/captures/{id}

Complete a capture early

Ends the capture where it stands and keeps whatever has arrived. A device that never closes the playback connection would otherwise leave the capture open until it times out.

Authorizations

BasicAuth or ApiKey

  • Name
    BasicAuth
    Type
    scheme
    Description
    HTTP Authorization Scheme: basic
  • Name
    ApiKey
    Type
    scheme
    Description
    HTTP Authorization Scheme: bearer

Path parameters

  • Name
    id
    Type
    string required
    Description

Response schema

  • Name
    application/json
    Type
    schema
    Description

Responses

  • Name
    200
    Type
    success
    Description
    PlaybackCapture
  • Name
    401
    Type
    error
    Description
    Unauthorized
  • Name
    404
    Type
    error
    Description
    Capture not found

Request

DELETE
/captures/{id}
curl --location --request DELETE 'https://gw.onemap8.com/api/captures/<string>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic {your_access_token}'

Response

{
"id": "<string>",
"deviceId": 0,
"channel": 0,
"fileName": "<string>",
"url": "<string>",
"startedAt": "<date-time>",
"completedAt": "<date-time>",
"status": "RECORDING",
"size": 0
}