Classic API Client¶
- class ClassicApi(request_method: Callable[..., requests.Response], concurrent_requests_method: Callable[..., Iterator])¶
Provides a curated interface to the Jamf Pro Classic API.
- Parameters:
request_method (Callable[..., requests.Response])
concurrent_requests_method (Callable[..., Iterator])
- list_all_categories() List[ClassicCategoriesItem] ¶
Returns a list of all categories.
- Returns:
List of categories.
- Return type:
List[ClassicCategoriesItem]
- get_category_by_id(category: int | ClassicCategory | ClassicCategoriesItem) ClassicCategory ¶
Returns a single category record using the ID.
- Parameters:
category (Union[int, ClassicCategory, ClassicCategoriesItem]) – A category ID or supported Classic API model.
- Returns:
Category.
- Return type:
- update_category_by_id(category: int | ClassicCategory | ClassicCategoriesItem, data: str | ClassicCategory) None ¶
Update a single category record using the ID.
- Parameters:
category (Union[int, ClassicCategory, ClassicCategoriesItem]) – A category ID or supported Classic API model.
data (Union[str, ClassicCategory]) – Can be an XML string or a
ClassicCategory
object.
- Return type:
None
- delete_category_by_id(category: int | ClassicCategory | ClassicCategoriesItem) None ¶
Delete a single category record using the ID.
- Parameters:
category (Union[int, ClassicCategory, ClassicCategoriesItem]) – A category ID or supported Classic API model.
- Return type:
None
- create_category(data: str | ClassicCategory) int ¶
Create a new category.
- Parameters:
data (Union[str, ClassicCategory]) – Can be an XML string or a
ClassicCategory
object.- Returns:
ID of the new category.
- Return type:
int
- list_all_computers(subsets: Iterable[str] | None = None) List[ClassicComputersItem] ¶
Returns a list of all computers.
- Parameters:
subsets (Iterable) – (optional) This operations accepts the
basic
subset to return additional details for every computer record. No other subset values are supported.- Returns:
List of computers.
- Return type:
List[ClassicComputersItem]
- get_computer_by_id(computer: int | ClassicComputer | ClassicComputersItem, subsets: Iterable[str] | None = None) ClassicComputer ¶
Returns a single computer record using the ID.
- Parameters:
computer (Union[int, ClassicComputer, ClassicComputersItem]) – A computer ID or supported Classic API model.
subsets (Iterable[str] | None) – (optional) This operation accepts subset values to limit the details returned with the computer record. The following subset values are accepted:
general
,location
,purchasing
,peripherals
,hardware
,certificates
,software
,extensionattributes
,groupsaccounts
, andconfigurationprofiles
.
- Returns:
Computer.
- Return type:
- get_computers(computers: List[int | ClassicComputer | ClassicComputersItem] | None = None, subsets: Iterable[str] | None = None) Iterator[ClassicComputer] ¶
Returns all requested computer records by their IDs. This is a wrapper to the concurrent API requests method. If
computers
is not provided a call tolist_all_computers()
is made to obtain the full list of computer IDs.- Parameters:
computers (List[Union[int, ClassicComputer, ClassicComputersItem]]) – (optional) A list of computer IDs or supported Classic API models.
subsets (Iterable[str] | None) – (optional) This operation accepts subset values to limit the details returned with the computer record. The following subset values are accepted:
general
,location
,purchasing
,peripherals
,hardware
,certificates
,software
,extensionattributes
,groupsaccounts
, andconfigurationprofiles
.
- Returns:
List of computers.
- Return type:
List[ClassicComputer]
- update_computer_by_id(computer: int | ClassicComputer | ClassicComputersItem, data: str | ClassicComputer) None ¶
Update a single computer record using the ID.
Important
Not all fields in a computer record can be updated.
- Parameters:
computer (Union[int, ClassicComputer, ClassicComputersItem]) – A computer ID or supported Classic API model.
data (Union[str, Computer]) – Can be an XML string or a
ClassicComputer
object.
- Return type:
None
- delete_computer_by_id(computer: int | ClassicComputer | ClassicComputersItem) None ¶
Delete a single computer record using the ID.
- Parameters:
computer (Union[int, ClassicComputer, ClassicComputersItem]) – A computer ID or supported Classic API model.
- Return type:
None
- set_computer_unmanaged_by_id(computer: int | ClassicComputer | ClassicComputersItem) None ¶
Sets the management status to unmanaged for a single computer using the ID
Important
This action does not remove the management framework or mdm profile from the device
- Parameters:
computer (Union[int, Computer, ComputersItem]) – A computer ID or supported Classic API model.
- Return type:
None
- set_computer_managed_by_id(computer: int | ClassicComputer | ClassicComputersItem, management_user: str = 'admin', management_password: str | None = None) None ¶
Sets the management status to managed for a single computer using the ID.
Important
The management user does not need to match any local user account but is required for the device to be “managed”
- Parameters:
computer (Union[int, Computer, ComputersItem]) – A computer ID or supported Classic API model.
management_user (str) – (optional) The management username. Defaults to ‘admin’ if not specified
management_password (str) – (optional) The management password. Defaults to a randomly generated password if not specified
- Return type:
None
- create_computer_group(data: str | ClassicComputerGroup) int ¶
Create a new computer group.
If you are creating a STATIC group you must set
is_smart
toFalse
and cannot include anycriteria
. You can includecomputers
in your request to populate group member on creation.If you are creating a SMART group you must set
is_smart
toTrue
and cannot include anycomputers
. If nocriteria
are included the new group will include all computers.- Parameters:
data (Union[str, ClassicComputerGroup]) – Can be an XML string or a
ClassicComputerGroup
object.- Returns:
ID of the new computer group.
- Return type:
int
- list_all_computer_groups() List[ClassicComputerGroup] ¶
Returns a list of all computer groups.
Only
id
,name
andis_smart
are populated.- Returns:
List of computer groups.
- Return type:
List[ClassicComputerGroup]
- get_computer_group_by_id(computer_group_id: int) ClassicComputerGroup ¶
Returns a single computer group record using the ID.
- Parameters:
computer_group_id (int) – The computer group ID.
- Returns:
Computer group.
- Return type:
- update_smart_computer_group_by_id(computer_group_id: int, data: str | ClassicComputerGroup)¶
Update a smart computer group.
The
is_smart
field must be set toTrue
on the computer group to use this operation.This operation will replace the current
criteria
for the group. It is recommended you get the current state, modify thecriterion
objects as needed, and pass them into a newClassicComputerGroup
object for the update.- Parameters:
computer_group_id (int) – The computer group ID.
data (Union[str, ClassicComputerGroup]) – Can be an XML string or a
ClassicComputerGroup
object.
- update_static_computer_group_membership_by_id(computer_group_id: int, computers_to_add: Iterable[int | ClassicComputerGroupMember] | None = None, computers_to_remove: Iterable[int | ClassicComputerGroupMember] | None = None) None ¶
Update the membership of a static computer group.
The
is_smart
field must be set toFalse
on the computer group to use this operation.- Parameters:
computer_group_id (int) – The computer group ID.
computers_to_add (Iterable[Union[int, ClassicComputerGroupMember]]) – An array of computer IDs, or
ClassicComputerGroupMember
objects to add to the static group.computers_to_remove (Iterable[Union[int, ClassicComputerGroupMember]]) – An array of computer IDs, or
ClassicComputerGroupMember
objects to remove from the static group.
- Return type:
None
- create_advanced_computer_search(data: str | ClassicAdvancedComputerSearch) int ¶
Create a new advanced computer search.
- Parameters:
data (Union[str, ClassicAdvancedComputerSearch]) – Can be an XML string or a
ClassicAdvancedComputerSearch
object.- Returns:
ID of the new computer group.
- Return type:
int
- list_all_advanced_computer_searches() List[ClassicAdvancedComputerSearchesItem] ¶
Returns a list of all advanced computer searches.
- Returns:
List of advanced computer searches.
- Return type:
- get_advanced_computer_search_by_id(advanced_search: int | ClassicAdvancedComputerSearch | ClassicAdvancedComputerSearchesItem)¶
Returns a single advanced computer search using the ID.
This operation returns the results of the advanced search when called. The
computers
field will contain an array of the results with data fields matching those in thedisplay_fields
field.Results are calculated on each call to this operation.
- Parameters:
advanced_search (Union[int, ClassicAdvancedComputerSearch, ClassicAdvancedComputerSearchesItem]) – An advanced computer search ID or supported Classic API model.
- Returns:
Advanced computer search.
- Return type:
- update_advanced_computer_search_by_id(advanced_search: int | ClassicAdvancedComputerSearch | ClassicAdvancedComputerSearchesItem, data: str | ClassicAdvancedComputerSearch, return_updated: bool = False)¶
Update an advanced computer search using the ID.
- Parameters:
advanced_search (Union[int, ClassicAdvancedComputerSearch, ClassicAdvancedComputerSearchesItem]) – An advanced computer search ID or supported Classic API model.
data (Union[str, ClassicAdvancedComputerSearch]) – Can be an XML string or a
ClassicAdvancedComputerSearch
object.return_updated (bool) – If
True
theget_advanced_computer_search_by_id()
operation will be called after the update operation to return the updated results.
- Returns:
Advanced computer search if
return_updated
isTrue
.- Return type:
Union[None, ClassicAdvancedComputerSearch]
- delete_advanced_computer_search_by_id(advanced_search: int | ClassicAdvancedComputerSearch | ClassicAdvancedComputerSearchesItem)¶
Delete an advanced computer search using the ID.
- Parameters:
advanced_search (Union[int, ClassicAdvancedComputerSearch, ClassicAdvancedComputerSearchesItem]) – An advanced computer search ID or supported Classic API model.
- create_package(data: str | ClassicPackage) int ¶
Create a new package.
Only the
name
andfilename
are required. Use withcreate_jcds_file_v1()
to upload the package file to a Jamf Cloud Distribution Point.- Parameters:
data (Union[str, ClassicPackage]) – Can be an XML string or a
ClassicPackage
object.- Returns:
ID of the new package.
- Return type:
int
- list_all_packages() List[ClassicPackageItem] ¶
Returns a list of all packages.
- Returns:
List of packages.
- Return type:
List[ClassicPackageItem]
- get_package_by_id(package: int | ClassicPackage | ClassicPackageItem) ClassicPackage ¶
Returns a single package record using the ID.
- Parameters:
package (Union[int, ClassicPackage, ClassicPackageItem]) – A package ID or supported Classic API model.
- Returns:
Package.
- Return type:
- delete_package_by_id(package: int | ClassicPackage | ClassicPackageItem) None ¶
Delete a single computer record using the ID.
Warning
This operation WILL delete an associated JCDS file.
- Parameters:
package (Union[int, ClassicPackage, ClassicPackageItem]) – A package ID or supported Classic API model.
- Return type:
None