Skip to content
All recipes

Check whether an MDM command reached a device

List the commands sent to an Apple device and read each one's status to see whether it completed, failed or is still waiting.

Open in Claude Open in ChatGPT
Product
Endpoint Management
Platforms
Apple devices
Effect
Read-only
Agent access
Iru MCP or the Iru API

Before you start

  • An Iru API token with MCP turned on and permissions that cover the calls below (recipe 1).

Prompt for your agent

Find the device named [device name or serial number] in Iru with GET /api/v1/devices and show me its name and serial number. Then call GET /api/v1/devices/{device_id}/commands with limit set to 300. Find the most recent [command type] command and tell me its status, how many attempts it has made and when it was requested, last pushed and completed. If the response has a next page, request it with offset until you find the command. Use only the documented status codes, and tell me which field you used for each answer.

Steps

  1. Find the device

    Have the agent find the device by name or serial number and show you the device record before it goes further.

    GET/api/v1/devices

    Source: Iru API: List Devices

  2. List the device's commands

    This call returns information about the commands sent to one Apple device. Each command in the response example has a command_type, a status, attempts, date_requested, last_pushed and date_completed.

    A hard limit of 300 records applies to each request. If the device has more commands, page through them with the limit and offset parameters.

    GET/api/v1/devices/{device_id}/commands?limit=300

    Source: Iru API: Get Device Commands

  3. Read the status code

    The status codes are 1 for pending, 2 for running, 3 for completed, 4 for failed and 5 for a "Not Now" response.

    Source: Iru API: Get Device Commands

Check it worked

  • The command you care about shows status 3 and a date_completed.

Common pitfalls

  • The call covers Apple devices only.
  • MDM communication is almost immediate for devices that are online. If a command stays pending, check when the device last checked in.
  • The list can run past one page. Check next in the response before you decide a command is missing.

FAQ

Which API call shows the commands sent to a device?

GET /api/v1/devices/{device_id}/commands returns the commands sent to one Apple device, each with a status code.

What do the command status codes mean?

1 is pending, 2 is running, 3 is completed, 4 is failed and 5 is a "Not Now" response.

How many commands does one request return?

A request returns at most 300 records. Use the limit and offset parameters to page through more.

How fast does an MDM command reach a device?

MDM communication is almost immediate for devices that are online. There is no set check-in time for MDM commands, and you can't force one.

Next steps

Sources

Stay up to date

Iru's bi-weekly collection of articles, videos, and research to keep IT & Security teams ahead of the curve.