Connection Manager API Calls

Endpoint: /v1/api/getconnectionstatus

This is through the process of calling the /v1/api/getconnectionstatus endpoint provided by the Connection Manager micro-service.

This endpoint allows clients to check the connection status of a device by providing its unique SID64 identifier.

Prerequisites

Before proceeding, ensure you have the following:

  • A valid BZID for authorization.

  • The SID64 identifier of the device whose connection status you wish to check.

Setting Up the Request

To call the /v1/api/getconnectionstatus endpoint, you need to send a POST request with specific headers and a JSON body.

Below is a batch script example that demonstrates how to make this call using curl.

This script is suitable for execution in a Bash environment.

#!/bin/bash SID64="11026340408483867967" # Replace with your device's SID64 BASE_URL="https://bztest.bluzone.io" BZID="XYZ" # Replace with your BZID curl -X POST \ --header "Authorization: $BZID" \ --header 'Content-Type: application/json' \ --data "{\"sid64\": \"$SID64\"}" \ --url $BASE_URL/connection-manager/v1/api/getconnectionstatus

 

Fields in the request:

  • Authorization Header: Replace "XYZ" with your actual BZID for proper authorization.

  • Content-Type Header: Indicates that the request body is JSON.

  • sid64 in the JSON Body: Replace the placeholder with the SID64 identifier of the device.

Understanding the Response

Upon successful execution of the request, the Connection Manager service will return a JSON response containing the connection status of the specified device.

Here's an example of a formatted response:

{ "connectionStatus": { "projectId": "101442", "sid64": "11026340408483867967", "deviceId": "391509", "locationId": "28236", "status": 1, "statusText": "Connected", "lastSeen": "1712343847", "host": "", "sessionId": "" } }

Fields in the Response:

  • projectId: The project ID associated with the device.

  • sid64: The SID64 identifier of the device.

  • deviceId: The device ID within the Connection Manager system.

  • locationId: The location ID associated with the device's last known location.

  • status: A numeric code representing the connection status (e.g., 0 => disconnected, 1 => connected, 2 => unknown).

  • statusText: A textual representation of the connection status (e.g., "Connected").

  • lastSeen: A timestamp indicating the last time the device was seen.

  • host: The host name of the device (if available).

  • sessionId: The session ID associated with the device's connection (if applicable).