API Client#
- class ApiClient(config: ConfigManager, concurrency: int)[source]#
Provides methods for interacting with the Jamf API, specifically fetching patch data, device information, and OS versions.
Note
All methods of the ApiClient class will raise an
APIResponseErrorif the API call is unsuccessful.- Parameters:
config (
ConfigManager) – Instance ofConfigManagerfor loading and storing credentials.concurrency (int) – Maximum number of concurrent API requests. See concurrency in Usage docs.
- async get_policies() list[str][source]#
Retrieves a list of patch software title IDs from the Jamf API.
- async get_summaries(policy_ids: list[str]) list[PatchTitle][source]#
Retrieves patch summaries asynchronously for the specified policy IDs from the Jamf API.
- Parameters:
policy_ids (list[str]) – list of policy IDs to retrieve summaries for.
- Returns:
list of
PatchTitleobjects containing patch summaries.- Return type:
list[
PatchTitle]
- async get_title_report_csv(title_id: str) list[PatchDevice][source]#
Retrieve the complete patch report for a specific software title using the CSV export endpoint.
This method fetches all device data in a single CSV request, avoiding pagination entirely.
- Parameters:
title_id (str) – The software title ID to retrieve the patch report for.
- Returns:
List of all PatchDevice objects for the title.
- Return type:
list[
PatchDevice]- Raises:
APIResponseError – If the CSV export fails or returns non-200 status.
- async get_title_reports(title_ids: list[str]) dict[str, list[PatchDevice]][source]#
Retrieves patch reports for multiple software titles.
Processes titles sequentially to avoid overwhelming the Jamf API. Each title’s pagination is handled by the underlying stream/fetch methods.
- Parameters:
title_ids (list[str]) – List of software title IDs to retrieve reports for.
- Returns:
Dictionary mapping title IDs to lists of PatchDevice objects.
- Return type:
dict[str, list[
PatchDevice]]
- async get_device_ids() list[int][source]#
Asynchronously fetches the list of mobile device IDs from the Jamf Pro API.
Note
This method is only called if the iOS option is passed to the CLI.
- async get_device_os_versions(device_ids: list[int]) list[dict[str, str]][source]#
Asynchronously fetches the OS version and serial number for each device ID provided.
Note
This method is only called if the iOS option is passed to the CLI.
- async get_app_names(patch_titles: list[PatchTitle]) list[dict[str, Any]][source]#
Fetches all possible app names for each
PatchTitleobject provided.- Parameters:
patch_titles (list[
PatchTitle]) – list ofPatchTitleobjects.- Returns:
list of dictionaries containing the
PatchTitletitle and correspondingappName- Return type:
- async get_sofa_feed() list[dict[str, str]][source]#
Fetches iOS Data feeds from SOFA and extracts latest OS version information.
To limit the amount of possible SSL verification checks, this method utilizes a subprocess call instead.
Note
This method is only called if the iOS option is passed to the CLI.
- Returns:
A list of dictionaries containing base OS versions, latest iOS versions, and release dates.
- Return type:
- Raises:
APIResponseError – If return code from SOFA is non-zero.