Run a script on one device
Run a script on the device for the given device ID. Pass { "scriptId": 12 } to run a saved script (see getScripts), or { "contents": "..." } to send the source inline.
This is the single-device shortcut for runScript; use that one to target all devices, device groups, or several devices at once. The platforms are derived from the device, so a script whose interpreter does not match it is rejected.
The response returns immediately with the execution pending; poll getDeviceScriptExecutions or getScriptRun for the outcome.
⚠️ This executes arbitrary code on the device with elevated privileges, and is not idempotent — repeating the call runs the script again. Review the script before calling.
Supported platforms: macOS (shell/Python), Windows (PowerShell), Linux (shell/Python). Not supported: iOS, Android, ChromeOS.
Authorizations
Use your Primo API key in the Authorization header as Bearer <API_KEY>.
Path Parameters
Body
What to run: { "scriptId": 12 } for a script from the catalog, or { "contents": "..." } to send the source inline. An inline run may only target a single device.
- Option 1
- Option 2
Response
The target as submitted.
- Option 1
- Option 2
- Option 3
macos, windows, linux Full source of the script as executed.
Number of devices the run resolved to.
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$One execution per resolved device, all pending at creation. Poll getScriptRun or getScriptRunExecutions for outcomes.