cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
323
Views
0
Helpful
1
Replies

Device API Not Returning All Devices

dmillington
Level 1
Level 1

Hi all, 

I'm writing a simple script to query all devices of type "roomdesk'. The query works except it isn't returning all devices. I'm new to the API so I assume I missing something simple. Any thoughts would be appreciated!

 

============================================

import requests

headers = {
    "Authorization": "Bearer usingMyActualToken",
    "Content-Type": "application/json"
}


response = requests.get(url, headers=headers)

if response.status_code == 200:
    devices = response.json()["items"]

    new_list = [device for device in devices if device["type"] == "roomdesk"]
   
    for index,device in enumerate(new_list
        print('{:<10} {:<25} {:<25} {:<20}'.format(index, device["displayName"], device["product"], device["serial"]))
 
 
----------------------------------------------
 
The output is this:
 
0 BoardRoom                   Cisco Room Kit   FOCabcd1234
1 ConferenceRoom          Cisco Room Kit    FOCabcd1235
2 SmallConferenceRoom Cisco Board 55S WZSabcd1236
1 Reply 1

Janos Benyovszki
Cisco Employee
Cisco Employee

@dmillington does the access token you are using have admin scopes as described here https://developer.webex.com/docs/api/v1/devices/list-devices ? It is possible that the API is returning your devices now instead of all, because of a missing scope.