The Pro API only returns and accepts JSON data. API responses are returned as data models that can be interacted with using dot notation.

MDM Commands

The SDK provides MDM commands in the form of models that are passed to the send_mdm_command_preview() method.

>>> from jamf_pro_sdk import JamfProClient, ApiClientCredentialsProvider
>>> from jamf_pro_sdk.models.pro.mdm import LogOutUserCommand
>>> client = JamfProClient("dummy.jamfcloud.com", ApiClientCredentialsProvider("client_id", "client_secret"))
>>> response client.pro_api.send_mdm_command_preview(
...     management_ids=["4eecc1fb-f52d-48c5-9560-c246b23601d3"],
...     command=LogOutUserCommand()
... )

The response will contain an array of SendMdmCommandResponse objects that have the IDs of the commands sent. Those IDs can be used with the uuid filter of get_mdm_commands_v2() to get the command’s status.

Basic MDM commands with no additional properties can be passed as instantiated objects as shown above with the LogOutUserCommand command. For other commands the additional properties can be set after instantiation, or a dictionary of values can be unpacked.

>>> from jamf_pro_sdk.models.pro.mdm import EraseDeviceCommand

>>> command = EraseDeviceCommand()
>>> command.pin = "123456"

>>> command = EraseDeviceCommand(**{"pin": "123456"})

Commands with required properties must have those values passed at instantiation.

>>> from jamf_pro_sdk.models.pro.mdm import EnableLostModeCommand

>>> command = EnableLostModeCommand()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 3 validation errors for EnableLostModeCommand
lostModeMessage
  field required (type=value_error.missing)
lostModePhone
  field required (type=value_error.missing)
lostModeFootnote
  field required (type=value_error.missing)

>>> command = EnableLostModeCommand(
...     lostModeMessage="Please return me to my owner.",
...     lostModePhone="123-456-7890",
...     lostModeFootnote="No reward."
... )
>>>

Read the documentation for MDM Commands for all support MDM commands and their properties.