- Superuser access to the Custom Integrations configuration in runZero.
- Moysle API token (
access_key). - Moysle admin account email and password, provided in
access_secretas a JSON/dict ({"email": "<EMAIL>", "password": "<PASSWORD>"}or{"username": "<EMAIL>", "password": "<PASSWORD>"}). - Account must have permission to access device inventory.
-
Gather your Moysle API credentials:
- Obtain your API token from the Moysle admin portal.
- Use a valid Moysle admin email and password. The script performs the login and bearer retrieval for you.
-
Test your credentials (optional but recommended):
- Use a tool like Postman or curl to confirm login is working.
- Example request (bearer is returned in the
Authorizationresponse header; the script handles this automatically):curl -i -X POST "https://managerapi.mosyle.com/v2/login" \ -H "Content-Type: application/json" \ -d '{ "accessToken": "<API_TOKEN>", "email": "<EMAIL>", "password": "<PASSWORD>" }'
-
Verify device access:
- Use the bearer token returned above and include the access token in the request body (the script loops per-OS over
ios,mac,tvos,visionos):curl -X POST "https://managerapi.mosyle.com/v2/listdevices" \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{ "accessToken": "<API_TOKEN>", "options": { "os": "all", "page": 0 } }'
- Use the bearer token returned above and include the access token in the request body (the script loops per-OS over
-
(OPTIONAL) - Modify the Starlark script to match your desired filtering, pagination, or attribute mapping.
-
Create the Credential for the Custom Integration.
- Select the type
Custom Integration Script Secrets. - Use the
access_keyfield for your API token. - Use the
access_secretfield as JSON/dict with keys{"email": "<EMAIL>", "password": "<PASSWORD>"}(orusername). Pre-issued bearer tokens are not used by the script.
- Select the type
-
Create the Custom Integration.
- Add a Name and Icon for the integration (e.g.,
moysle). - Toggle
Enable custom integration scriptto paste in the finalized script. - Click
Validateto ensure it has valid syntax. - Click
Saveto create the Custom Integration.
- Add a Name and Icon for the integration (e.g.,
-
Create the Custom Integration task.
- Select the Credential and Custom Integration created in steps 2 and 3.
- Set the task schedule to run as needed.
- Select the hosted Explorer to run the integration from.
- Click
Saveto activate the task.
- The task will appear on the Tasks page and run like any other integration.
- It will update existing assets or create new ones based on device merge criteria (hostname, MAC, etc.).
- You can filter assets imported via this integration using:
custom_integration:moysle