Pro API Client

class ProApi(request_method: Callable[..., requests.Response], concurrent_requests_method: Callable[..., Iterator])

Provides an interface to the Jamf Pro API.

Parameters:
  • request_method (Callable[..., requests.Response])

  • concurrent_requests_method (Callable[..., Iterator])

get_computer_inventory_v1(sections: List[str] | None = None, start_page: int = 0, end_page: int | None = None, page_size: int = 100, sort_expression: SortExpression | None = None, filter_expression: FilterExpression | None = None, return_generator: Literal[False] = False) List[Computer]
get_computer_inventory_v1(sections: List[str] | None = None, start_page: int = 0, end_page: int | None = None, page_size: int = 100, sort_expression: SortExpression | None = None, filter_expression: FilterExpression | None = None, return_generator: Literal[True] = True) Iterator[Page]

Returns a list of computer inventory records.

Parameters:
  • sections (List[str]) –

    (optional) Select which sections of the computer’s details to return. If not specific the request will default to GENERAL. If ALL is passed then all sections will be returned.

    Allowed sections:

    ALL, GENERAL, DISK_ENCRYPTION, PURCHASING, APPLICATIONS, STORAGE, USER_AND_LOCATION, CONFIGURATION_PROFILES, PRINTERS, SERVICES, HARDWARE, LOCAL_USER_ACCOUNTS, CERTIFICATES, ATTACHMENTS, PLUGINS, PACKAGE_RECEIPTS, FONTS, SECURITY, OPERATING_SYSTEM, LICENSED_SOFTWARE, IBEACONS, SOFTWARE_UPDATES, EXTENSION_ATTRIBUTES, CONTENT_CACHING, GROUP_MEMBERSHIPS

  • start_page (int) – (optional) The page to begin returning results from. See Paginator for more information.

  • end_page – (optional) The page to end returning results at. See Paginator for more information.

  • page_size (int) – (optional) The number of results to include in each requested page. See Paginator for more information.

  • sort_expression (SortExpression) –

    (optional) The sort fields to apply to the request. See the documentation for Sorting for more information.

    Allowed sort fields:

    general.name, udid, id, general.assetTag, general.jamfBinaryVersion, general.lastContactTime, general.lastEnrolledDate, general.lastCloudBackupDate, general.reportDate, general.remoteManagement.managementUsername, general.mdmCertificateExpiration, general.platform, hardware.make, hardware.model, operatingSystem.build, operatingSystem.supplementalBuildVersion, operatingSystem.rapidSecurityResponse, operatingSystem.name, operatingSystem.version, userAndLocation.realname, purchasing.lifeExpectancy, purchasing.warrantyDate

  • filter_expression (FilterExpression) –

    (optional) The filter expression to apply to the request. See the documentation for Filtering for more information.

    Allowed filter fields:

    general.name, udid, id, general.assetTag, general.barcode1, general.barcode2, general.enrolledViaAutomatedDeviceEnrollment, general.lastIpAddress, general.itunesStoreAccountActive, general.jamfBinaryVersion, general.lastContactTime, general.lastEnrolledDate, general.lastCloudBackupDate, general.reportDate, general.lastReportedIp, general.remoteManagement.managed, general.remoteManagement.managementUsername, general.mdmCapable.capable, general.mdmCertificateExpiration, general.platform, general.supervised, general.userApprovedMdm, general.declarativeDeviceManagementEnabled, hardware.bleCapable, hardware.macAddress, hardware.make, hardware.model, hardware.modelIdentifier, hardware.serialNumber, hardware.supportsIosAppInstalls,hardware.isAppleSilicon, operatingSystem.activeDirectoryStatus, operatingSystem.fileVault2Status, operatingSystem.build, operatingSystem.supplementalBuildVersion, operatingSystem.rapidSecurityResponse, operatingSystem.name, operatingSystem.version, operatingSystem.softwareUpdateDeviceId, security.activationLockEnabled, security.recoveryLockEnabled,security.firewallEnabled,userAndLocation.buildingId, userAndLocation.departmentId, userAndLocation.email, userAndLocation.realname, userAndLocation.phone, userAndLocation.position,userAndLocation.room, userAndLocation.username, purchasing.appleCareId, purchasing.lifeExpectancy, purchasing.purchased, purchasing.leased, purchasing.vendor, purchasing.warrantyDate

  • return_generator (bool) – If True a generator is returned to iterate over pages. By default, the results for all pages will be returned in a single response.

Returns:

List of computers OR a paginator generator.

Return type:

List[Computer] | Iterator[Page]

get_packages_v1(start_page: int = 0, end_page: int | None = None, page_size: int = 100, sort_expression: SortExpression | None = None, filter_expression: FilterExpression | None = None, return_generator: Literal[False] = False) List[Package]
get_packages_v1(start_page: int = 0, end_page: int | None = None, page_size: int = 100, sort_expression: SortExpression | None = None, filter_expression: FilterExpression | None = None, return_generator: Literal[True] = True) Iterator[Page]

Returns a list of package records.

Parameters:
  • start_page (int) – (optional) The page to begin returning results from. See Paginator for more information.

  • end_page – (optional) The page to end returning results at. See Paginator for more information.

  • page_size (int) – (optional) The number of results to include in each requested page. See Paginator for more information.

  • sort_expression (SortExpression) –

    (optional) The sort fields to apply to the request. See the documentation for Sorting for more information.

    Allowed sort fields:

    id, packageName, fileName, categoryId, info, notes, manifestFileName

  • filter_expression (FilterExpression) –

    (optional) The filter expression to apply to the request. See the documentation for Filtering for more information.

    Allowed filter fields:

    id, packageName, fileName, categoryId, info, notes, manifestFileName

  • return_generator (bool) – If True a generator is returned to iterate over pages. By default, the results for all pages will be returned in a single response.

Returns:

List of packages OR a paginator generator.

Return type:

List[package] | Iterator[Page]

get_jcds_files_v1() List[File]

Return a list of files in the JCDS.

Returns:

List JCDS File objects.

Return type:

List[File]

create_jcds_file_v1() NewFile

Create a new file in the JCDS.

Returns:

A JCDS NewFile object.

Return type:

NewFile

get_jcds_file_v1(file_name: str) DownloadUrl

Read a JCDS file record by its filename.

Returns:

A JCDS DownloadUrl object.

Return type:

DownloadUrl

Parameters:

file_name (str)

delete_jcds_file_v1(file_name: str) None

Delete a file from the JCDS.

Warning

This operation WILL NOT delete an associated package object. It is recommended to use delete_package_by_id().

Parameters:

file_name (str)

Return type:

None

renew_mdm_profile_v1(udids: List[str | UUID]) RenewMdmProfileResponse

Renews device MDM Profiles, including the device identity certificate within the MDM Profile.

Parameters:

udids (List[str, UUID]) – A list of device UDIDs to issue the profile renewal action to.

Returns:

The RenewMdmProfileResponse returned may or may not contain a UDIDs not processed for renewal.

Return type:

RenewMdmProfileResponse

send_mdm_command_preview(management_ids: List[str | UUID], command: EnableLostModeCommand | EraseDeviceCommand | LogOutUserCommand | RestartDeviceCommand | SetRecoveryLockCommand | ShutDownDeviceCommand | CustomCommand) List[SendMdmCommandResponse]

Send an MDM command to one or more devices.

Caution

This API is labeled as a Preview by Jamf. It may change or become deprecated in favor of another API in a future release.

Example usage:

from jamf_pro_sdk.models.pro.mdm import LogOutUserCommand

client.pro_api.send_mdm_command_preview(
    management_ids=["4eecc1fb-f52d-48c5-9560-c246b23601d3"],
    command=LogOutUserCommand()
)

Read the documentation for MDM Commands to view all the options for the supported MDM commands . The management IDs can be obtained from computer inventory records at computer.general.managementId.

This value is only available through the Pro API. See ComputerGeneral for more details.

Parameters:
Returns:

A list of command responses.

Return type:

List[SendMdmCommandResponse]

get_mdm_commands_v2(filter_expression: FilterExpression, start_page: int = 0, end_page: int | None = None, page_size: int = 100, sort_expression: SortExpression | None = None, return_generator: Literal[False] = False) List[MdmCommandStatus]
get_mdm_commands_v2(filter_expression: FilterExpression, start_page: int = 0, end_page: int | None = None, page_size: int = 100, sort_expression: SortExpression | None = None, return_generator: Literal[True] = True) Iterator[Page]

Returns a list of MDM commands.

Parameters:
  • filter_expression (FilterExpression) –

    The filter expression to apply to the request. At least one filter is required for this operation. See the documentation for Filtering for more information.

    Allowed filter fields:

    uuid, clientManagementId, command, status, clientType, dateSent, validAfter, dateCompleted, profileId, active

  • start_page (int) – (optional) The page to begin returning results from. See Paginator for more information.

  • end_page – (optional) The page to end returning results at. See Paginator for more information.

  • page_size (int) – (optional) The number of results to include in each requested page. See Paginator for more information.

  • sort_expression (SortExpression) –

    (optional) The sort fields to apply to the request. See the documentation for Sorting for more information.

    Allowed sort fields:

    uuid, clientManagementId, command, status, dateSent, validAfter, dateCompleted, profileIdentifier, active

  • return_generator (bool) – If True an iterator is returned that yields pages. By default, the results for all pages will be returned in a single response.

Returns:

List of MDM commands OR a paginator generator.

Return type:

List[MdmCommand] | Iterator[Page]

get_mobile_device_inventory_v2(sections: List[str] | None = None, start_page: int = 0, end_page: int | None = None, page_size: int = 100, sort_expression: SortExpression | None = None, filter_expression: FilterExpression | None = None, return_generator: Literal[False] = False) List[MobileDevice]
get_mobile_device_inventory_v2(sections: List[str] | None = None, start_page: int = 0, end_page: int | None = None, page_size: int = 100, sort_expression: SortExpression | None = None, filter_expression: FilterExpression | None = None, return_generator: Literal[True] = True) Iterator[Page]

Returns a list of mobile device (iOS and tvOS) inventory records.

Parameters:
  • sections (List[str]) –

    (optional) Select which sections of the computer’s details to return. If not specific the request will default to GENERAL. If ALL is passed then all sections will be returned.

    Allowed sections:

    GENERAL, HARDWARE, USER_AND_LOCATION, PURCHASING, SECURITY, APPLICATIONS, EBOOKS, NETWORK, SERVICE_SUBSCRIPTIONS, CERTIFICATES, PROFILES, USER_PROFILES, PROVISIONING_PROFILES, SHARED_USERS, EXTENSION_ATTRIBUTES

  • start_page (int) – (optional) The page to begin returning results from. See Paginator for more information.

  • end_page – (optional) The page to end returning results at. See Paginator for more information.

  • page_size (int) – (optional) The number of results to include in each requested page. See Paginator for more information.

  • sort_expression (SortExpression) –

    (optional) The sort fields to apply to the request. See the documentation for Sorting for more information.

    Allowed sort fields:

    airPlayPassword, appAnalyticsEnabled, assetTag, availableSpaceMb, batteryLevel, bluetoothLowEnergyCapable, bluetoothMacAddress, capacityMb, lostModeEnabledDate, declarativeDeviceManagementEnabled, deviceId, deviceLocatorServiceEnabled, devicePhoneNumber, diagnosticAndUsageReportingEnabled, displayName, doNotDisturbEnabled, enrollmentSessionTokenValid, exchangeDeviceId, cloudBackupEnabled, osBuild, osSupplementalBuildVersion, osVersion, osRapidSecurityResponse, ipAddress, itunesStoreAccountActive, mobileDeviceId, languages, lastBackupDate, lastEnrolledDate, lastCloudBackupDate, lastInventoryUpdateDate, locales, locationServicesForSelfServiceMobileEnabled, lostModeEnabled, managed, mdmProfileExpirationDate, model, modelIdentifier, modelNumber, modemFirmwareVersion, quotaSize, residentUsers, serialNumber, sharedIpad, supervised, tethered, timeZone, udid, usedSpacePercentage, wifiMacAddress, deviceOwnershipType, building, department, emailAddress, fullName, userPhoneNumber, position, room, username, appleCareId, leaseExpirationDate, lifeExpectancyYears, poDate, poNumber, purchasePrice, purchasedOrLeased, purchasingAccount, purchasingContact, vendor, warrantyExpirationDate, activationLockEnabled, blockEncryptionCapable, dataProtection, fileEncryptionCapable, hardwareEncryptionSupported, jailbreakStatus, passcodeCompliant, passcodeCompliantWithProfile, passcodeLockGracePeriodEnforcedSeconds, passcodePresent, personalDeviceProfileCurrent, carrierSettingsVersion, cellularTechnology, currentCarrierNetwork, currentMobileCountryCode, currentMobileNetworkCode, dataRoamingEnabled, eid, network, homeMobileCountryCode, homeMobileNetworkCode, iccid, imei, imei2, meid, personalHotspotEnabled, voiceRoamingEnabled, roaming

  • filter_expression (FilterExpression) –

    (optional) The filter expression to apply to the request. See the documentation for Filtering for more information.

    Allowed filter fields:

    airPlayPassword, appAnalyticsEnabled, assetTag, availableSpaceMb, batteryLevel, bluetoothLowEnergyCapable, bluetoothMacAddress, capacityMb, declarativeDeviceManagementEnabled, deviceId, deviceLocatorServiceEnabled, devicePhoneNumber, diagnosticAndUsageReportingEnabled, displayName, doNotDisturbEnabled, exchangeDeviceId, cloudBackupEnabled, osBuild, osSupplementalBuildVersion, osVersion, osRapidSecurityResponse, ipAddress, itunesStoreAccountActive, mobileDeviceId, languages, locales, locationServicesForSelfServiceMobileEnabled, lostModeEnabled, managed, model, modelIdentifier, modelNumber, modemFirmwareVersion, quotaSize, residentUsers, serialNumber, sharedIpad, supervised, tethered, timeZone, udid, usedSpacePercentage, wifiMacAddress, building, department, emailAddress, fullName, userPhoneNumber, position, room, username, appleCareId, lifeExpectancyYears, poNumber, purchasePrice, purchasedOrLeased, purchasingAccount, purchasingContact, vendor, activationLockEnabled, blockEncryptionCapable, dataProtection, fileEncryptionCapable, passcodeCompliant, passcodeCompliantWithProfile, passcodeLockGracePeriodEnforcedSeconds, passcodePresent, personalDeviceProfileCurrent, carrierSettingsVersion, currentCarrierNetwork, currentMobileCountryCode, currentMobileNetworkCode, dataRoamingEnabled, eid, network, homeMobileCountryCode, homeMobileNetworkCode, iccid, imei, imei2, meid, personalHotspotEnabled, roaming

  • return_generator (bool) – If True a generator is returned to iterate over pages. By default, the results for all pages will be returned in a single response.

Returns:

List of computers OR a paginator generator.

Return type:

List[MobileDevice] | Iterator[Page]

Pagination

class Paginator(api_client: ProApi, resource_path: str, return_model: Type[BaseModel], start_page: int = 0, end_page: int | None = None, page_size: int = 100, sort_expression: SortExpression | None = None, filter_expression: FilterExpression | None = None, extra_params: Dict[str, str] | None = None)

A paginator for the Jamf Pro API. A paginator automatically iterates over an API if multiple unreturned pages are detected in the response. Paginated requests are performed concurrently.

Parameters:
  • api_client (ProApi) – A Jamf Pro API client.

  • resource_path (str) – The API resource path the paginator will make requests to. This path should begin with the API version and not the /api base path.

  • return_model (Type[BaseModel]) – A Pydantic model to parse the results of the request as. If not set the raw JSON response is returned.

  • start_page (int) –

    (optional) The page to begin returning results from. Generally this value should be left at the default (0).

    Note

    Pages in the Pro API are zero-indexed. In a response that includes 10 pages the first page is 0 and the last page is 9.

  • end_page (Optional[int]) – (optional) The page number to stop pagination on. The end_page argument allows for retrieving page ranges (e.g. 2 - 4) or a single page result by using the same number for both start and end values.

  • page_size (int) – (optional) The number of results to include in each requested page. The default value is 100 and the maximum value is 2000.

  • sort_expression (SortExpression) – (optional) The sort fields to apply to the request. See the documentation for Sorting for more information.

  • filter_expression (FilterExpression) – (optional) The filter expression to apply to the request. See the documentation for Filtering for more information.

  • extra_params (Dict[str, str]) – (optional) A dictionary of key-value pairs that will be added to the query string parameters of the requests.

__call__(return_generator: bool = True) List | Iterator[Page]

Call the instantiated paginator to return results.

Parameters:

return_generator (bool) – If True a generator is returned to iterate over pages. If False the results for all pages will be returned in a single list response.

Returns:

An iterator that yields Page objects, or a list of responses if return_generator is False.

Return type:

Union[List, Iterator[Page]]

class FilterExpression(filter_expression: str, fields: List[FilterEntry])
Parameters:
class FilterField(name: str)
Parameters:

name (str)

filter_group(expression: FilterExpression) FilterExpression
Parameters:

expression (FilterExpression)

Return type:

FilterExpression

class SortExpression(sort_expression: str, fields: List[str])
Parameters:
  • sort_expression (str)

  • fields (List[str])

class SortField(field: str)
Parameters:

field (str)