JFrog Connect REST API – Monitor device status

When it comes to managing edge Linux devices, one of the key points is to make sure that the devices are up and running. For example, when deploying an IoT app which connects many endpoints together, it can be extremely useful if there was a way to easily fetch a particular device’s online/offline status; preferably through a simple API call.

In this guide, we will be taking a look at JFrog Connect’s device online status API call, which is an HTTP GET request, which the posting payload should be in the form of JSON array.

For simplicity, the script is written in Python and the prerequisite modules are json and requests. These are by default installed with every Python installation, and the scripts are cross-platform compatible.

Step 1 – Obtain the User Token

The user token can be found in the Settings section in the JFrog Connect dashboard, by clicking on Show Account Token. This token is unique to your account and cannot be changed.

Step 2 – Obtaining the Device ID

The Device ID is needed to obtain the device online status, and it can be found in the devices section. Each device is given a unique device ID after enrollment with the platform.

Step 3 – Python script template for fetching device status

Following the official documentation for the API, the following Python script template can then be used to obtain device status from the dashboard.

Create a new file using nano <filename>.py and type in the script, and update the details accordingly. Then, press Ctrl+O and press Enter to confirm save.

Step 4 – Execute the script and verify the functionality

Type in the command python <filename>.py (which was used to name the script in Step 3), and press Enter. (in the following example, the file has been saved as upswift_device_status.py)

Upon successful completion of the script, the above output should be displayed. If any error occurred, the script will print out the error message for further debugging.

For more information on the JFrog Connect Change Device Details API, refer to the official documentation.

JFrog Connect is a Software Supply Chain Last Mile IoT platform designed to efficiently update, control and monitor edge and IoT devices at scale.