GET /app/devices/{device_id}

URL requires a body with the following format (Items in bold are required):

Body:

No body as this endpoint uses GET requests

Response:

{
  "companyId": "string",
  "companyName": "string",
  "boardName": "string",
  "pcbSn": "string",
  "pcbMn": "string",
  "group": "string"
}

Code Example

Python example to get list of Device IDs

#!/usr/bin/python3

# Get_Device_Info.py
#
# Retrieve device information through EDG's API
# This example is built on top of the API Login example
# This example is built on top of the API Device ID's example
#
# Copyright (c) 2021-2023 Engineering Design Group, LLC. All Rights Reserved.
#
# <variable_name> represents value specific to user

import requests
import json

#Need an access token to access this API endpoint
import Get_app_token
import Get_Device_ID

#returns the device info for whichever device ID the user provides
def getDeviceInfo(accessToken = "", deviceID = ""):

    #retrieve access token if user does not provide one
    if accessToken == "":
        accessToken = Get_app_token.getToken(<client_username>, 
																						 <client_password>,
																						 <client_id>)
    #get a list of all device ID's if user does not provide one
    if deviceID == "":
        deviceID = Get_Device_ID.getDeviceId(accessToken)

    # User selects which device to retrieve information for
    if isinstance(deviceID, list):
        print("\\nDevice list: ")
        for i in range(len(deviceID)):
            print("Device #%d: %s" %(i, deviceID[i]))
        deviceNo = int(input("Select which device number to use: "))
        deviceID = deviceID[deviceNo]

    #generate URL for POST request
    baseUrl = <API_URL>
    endpointAddress = "/app/devices"
    deviceIdUrl = baseUrl + endpointAddress + "/" + deviceID

    #create authorized header to send to API
    authHeader={
        "Authorization": "Bearer " + accessToken,
        "Content-Type": "application/json"
         }

    response = requests.get(deviceIdUrl,
                            headers = authHeader,
                            verify = True)

    print("Device info: ", response)

    return response.json()

def main():
    print("Pulling device info...")

    #user can provide a signle device ID or a list of device IDs to getDeviceInfo()
    device_info = getDeviceInfo(<device_id>)
    #deisplay list of all retrieved device deviceInfo
    print("\\nDevice information: ", device_info)

if __name__ == "__main__":
    main()

{ "count": *number of devices, "devicelist": [ *list of device ID Strings ] }