Besides Rest APIs, we also offer a Websocket API for Realtime data exchange.
The Websocket connection requires the same authentication token as the Rest APIs. If you are unsure how to obtain the token, please read first the HTTP Rest documentation.
The API KEY
must be passed to the connection url as a query param:
<connection_url>?authorization={api_token}
In case you are using the access token
, the Bearer scheme must be used but url encoded:
wss://<connection_url>/socket?authorization=Bearer%20abc123
Here is a code snippet Typescript:
let auth_str = 'Bearer ' + getToken()
this.socket = new WebsocketBuilder(
WEBSOCKET_URL +
'?' +
new URLSearchParams({
authorization: auth_str
}).toString()
To start a new recording, you need to send a startNewRecording
message:
{
"version": 1,
"platform": "API",
"action":"startNewRecording",
"deviceId": "AA-AA-AA-AA-AA",
"deviceTs": 1722418084887
}
version
: represents the current api version you are using. This is to ensure backwards compatibility.
platform
: should always be “API”. It is used for tracking
action
: the action you want to perform
deviceId
: the device ID. This is return by the GET api/user-info
Rest api
deviceTs
: the current timestamp in epoch milliseconds
To confirm the successful start of a recording you will receive the following Recording Status Update message:
{
"idunId":"7389b26b-f357-47cf-8efe-ae8df90a6a36",
"deviceId": "AA-AA-AA-AA-AA",
"action": "recordingUpdate",
"recordingId": "1722418084887",
"status": "NOT_STARTED|ONGOING|PROCESSING|COMPLETED|FAILED",
"timestamp": 1722418084887
}