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
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/devicesSource: Iru API: List Devices
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, astatus,attempts,date_requested,last_pushedanddate_completed.A hard limit of 300 records applies to each request. If the device has more commands, page through them with the
limitandoffsetparameters.GET/api/v1/devices/{device_id}/commands?limit=300Source: Iru API: Get Device Commands
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
nextin 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.