Device state

Device state

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

Using this call you will get the current device state - Online or Offline.

Request Body

NameTypeDescription

user_token

string

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

device_token

string

This is the device token .

{"message": {"device_status": "online",
            {"device_id": 123456}}

Example

import json
import requests

json_content = {'device_id': 12345678,
                'user_token': 'YYYYYYYYYYYYYYY'}

call_request = requests.get("https://api.upswift.io/v1/get_device_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:
    device_status = call_response["message"]["device_status"]
    device_id = call_response["message"]["device_id"]

Last updated