Bulk devices state

Bulk Devices state

GET https://api.upswift.io/v1/get_devices_state

Using this call you will get the current state - Online or Offline on a bulk of devices.

Request Body

NameTypeDescription

user_token

string

This is your account token. You can find it under the Settings category on the dashboard.

group_name

string

This is the group name of the group you would like to get all its devices state.

project_name

string

This is the project name of the project you would like to get all its devices state.

{"message": {"device_status": "online",
             "device_id": 123456,
             "device_name": "My-Device-1"}}

Example

import json
import requests
json_content = {'project_name': 'MYPROJECT',
                'group_name': 'Production'
                'user_token': 'YYYYYYYYYYYYYYY'}

call_request = requests.get("https://api.upswift.io/v1/get_devices_state", json=json_content)
call_response = json.loads(call_request.text)

if call_request.status_code != 200:
    if call_request.status_code == 429:
        error = "API limit reached"
    else:
        error = call_response["error_message"]
    print(error)
else:
    for device in call_response["message"]:
        device_status = device["device_status"]
        device_id = device["device_id"]
        device_name = device["device_name"]

Last updated