Get devices details

Devices details

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

Using this call you will get all details of your devices. You can choose to get details of all devices or all devices in a specific project/group or get the details of just a single device.

Request Body

{"message": [
            {"device_id": 123456,
             "device_name": "My-Device-1",
             "upswift_version": "5.1",
             "project": "Test",
             "group": "Production",
             "device_ip": "10.10.10.10",
             "last_keepalive": "2020-02-08 16:12:11",
             "cpu_usage": 65,
             "ram_usage": 15,
             "disk_usage": 1022.1,
             "address": "Nurenberg, Germany",
             "lat": 49.4521,
             "lng": 11.0767,
             "is_update_trigger_set": false,
             "description": "device description example",
             "registered_date": "2020-02-07 16:12:11",
             "tags": ["London", "Lab Device", "4inch-screen"],
             "updates": [
                         {"update_id": 1234,
                         "update_status": "success",
                         "update_version": "v1.1",
                         "comment": "Some kind of a comment",
                         "deployment_schedule_time": "2020-02-08 16:12:11"
                         },
                         {
                         update_id": 5555,
                         "update_status": "pending",
                         "update_version": "v1.2",
                         "comment": "Some kind of a comment",
                         "deployment_schedule_time": "2020-03-09 19:12:11"
                         }
                         ],
             "updates_v2": [
                         {"flow_name": "Some Name",
                         "update_status": "success",
                         "comment": "Some kind of a comment",
                         "deployment_schedule_time": "2020-02-08 16:12:11",
                         "apps_updates": [{"app_name": "app1", "app_new_version": "v1.1"}],
                         "deployment_type": "manual"
                         },
                         {
                         "flow_name": "Some Name2",
                         "update_status": "failed",
                         "comment": "Some kind of a comment",
                         "deployment_schedule_time": "2020-02-08 16:12:11",
                         "apps_updates": [{"app_name": "app1", "app_new_version": "v1.1"}],
                         "deployment_type": "api-deployment"
                         }
                         ],
             "apps": [{"app_name": "default_app", 
                       "version": "v1.1"}],
             }
             ]
 }

If no parameters are set, all devices of that user will be returned.

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/devices_details", 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_name = device["device_name"]
        device_id = device["device_id"]
        upswift_version = device["upswift_version"]
        project = device["project"]
        group = device["group"]
        device_ip = device["device_ip"]
        last_keepalive = device["last_keepalive"]
        cpu_usage = device["cpu_usage"]
        ram_usage = device["ram_usage"]
        address = device["address"]
        lat = device["lat"]
        lng = device["lng"]
        is_update_trigger_set = device["is_update_trigger_set"]
        description = device["description"]
        registered_date = device["registered_date"]
        updates = device["updates"]
        tags = device["tags"]
        updates = device["updates_v2"]
        apps = device["apps"]

Last updated