Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@ class Devices(SimpleMDMpy.SimpleMDM.Connection)
| get_custom_attribute(self, device_id, custom_attribute_name)
| get a devices custom attributes
|
| get_device(self, device_id='all', search=None, include_awaiting_enrollment=False)
| get_device(self, device_id='all', search=None, include_awaiting_enrollment=False, include_secret_custom_attributes=False)
| Returns a device specified by id. If no ID or search is
| specified all devices will be returned. Default does not include devices
| waiting for enrollment
| waiting for enrollment and does not include all custom attributes
|
| list_installed_apps(self, device_id)
| Returns a listing of the apps installed on a device.
Expand Down
19 changes: 15 additions & 4 deletions SimpleMDMpy/Devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@ def __init__(self, api_key):
SimpleMDMpy.SimpleMDM.Connection.__init__(self, api_key)
self.url = self._url("/devices")

def get_device(self, device_id="all", search=None, include_awaiting_enrollment=False):
def get_device(
self,
device_id="all",
search=None,
include_awaiting_enrollment=False,
include_secret_custom_attributes=False
):
"""
Returns a device specified by id. If no ID or search is specified all
devices will be returned.

Args:
device_id (str, optional): Returns a dictionary of the specified
device id. By default, it returns a list of all devices. If a
Expand All @@ -24,13 +30,18 @@ def get_device(self, device_id="all", search=None, include_awaiting_enrollment=F
search criteria. Defaults to None. Ignored if device_id is set.
include_awaiting_enrollment (bool, optional): Returns a list of all
devices including devices in the "awaiting_enrollment" state.

include_secret_custom_attributes (bool, optional): Returns all
custom attribute values including those marked as secret.

Returns:
dict: A single dictionary object with device information.
array: An array of dictionary objects with device information.
"""
url = self.url
params = {'include_awaiting_enrollment': include_awaiting_enrollment}
params = {
'include_awaiting_enrollment': include_awaiting_enrollment,
'include_secret_custom_attributes': include_secret_custom_attributes
}
# if a device ID is specified, then ignore any searches
if device_id != 'all':
url = url + "/" + str(device_id)
Expand Down