From 3775683265986bb0136ec52d2c6cee8f0c4a9bb7 Mon Sep 17 00:00:00 2001 From: Tyler Diderich Date: Thu, 11 Dec 2025 13:35:28 -0600 Subject: [PATCH 1/6] stashing this until I can finsih --- moysle/README.md | 75 + moysle/config.json | 1 + moysle/custom-integration-moysle.star | 220 ++ moysle/moysle-api.txt | 2965 +++++++++++++++++++++++++ 4 files changed, 3261 insertions(+) create mode 100644 moysle/README.md create mode 100644 moysle/config.json create mode 100644 moysle/custom-integration-moysle.star create mode 100644 moysle/moysle-api.txt diff --git a/moysle/README.md b/moysle/README.md new file mode 100644 index 0000000..6f7cfbf --- /dev/null +++ b/moysle/README.md @@ -0,0 +1,75 @@ +# Custom Integration: Moysle + +## runZero Requirements + +- Superuser access to the [Custom Integrations configuration](https://console.runzero.com/custom-integrations) in runZero. + +## Moysle Requirements + +- Moysle API token (`access_key`). +- Moysle admin account email and password, combined as `email:password` in the `access_secret` field. +- Account must have permission to access device inventory. + +## Steps + +### Moysle Configuration + +1. Gather your Moysle API credentials: + - Obtain your **API token** from the Moysle admin portal. + - Use a valid Moysle admin email and password. + +2. Test your credentials: + - Use a tool like Postman or curl to confirm login is working. + - Example request (token returned in the `Authorization` response header): + ```bash + curl -i -X POST "https://managerapi.mosyle.com/v2/login" \ + -H "Content-Type: application/json" \ + -d '{ + "accessToken": "", + "email": "", + "password": "" + }' + ``` + - Copy the bearer token from the `Authorization: Bearer ` response header. + +3. Verify device access: + - Use the bearer token and include the access token in the request body: + ```bash + curl -X POST "https://managerapi.mosyle.com/v2/listdevices" \ + -H "Authorization: Bearer " \ + -H "Content-Type: application/json" \ + -d '{ + "accessToken": "", + "options": { + "os": "all", + "page": 0 + } + }' + ``` + +### runZero Configuration + +1. (OPTIONAL) - Modify the Starlark script to match your desired filtering, pagination, or attribute mapping. + +2. [Create the Credential for the Custom Integration](https://console.runzero.com/credentials). + - Select the type `Custom Integration Script Secrets`. + - Use the `access_key` field for your API token. + - Use the `access_secret` field as JSON or a dict with keys: `{"email": "", "password": ""}` (or `username` in place of `email`). You can optionally include a pre-issued bearer token as `bearer`/`token` to skip login parsing. + +3. [Create the Custom Integration](https://console.runzero.com/custom-integrations/new). + - Add a Name and Icon for the integration (e.g., `moysle`). + - Toggle `Enable custom integration script` to paste in the finalized script. + - Click `Validate` to ensure it has valid syntax. + - Click `Save` to create the Custom Integration. + +4. [Create the Custom Integration task](https://console.runzero.com/ingest/custom/). + - 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 `Save` to activate the task. + +### What's Next? + +- The task will appear on the [Tasks](https://console.runzero.com/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` diff --git a/moysle/config.json b/moysle/config.json new file mode 100644 index 0000000..07ab234 --- /dev/null +++ b/moysle/config.json @@ -0,0 +1 @@ +{ "name": "Moysle", "type": "inbound" } diff --git a/moysle/custom-integration-moysle.star b/moysle/custom-integration-moysle.star new file mode 100644 index 0000000..294100d --- /dev/null +++ b/moysle/custom-integration-moysle.star @@ -0,0 +1,220 @@ +load('requests', 'Session') +load('json', json_encode='encode', json_decode='decode') +load('runzero.types', 'ImportAsset', 'NetworkInterface') +load('net', 'ip_address') + +BASE_URL = "https://managerapi.mosyle.com/v2" + + +def parse_credentials(secret): + """ + Parse access_secret provided as a dict or JSON string containing email/username and password. + """ + if not secret: + return None, None + + creds = secret + if type(secret) == "string": + print(creds) + if secret.find("{") != -1: + creds = json_decode(secret) + elif secret.find(":") != -1: + # Backward-compat for email:password format. + email, password = secret.split(":", 1) + if email and password: + return email, password + return None, None + + if type(creds) == "dict": + email = creds.get("email") or creds.get("username") + password = creds.get("password") + if email and password: + return email, password + + return None, None + + +def get_bearer_token(session, access_token, email, password): + """ + Perform JWT login and return the bearer token from the Authorization header. + """ + login_url = "{}/login".format(BASE_URL) + payload = { + "accessToken": access_token, + "email": email, + "password": password, + } + resp = session.post(login_url, body=bytes(json_encode(payload))) + if not resp or resp.status_code != 200: + print("Login failed: {}".format(resp.status_code if resp else "no response")) + return None + print("response: ", resp) + auth_header = None + if resp.headers: + if "Authorization" in resp.headers: + auth_header = resp.headers["Authorization"] + elif "authorization" in resp.headers: + auth_header = resp.headers["authorization"] + + if auth_header and auth_header.startswith("Bearer "): + return auth_header.split(" ", 1)[1] + + print("Login succeeded but bearer token missing from headers") + return None + + +def build_network_interface(mac, ips): + """ + Build a NetworkInterface from a MAC and list of IP strings. + """ + ip4s = [] + ip6s = [] + for ip in ips: + if not ip: + continue + addr = ip_address(ip) + if addr.version == 4: + ip4s.append(addr) + elif addr.version == 6: + ip6s.append(addr) + + if not mac and not ip4s and not ip6s: + return None + + return NetworkInterface(macAddress=mac or None, ipv4Addresses=ip4s, ipv6Addresses=ip6s) + + +def collect_hostnames(device): + names = [] + for key in ["device_name", "devicename", "HostName", "LocalHostName", "hostname"]: + name = device.get(key, "") + if name and name not in names: + names.append(name) + return names + + +def build_custom_attributes(device, used_keys): + attrs = {} + for key in device: + if key in used_keys: + continue + value = device.get(key) + if value == None: + continue + # Normalize lists and dicts to JSON strings; primitives to strings. + if type(value) == "dict" or type(value) == "list": + attrs[key] = json_encode(value) + else: + attrs[key] = "{}".format(value) + return attrs + + +def main(*args, **kwargs): + """ + Custom integration for importing Mosyle device inventory into runZero. + Requires access_key (API token) and access_secret (JSON or dict with email/username and password). + """ + api_token = kwargs.get("access_key") + email, password = parse_credentials(kwargs.get("access_secret")) + if not api_token or not email or not password: + print("Missing required credentials") + return [] + + session = Session() + session.headers.set("Content-Type", "application/json") + session.headers.set("Accept", "application/json") + session.headers.set("User-Agent", "runZeroCustomScript/1.0") + + bearer = get_bearer_token(session, api_token, email, password) + if not bearer: + return [] + + session.headers.set("Authorization", "Bearer {}".format(bearer)) + + assets = [] + page = 0 + + while True: + list_url = "{}/listdevices".format(BASE_URL) + list_payload = { + "accessToken": api_token, + "options": { + "os": "all", + "page": page, + }, + } + + device_resp = session.post(list_url, body=bytes(json_encode(list_payload))) + if not device_resp or device_resp.status_code != 200: + print("Device list request failed on page {}: {}".format(page, device_resp.status_code if device_resp else "no response")) + break + + data = json_decode(device_resp.body) + response = data.get("response", {}) + devices = response.get("devices", []) + if not devices: + break + + for d in devices: + device_id = d.get("deviceudid") or d.get("serial_number") or "" + if not device_id: + continue + + hostnames = collect_hostnames(d) + + wifi_mac = d.get("wifi_mac_address") + eth_mac = d.get("ethernet_mac_address") + wifi_ips = [] + if d.get("last_ip_beat"): + wifi_ips.append(d.get("last_ip_beat")) + eth_ips = [] + if d.get("last_lan_ip"): + eth_ips.append(d.get("last_lan_ip")) + + network_interfaces = [] + wifi_iface = build_network_interface(wifi_mac, wifi_ips) + if wifi_iface: + network_interfaces.append(wifi_iface) + eth_iface = build_network_interface(eth_mac, eth_ips) + if eth_iface: + network_interfaces.append(eth_iface) + + model = d.get("device_model_name") or d.get("model_name") or d.get("device_model") or d.get("model") or "" + os_name = d.get("os", "") + os_version = d.get("osversion", "") + + used_keys = set([ + "deviceudid", + "serial_number", + "device_name", + "devicename", + "HostName", + "LocalHostName", + "hostname", + "os", + "osversion", + "wifi_mac_address", + "ethernet_mac_address", + "last_ip_beat", + "last_lan_ip", + "device_model_name", + "model_name", + "device_model", + "model", + ]) + custom_attrs = build_custom_attributes(d, used_keys) + + asset = ImportAsset( + id=device_id, + hostnames=hostnames, + os=os_name, + osVersion=os_version, + model=model, + networkInterfaces=network_interfaces if network_interfaces else None, + customAttributes=custom_attrs if custom_attrs else None, + ) + assets.append(asset) + + page += 1 + + return assets diff --git a/moysle/moysle-api.txt b/moysle/moysle-api.txt new file mode 100644 index 0000000..9078a37 --- /dev/null +++ b/moysle/moysle-api.txt @@ -0,0 +1,2965 @@ +Articles +Articles +Learn more how to use the API with the articles listed below. +First Steps +How to make a Request using the API +Discover how to integrate your system with our Mosyle Manager API and make requests. In this article you will learn about the general parameters used in every request you can make. +Devices Operations +List Devices +Check out this guide to learn how to list and search your devices through Mosyle Manager API, +Lock Devices +Check out this guide to learn how to lock your devices through Mosyle Manager API. +Lost Mode (only iOS) +Check out this guide to learn how to enable/disable lost mode on your devices through Mosyle Manager API. +Unassign Devices +Check out this guide to learn how to unassign devices through Mosyle Manager API. +Update Device Attributes +Check out this guide to learn how to update attributes of one or multiple devices using Mosyle Manager API. +Bulk Operations - Wipe Devices +Check out this guide to learn how to wipe devices through Mosyle Manager API. +Bulk Operations - Restart Devices +Check out this guide to learn how to restart devices through Mosyle Manager API. +Bulk Operations-Shutdown Devices +Check out this guide to learn how to shutdown devices through Mosyle Manager API. +Bulk Operations - Clear Commands +Check out this guide to learn how to clear commands through Mosyle Manager API. +Bulk Operations - Activation Lock +Check out this guide to learn how to enable/disable Activation Lock through Mosyle Manager API. +Bulk Operations - Move Devices to Accounts (District Only) +Check out this guide to learn how to move devices to accounts from the District Level through Mosyle Manager API. +Bulk Operations - Change/Update Limbo Location +Check out this guide to learn how to change or update the location of devices in Limbo through Mosyle Manager API. +X +Users Operations +List Users +Check out this guide to learn how to list and search users through Mosyle Manager API. +Create Users +Create users through Mosyle Manager API. +Update Users +Update users through Mosyle Manager API. +Delete User +Check out this guide to learn how to delete users using Mosyle Manager API. +Assign Devices +Check out this guide to learn how to assign devices to users through Mosyle Manager API. +Classes +Save and Delete Classes +Check out this guide and learn how to manage your classes through Mosyle Manager API. +List Classes +Check out this guide and learn how to list your classes through Mosyle Manager API, +Accounts (District Only) +Get Accounts +Get accounts list. +Create new Account +Check out this guide on how to create a new account (District Only). +Cisco ISE +Cisco ISE - Add and remove Devices +Check out this guide about how to add and remove devices from Cisco ISE. +Cisco ISE-Get Device +Check out this guide on managing devices in your Cisco ISE. +Dynamic Device Groups Operations +List Dynamic Device Groups +Check out this guide to learn how to list and search dynamic device groups through Mosyle Manager APL +List Devices +Check out this guide to learn how to list all device UDIDs of a specific dynamic device group through Mosyle Manager API. +Add/Remove Device from Dynamic Device Group +Check out this guide to learn how to add or remove devices to Dynamic Device Groups using Mosyle Manager API. +List Devices in Device Groups +Check out this guide to learn how to list devices in your device groups through Mosyle Manager API. +Action Logs +List +Check out this guide to learn how to list and search Action Logs through Mosyle Manager API. +Mosyle Logs Stream +Mosyle Logs Stream +Check out this guide to learn how to integrate with Mosyle Logs Stream APL +Custom Device Attributes +List Custom Device Attributes +Check out this guide to learn how to list your custom device attributes through Mosyle Manager API. +Create Custom Device Attributes +Check out this guide to learn how to create your custom device attributes through Mosyle Manager API. +Assign Custom Device Attributes +Check out this guide to learn how to assign your custom device attributes through Mosyle Manager API. +Update Custom Device Attributes +Check out this guide to learn how to update your custom device attributes through Mosyle Manager API. +Remove Custom Device Attributes +Check out this guide to learn how to remove your custom device attributes through Mosyle Manager API. +Delete Custom Device Attributes +Check out this guide to learn how to delete your custom device attributes through Mosyle Manager API. +Shared Device Group Operations +Add/Remove Device from Shared Device Group +Check out this guide to learn how to add or remove devices from Shared Device Groups using Mosyle Manager APL +First Steps - How to make a Request using the API +To use the Mosyle API you need to enable this feature in the API profile page (My School > API Integration > enable the profile). +Once enabled you will see your access token and make requests to the endpoint" +", every request will have some required +parameters as well as optional parameters. The Mosyle API supports the POST request method. All API responses are structured in JSON format. +If your current API integration is using Basic Authentication, please create a new API Token to use JWT Authentication as Basic Authentication has been deprecated. +JWT Authentication +First, make a request to the Mosyle API endpoint "/login" including the access token, email, and password in the body of the request. +Example request: +1 curl --include --location 'https://managerapi.moayle.com/v2/login +2 --header Content-Type: application/json +3-data-raw +4 +accessToken": Access Token +5 +"email": "User Email", +6 +"password": "User Password" +7}' +First Steps - How to make a Request using the API +First, make a request to the Mosyle API endpoint "/login" including the access token, email, and password in the body of the request. +Example request: +1 curl --include --location https://managerapi.mosyle.com/v2/login' \ +2 --header 'Content-Type: application/json' +3-data-raw ( +5 +6 +7} +accessToken": "Access Token" +email": "User Email", +password": "User Password" +Example response: +1 HTTP/1.1 200 OK +2 Date: Mon, 21 Aug 2023 17:31:09 GMT +3 Server: Apache +4 X-Frame-Options: SAMEORIGIN +5 X-XSS-Protection: ; mode=block +6 X-Content-Type-Options: nosniff +7 Content-Security-Policy: frame-src 'self' 'unsafe-eval' 'unsafe-inline.mosyle.com frame-ancestors 'self' +8 Strict-Transport-Security: max-age=3072000; includeSubdomains; +9 Set-Cookie: PHPSESSID=901c23c1234e5678b901d2a34a56cc7; path=/; domain=.mosyle.com; secure; HttpOnly +10 Expires: Thu, 19 Nov 1981 08:52:00 GMT +11 Cache-Control: no-store, no-cache, must-revalidate +12 Pragma: no-cache +13 Authorization: Bearer Bearer_Token +14 Content-Length: 59 +15 Content-Type: application/json +16 +17 {"UserID":"User ID", "email":"User_Email"} +The response will contain a +as a JSON Web Token (JWT) in the header which will be needed for subsequent requests. The token will expire +every 24 hours and will need to be renewed. +When accessing any other Mosyle API endpoints, include the string "Bearer" followed by the JWT in the request header. The access token will be included in the body of the request. +*Note: If you are using PowerShell, you will need to utilize 'Invoke-WebRequest' to view the Bearer token to then parse or copy/paste it as necessary. +X +4 X-Frame-Options: SAMEORIGIN +5 X-XSS-Protection: +; mode=block +First Steps - How to make a Request using the API +6 X-Content-Type-Options: nosniff +7 Content-Security-Policy: frame-src 'self' 'unsafe-eval' 'unsafe-inline +8 Strict-Transport-Security: max-age=3072000; includeSubdomains; +.mosyle.com frame-ancestors 'self' +9 Set-Cookie: PHPSESSID=0c23c1234e5678b901d2a34a56cc7; path=/; domain=.mosyle.com; secure; HttpOnly 10 Expires: Thu, 19 Nov 1981 0:52:00 GMT +11 Cache-Control: no-store, no-cache, must-revalidate +12 Pragma: no-cache +13 Authorization: Bearer Bearer_Token +14 Content-Length: 59 +15 Content-Type: application/json +16 +17 ("UserID":"User_ID", "email": "User Email"} +The response will contain a +as a JSON Web Token (JWT) in the header which will be needed for subsequent requests. The token will expire +every 24 hours and will need to be renewed. +When accessing any other Mosyle API endpoints, include the string "Bearer" followed by the JWT in the request header. The access token will be included in the body of the request. +*Note: If you are using PowerShell, you will need to utilize 'Invoke-WebRequest' to view the Bearer token to then parse or copy/paste it as necessary. +The following snippet will be used in all subsequent requests: +1 curl --location 'https://managerapi.mosyle.com/v2 +2 +3 --header 'Content-Type: application/json' +4 --header Authorization: Bearer ((Bearer_Token}}" +5 --data +6 +7} +"accessToken": "Access Token" +For more examples with other languages and to test the API, click here to download the sample API file. (Compatible with Postman and Insomnia) +Attention: You must change the environment variables and provide your API Token Access, Email and Password when you open the sample archive on +Postman or Insomnia. +Check the next articles to learn more about the services and their operations. +Devices Operations - List Devices +You will hit the endpoint /listdevices and can send parameters to filter your request for the specific info you want to receive in your response. +Key +Туре +Description +Required Which Operational System will be listed, values can be ios, mac, tvos, or visionos +05 +String +tags +Array +of +Optional +strings +osversions +Array +Offaman +of +strings +serial numbers +Array +of +page +strings +O Serial Numbers (filter by specific serial numbers) +Integer Option Pagination start with O +specific columns Array +Use this option to retrieve specific attributes for each device. If this option is excluded, all device attributes will be returned. +Example request +of +strings +Return only specific values: +deviceudid, total_disk, os, serial number, device_name, device model, idaccount, battery, osversion, date_info, carrier, +roaming enabled, isroaming, imei, meid, available_disk, wifi_mac_address, last_ip_beat, last_lan_ip, bluetooth_mac_address, +is_supervised, date_app_info, date_last_beat, date_last_push, status, isActivationLockEnabled, isDeviceLocatorServiceEnabled, +isDoNotDisturbinEffect, isCloud BackupEnabled, IsNetwork Tethered, needosupdate, productkeyupdate, device_type, +lostmode_status, is muted, date muted, activation bypass, date_media_info, tags (will not include Mosyle-generated tags). +iTunesStoreAccountHash, iTunesStoreAccountsActive, date profiles_info, ethernet_mac_address, model_name, +LastCloudBackupDate, SystemintegrityProtectionEnabled, BuildVersion, LocalHostName, HostName, OSUpdateSettings, ActiveManagedUsers, CurrentConsoleManaged User, date printers, AutoSetupAdminAccounts, appleTVid, asset tag. ManagementStatus, OSUpdateStatus, AvailableOSUpdates, appleTVid, enrollment_type, userid, useremail, username, usertype, SharedCartName, device_model_name, date_kinfo, location, latitude & longitude & altitude (only available for devices in lost mode), +DeviceAttestationStatus, CustomDeviceAttributes, last_ssid +If no specific columns are requested, all Service Subscription data for cellular devices will be returned in the response for both Slot 1 +and Slot 2. If you prefer to only receive specific data for Slot 1 and/or Slot 2, specify the keys below: +Slot 1: 'imeiOne', 'meid One', 'CarrierSettingsVersionOne', 'Current CarrierNetworkOne', 'CurrentMCCOne', 'CurrentMNCOne, +"ICCIDOne, 'IsDataPreferred One', 'IsRoamingOne, 'IsVoicePreferredOne', 'LabelOne', 'Labell DOne', 'PhoneNumberOne', "EIDOne' +Slot 2: 'imei Two', 'meid Two', 'CarrierSettingsVersion Two, 'CurrentCarrierNetwork Two', 'CurrentMCCTwo, 'CurrentMNCTwo' +"ICCIDTwo', 'IsDataPreferred Two', 'Is Roaming Two, 'Is VoicePreferred Two', 'LabelTwo", "Labell DTwo', 'PhoneNumber Two", "EIDTwo' +Devices Operations - List Devices +LastCloud BackupDate, SystemintegrityProtectionEnabled, BuildVersion, LocalHostName, HostName, OSUpdateSettings, ActiveManaged Users, CurrentConsoleManaged User, date printers, AutoSetupAdminAccounts, appleTVid, asset_tag ManagementStatus, OSUpdateStatus, AvailableOSUpdates, appleTVid, enrollment_type, userid, useremail, username, usertype, +SharedCartName, device model name, date kinfo, location, latitude & longitude & altitude (only available for devices in lost mode), +DeviceAttestationStatus, CustomDeviceAttributes, last_ssid +If no specific columns are requested, all Service Subscription data for cellular devices will be returned in the response for both Slot 1 and Slot 2. If you prefer to only receive specific data for Slot 1 and/or Slot 2, specify the keys below: +Slot 1: 'imeiOne', 'meidOne', 'CarrierSettingsVersionOne', 'CurrentCarrierNetworkOne', 'CurrentMCCOne', 'CurrentMNCOne', "ICCIDOne', 'IsDataPreferred One, 'IsRoamingOne', 'IsVoicePreferred One', 'LabelOne', "LabellDOne', "PhoneNumberOne, "EIDOne' +Slot 2: 'imei Two, 'meid Two', 'CarrierSettingsVersionTwo', 'CurrentCarrier Network Two', 'CurrentMCCTwo', 'CurrentMNCTwo', +"ICCIDTwo, 'IsDataPreferred Two', 'Is Roaming Two', 'Is VoicePreferred Two', 'LabelTwo", "Labell DTwo', 'PhoneNumberTwo", "EIDTwo' +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/1iatdevices! A +2 --header +Content-Type: application/json' \ +Content-Type: +3 --header Authorization: Bearer ((Bearer_Token}}' +4-data f +5 +6 +"accessToken": "Access Token" +"options": { +7 +"os": "ios" +8 +} +9) +Success Response: +1 1 +"status": "OK", +"response": { +"devices": [ +"deviceudid": "001DFCEB-B160-5F2C-B435-2D4D9F4570E0" +"total_disk": "256.0000000000", +"os": "ios" +others attributes and other devices +2 +3 +4 +5 +6 +7 +8 +9 +10 +} +11 +12 +13 +"rows":"1328 +"page_size": 100, +14 +"page": ! +15 +16} +Devices Operations - Lock Devices +To lock a device you will pass the value lock_device through the key operation and send the device UDID through the key parameter devices and the lock pin code through the key parameter pincode. You can send the message to display on the lock screen of the device through the key parameter lockmessage. +Key +Description +Type +Required +devices +Array[string] +Required +Devices UDID +pincode +Integer +Optional +Six-character PIN code (macOS only) +phonenumber +String +Optional +The phone number to display on the Lock Screen of the device +lockmessage +String +Ontional +The message to display on the Lock Screen of the device +*The pincode key value is available in macOS 10.8 and later. If no new pincode is provided, the last configured pincode will be used. It's important to note that this setting has no effect on iOS devices. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/bulkops +2 --header +Content-Type: application/json' +3 --header Authorization: Bearer ((Bearer Token))" +4 --data-raw { +"accessToken": "Access Token" +"elements":[ +"operation": "lock device", +"devices":["00001023-001234567890A018","1000a0bc0000000d123456e00fg99h10jk12345e"], +"pincode": "123456", +"lockmessage": "Your message!" +5 +6 +7 +8 +9 +10 +11 +12 +} +13 +1 +14) +Successful Response: +1 ( +status: "OK" +response: [ +2 +3 +4 +f +5 +6 +7 +} +8 +J +9) +status: "COMMAND SENT", +info: "Command sent successfully." +Devices Operations - Lock Devices +If a device is not found, the devices_notfound node will bring its udid: +1 ( +status: "OK", +response: [ +2 +3 +4 +5 +6 +7 +8 +} +9 +devices_notfound: [UDID2'], +status: "COMMAND SENT" +info: "Command sent successfully. +10) +Without 'devices' key: +1 ( +2 +3 +4 +5 +6 +7 +8 +status: "OK" +response: [ +status: "MISSING DATA info: "Missing key: devices" +9 } +Without 'devices' key: +1 ( +status: "OK +response: [ +status: "MISSING DATA" +info: "Missing key: devices" +2 +3 +4 +{ +5 +6 +7 +} +8 +1 +9) +The 'devices' key is empty: +Devices Operations - Lock Devices +status: "OK" +response: [ +status: "INVALID DATA" +info: "The device key is empty. Please, check and try again" +1 ( +2 +3 +4 +5 +6 +7 +8 +9 +1 +10) +The 'pincode' key is not an six-character integer: +1 { +2 +3 +4 +5 +6 +status: "OK" +response: [ +status: "INVALID_DATA", +info: "The pincode key must be a six-character integer" +7 +8 +1 +9) +No devices found: +status: "OK" +response: [ +{ +devices_notfound: ['UDID1', 'UDID2'], +status: "ERROR +info: The device selected is not valid. Please, check the device and try again" +1 ( +2 +3 +4 +5 +6 +7 +8 +9 +J +10 } +Devices Operations - Lost Mode (only iOS) +You will hit the endpoint /lostmode and send parameters to enable/disable lost mode and additional functions. +Key +Type +operation +String +Description +Required +enable +disable +play sound +request location +devices +Array of strings +Required +Array of Unique Device Identifier (Device UDID) +groups +Array of strings +Array of Device Group ID +message +String +Required +Message to be shown on the screen +phone_number +String +footnote +String +The phone number will be shown on the screen along with the message. +Footnote text will be shown on the screen along with the message. +*If any Device Group ID has been passed, it is not mandatory to inform the Unique Device Identifier. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/lostmode +2 --header 'Content-Type: application/json' +3 --header Authorization: Bearer {{Bearer_Token}} \ +4 --data-raw +accessToken": "Access Token' +elements" : [{ +5 +6 +7 +8 +9 +10 +11 +12 +}] +13) +"operation": "enable", +"groups":["210"], +"message": "I'm Lost :(", +"phone_number": "Call to (XXX) XXX-XXXX" +"footnote": "Footnote Text!" +operation +String +Required +Devices Operations - Lost Mode (only iOS) +enable +disable +play sound +request_location +devices +Array of strings +Required* +Array of Unique Device Identifier (Device UDID) +groups +Array of strings +Array of Device Group ID +message +String +Required +Message to be shown on the screen +phone_number +String +The phone number will be shown on the screen along with the message. +footnote +String +Footnote text will be shown on the screen along with the message. +*If any Device Group ID has been passed, it is not mandatory to inform the Unique Device Identifier. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/lostmode +2 --header +Content-Type: application/json' \ +3 --header Authorization: Bearer ((Bearer Token}}' \ +4 --data-raw ( +"accessToken": "Access Token", +elements": [{ +5 +6 +7 +8 +9 +10 +11 +12 +}] +13 } +operation": "enable" +groups":["210"], +"message": "I'm Lost :(", +"phone_number": "Call to (XXX) XXX-XXXX" +"footnote": "Footnote Text!" +Success Response: +1 ( +2 +3 +4 +5 +6 +7 +8 +9) +"status": "OK" "response":[ +"status":"COMMAND SENT" +"info":"Command sent successfully." +} +X +Devices Operations - Unassign Devices +To unassign a device you will pass the value change_to_limbo through the endpoint bulkops and send the Unique Device Identifier through the key parameter devices or/and Device Groups ID through the key parameter groups. You can also send both commands at the same time. +Key +Type +Description +operation +String +Required +change_to_limbo +devices +Array +Required* +An array of Unique Device Identifier (UDID). +groups +Array +Optional +An array of Device Group IDs - Sends the command to all devices in the group +*If any Device Group ID has been passed, it is not mandatory to inform the Unique Device Identifier. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/bulkops +2 --header 'Content-Type: application/json" +3 --header 'Authorization: Bearer ((Bearer_Token}} +4-data-raw { +5 +6 +7 +8 +accessToken": "Access Token" +elements +[ +"operation": "change to limbo" +"groups": [ +9 +10 +11 +12 +13 +14 } +Success Response: +"210" +11 +2 +3 +4 +5 +6 +status":"OK", +"response":[ +{ +"status":"COMMAND_SENT" +"info":"Command sent successfully." +7 +8 +1 +9} +Devices Operations - Update Device Attributes +Key +Type +serialnumber +String +Required +asset tag +String +tags +String +Description +Serial number of the device that will be updated. +To update the device asset tag. +To update the device tags. Multiple tags should be comma-separated. +name +String +To update the device name. +lock +String +To update the device lock message. +By hitting the endpoint /devices and sending those parameters like on the +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/devices 2 --header +Content-Type: application/json' +3 --header Authorization: Bearer {{Bearer_Token}}' \ +4 --data ( +"accessToken": "Access Token", +elements": [ +5 +6 +7 +f +8 +9 +10 +'serialnumber": "XX +"tags": "New Tag" +11 +12 } +Success Response: +11 +"status": "OK" +2 +3 +"devices": [ +4 +"AAAA AAAAA" +5 +1 +6) +20 +Devices Operations - Bulk Operations - Wipe Devices +To wipe a device you will pass the value bulkops through the endpoint and send the Unique Device Identifier through the key parameter devices or/and Device Groups ID through the key parameter groups. You can also send both commands at the same time. +Description +Key +Type +operation String +Required wipe devices +devices Array +Required An array of Unique Device Identifier (UDID). +groups +Array +An array of Device Group IDs - Sends the command to all devices in the group +options Object (key => +value) +pin_code (6 digits) [macOS only] +PreserveDataPlan (bool) (iOS only) +DisallowProximitySetup (bool) (iOS only) +RevokeVPPLicenses (bool) [iOS & tvOS only] +EnableReturn To Service (bool) [iOS & tvOS only) - When enabled, this service will use the default WiFi which can be set in the WiFi +Authentication profile. +*If any Device Group ID has been passed, it is not mandatory to inform the Unique Device Identifier. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/bulkops +2 --header 'Content-Type: application/json' +3 --header Authorization: Bearer {{Bearer_Token}} \ +4 --data-raw +АААААААААААААААА" +5 +"accessToken": "AccessToken" +6 +7 +8 +9 +"elements":[ +"operation": "wipe_devices" "devices":[ +10 +ΑΑΑΑΑ +AAA +11 +17 +12 +"options": { +13 +"RevokeVPPLicenses": "false" +14 +15 +16 +17 }' +Devices Operations - Bulk Operations - Wipe Devices +groups +Array +options +Object (key => +value) +An array of Device Group IDs - Sends the command to all devices in the group +pin_code (6 digits) [macOS only) +PreserveDataPlan (bool) (iOS only] +DisallowProximitySetup (bool) (iOS only] +RevokeVPPLicenses (bool) (iOS & tvOS only) +EnableReturn To Service (bool) [iOS & tvOS only] - When enabled, this service will use the default WiFi which can be set in the WiFi +Authentication profile. +*If any Device Group ID has been passed, it is not mandatory to inform the Unique Device Identifier. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/bulkops' +2 --header 'Content-Type: application/json' \ +3 --header Authorization: Bearer {{Bearer_Token}}' X +4-data-raw ( +accessToken": "Access Token", +"operation": "wipe_devices", +"devices": [ +"AAAAA +"options": { +5 +6 +"elements": [ +7 +8 +9 +10 +11 +12 +13 +14 +15 +} +16 +17 } +Success Response: +"RevokeVPPLicenses": "false" +11 +2 +"status":"OK" +"response":[ +3 +4 +{ +5 +6 +"status":"COMMAND_SENT" +"info":"Command sent successfully." +7 } +8 +1 +91 +AAAA +Devices Operations - Bulk Operations - Restart Devices +To restart a device you will pass the value bulkops through the endpoint and send the Unique Device Identifier through the key parameter devices or/and Device Groups ID through the key parameter groups. You can also send both commands at the same time. +Key +Туре +Description +operation +String +Required +restart_devices +devices +Array +Required +An array of Unique Device Identifier (UDID). +groups +Array +An array of Device Group IDs - Sends the command to all devices in the group +*If any Device Group ID has been passed, it is not mandatory to inform the Unique Device Identifier. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/bulkops +2 --header 'Content-Type: application/json +3 --header Authorization: Bearer {{Bearer_Token}} +4 --data-raw { +"accessToken": "Access Token +"elementa": [ +operation": "restart devices", "groups": [ +5 +6 +7 +8 +9 +10 +"210" +11 +J +12 +13 +1 +14 ) +Success Response: +1 ( +2 +3 +4 +5 +6 +7 +"status": "OK" +"response":[ +( +"status":"COMMAND_SENT" +"info":"Command sent successfully." +} +8 +1 +9) +Devices Operations - Bulk Operations - Shutdown Devices +To shutdown a device you will pass the value bulkops through the endpoint and send the Unique Device Identifier through the key parameter devices or/and Device Groups ID through the key parameter groups. You can also send both commands at the same time. +Description +Key +Type +operation +String +Required +shutdown devices +devices +Array +Required +An array of Unique Device Identifier (UDID). +Array +groups +An array of Device Group IDs - Sends the command to all devices in the group +*If any Device Group ID has been passed, it is not mandatory to inform the Unique Device Identifier. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/bulkops' +2 --header +Content-Type: application/json' \ +3 --header Authorization: Bearer ((Bearer_Token}} \ +4 --data-raw ( +5 +6 +7 +8 +9 +10 +11 +12 +13 +1 +14) +accessToken": "Access Token +elements": [ +"operation": "shutdown devices" +"groups": [ +"210" +Success Response: +1 ( +2 +"status":"OK" +"response":[ +f +"status":"COMMAND SENT" +"info":"Command sent successfully." +3 +4 +5 +6 +7 +} +8 +1 +9 } +Devices Operations - Bulk Operations - Clear Commands +To clear commands you will pass the value bulkops through the endpoint and send the Unique Device Identifier through the key parameter devices or/and Device Groups ID through the key parameter groups. You can also send both commands at the same time. +Key +Туре +operation +String +Required +Description +clear_commands (pending + failed) +clear pending.commands +clear_failed_commands +devices +Array +Required +An array of Unique Device Identifier (UDID). +Array +groups +An array of Device Group IDs - Sends the command to all devices in the group +*If any Device Group ID has been passed, it is not mandatory to inform the Unique Device Identifier. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/bulkops' +2 --header +Content-Type: application/json' +3 --header 'Authorization: Bearer {{Bearer_Token}}' \ +4 --data-raw ( +5 +accessToken": "Access Token +6 +"elements":[ +7 +8 +"operation": "clear commands +9 +10 +"groups" : [ +210" +11 +12 +} +13 +14) +Success Response: +11 +2 +3 +4 +5 +6 +"status":"OK", +"response":[ +"status":"COMMAND CLEARED" "info":"Command cleared successfully." +7 +8 +1 +9) +Devices Operations - Bulk Operations - Activation Lock +When you access the Mosyle API endpoint /bulkops passing the value enable activationlock through the parameter operation you will enable MDM +initiated Activation Lock on all listed devices. +To disable MDM initiated Activation Lock, access the Mosyle API endpoint /bulkops passing the value disable_activationlock through the parameter +operation. +Available options: +Key +Type +Required +Description +operation +String +Required +enable activationlock +disable activationlock +devices +Array [string] +Required +Array of Unique Device Identifier (Device UDID) +lost message +String +Optional +The message to display on the screen of the device +Example Request to Enable Activation Lock: +1 curl --location 'https://managerapi.mosyle.com/v1/bulkops +2 --header Content-Type: application/json' \ +3 --header Authorization: Bearer ((Bearer_Token}}' \ +4 --data { +5 +6 +7 +8 +"accessToken": "Access Token", +"elements": [ +"operation": "enable_activationlock", "devices": [ +"ABCDEF12-34567890ABCDEF12", +"ABCDEF12-34567890ABCDEF 34" +9 +10 +11 +12 +1, +13 +"lost_message": "Enter your Lost Message +14 +15 +16} +operation +String +Devices Operations - Bulk Operations - Activation Lock +Required +enable activationlock +disable activationlock +devices +Array [string] +Required +Array of Unique Device Identifier (Device UDID) +lost message +String +Optional +The message to display on the screen of the device +Example Request to Enable Activation Lock: +1 curl --location "https://managerapi.mosyle.com/vl/bulkops +2 --header 'Content-Type: application/json' \ +3 --header Authorization: Bearer ((Bearer_Token}}' \ +4 --data ( +accessToken": "Access Token +"elements": [ +5 +6 +7 +8 +9 +10 +11 +12 +}, +13 +14 +"operation": "enable activationlock" +"devices": [ +"ABCDEF12-34567890ABCDEF12" +"ABCDEF12-34567890ABCDEF34" +"lost_message": "Enter your Lost Message" +15 +16 ) +Example Request to Disable Activation Lock: +1 curl --location 'https://managerapi.mosyle.com/v1/bulkops +2 --header 'Content-Type: application/json' +3 --header 'Authorization: Bearer Bearer Token' +4 --data +5 +6 +7 +8 +"accessToken": "Access_Token" +elements": [ +"operation": "disable activationlock", +devices":[ +"ABCDEF12-34567890ABCDEF12" +"ABCDEF12-34567890ABCDEF34" +9 +10 +11 +12 +1 +13 +14 +1 +15) +Devices Operations - Bulk Operations - Move Devices to Accounts (District Only) +To move devices from the District Level to a specific account you will pass the value move_device_account through the key operation and send the Device UDID through the key parameter devices and/or the Device Group ID through the key parameter groups. You can send both commands at the same time. +Key +Description +move_device_account +Type +Required +operation +String +Required +devices +Array +Required +An array of Unique Device Identifiers (UDID) +AccountID +Integer +Required +Account ID where the device should be moved +groups +Array +Options +An array of Device Group IDs +NOTE: There is a limit of 200 elements per request. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/bulkops' +2 --header 'Content-Type: application/json' \ +3 --header Authorization: Bearer {{Bearer_Token}}' A +4 --data-raw ( +accessToken": "Access Token" +"operation": "move device account", +"devices":["00001023-001234567890A018","1000a0bc0000000d123456e001g99h10jk12345e"], +"AccountID": "123", +5 +6 +"elements": [ +7 +8 +9 +10 +11 +"groups": ["27"] +12 +} +13 +14) +Successful Response: +1 { +status: "OK +response: [ +2 +3 +4 +{ +5 +6 +7 +} +8 +1 +9) +Devices Operations - Bulk Operations - Move Devices to Accounts (District Only) +status: "COMMAND SENT" +info: "Command sent successfully." +If the account is not found: +status: "OK" +response: [ +status: "ACCOUNT_NOTFOUND" +info: "No account found." +1 ( +2 +3 +4 +5 +6 +7 +} +8 +1 +9) +Without 'AccountID' key: +1 ( +2 +3 +4 +5 +6 +status: "OK" +response: [ +status: "MISSING_DATA" +info: "Missing key: AccountID" +7 +} +8 +J +9) +If the request is made from an account that is not a District Account: +response: [ +status: "NOT ALLOWED +1 ( +2 +status: "OK" +3 +4 +5 +6 +7 +8 +} +9 +J +10 } +info: "This operation is available only for District Level" +Devices Operations - Bulk Operations - Change/Update Limbo Location +To change or update the location of devices in Limbo you will pass the value update limbo_location through the key operation and send the Device UDID through the key parameter +devices and/or the Device Group ID through the key parameter groups. You can send both commands at the same time. +Key +Type +Required +Description +operation +String +Required +update_limbo_location +devices +Array +Required +An array of Unique Device Identifiers (UDID) +location +String +Required +The name of the location to assign the devices. +groups +Array +An array of Device Group IDs - update the location of all devices in the group +NOTE: To update or change the location of limbo devices, the setting "Limbo devices belong to all locations must be disabled under My School > Preferences > Other Settings > General +Preferences. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/bulkopa +2 --header Content-Type: application/json" \ +3--header Authorization; Bearer ((Bearer_Token}} \ +4 --data-raw +5 +"accessToken": "Access_Token" +6 +"elements": [ +7 +B +9 +10 +11 +12 +13 +1 +14 +"operation": "update limbo_location" +"devices":["00001023-001234567890018","1000a0be0000000d123456c00fg99hi0jk12245e"], +"location": "Mosyle School", +"groups":["27" 1 +Successful Response: +1 ( +status: OK +2 +3 +( +6 +7 +response: [ +status: "COMMAND_SENT" +info: "Command sent successfully to all Limbo devices. +B +9) +20 +Users Operations - List Users +Key +page +Туре +integer +specific_columns Array of +strings +types +Array of +string +identifiers +idusers +Array of +integers +Description +The API does not send the entire list of users in one request, it needs to use pagination (default: 1). +Arboret This option should be used to receive just the necessary attributes for each user. Possible values: id, name, email, grades, +managedappleid, serial number, type, locations, account, assigned_devices +Filter users by type. Possible values: STUDENT, TEACHER, LOCATION LEADER, STAFF, ADMIN, ACCOUNT ADMIN, +DISTRICT ADMIN. +Chronian Filter users by User ID +Array of Amo Filter users by Unique Internal Mosyle ID integers +You will hit the endpoint /listusers and can send parameters to filter your request for the specific info you want to receive in your response. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/listusers' +2 --header +Content-Type: application/json' \ +3 --header Authorization: Bearer ((Bearer_Token)) A +4 --data( +5 +6 +7 +8 +9 +10 +"accessToken": "Access_Token", +"options": { +"specific_columns": [ +type +11) +page +Integer +specific columns Array of +strings +types +Array of +string +CHOWIT +identifiers +Array of +integers +Users Operations - List Users +The API does not send the entire list of users in one request, it needs to use pagination (default: 1). +This option should be used to receive just the necessary attributes for each user. Possible values: id, name, email, grades, +managedappleid, serial_number, type, locations, account, assigned_devices +Filter users by type. Possible values: STUDENT, TEACHER, LOCATION LEADER, STAFF, ADMIN, ACCOUNT ADMIN, +DISTRICT ADMIN. +Filter users by User ID +idusers +Array of +integers +Filter users by Unique Internal Mosyle ID +You will hit the endpoint /listusers and can send parameters to filter your request for the specific info you want to receive in your response. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/listusers +2 --header 'Content-Type: application/json' \ +3 --header Authorization: Bearer ((Bearer Token}} \ +4 --data +5 +6 +7 +8 +9 +"accessToken": "Access_Token" +"options": { +"specific_columns": [ +"type" +10 +11) +Success Response: +1 ( +2 +"status": "OK" +"response": { +3 +4 +5 +6 +7 +8 +9 +10 +} +11} +"users": [ +"id": "dc093492-d2bf-4c0a-9a8e-5aadc541e250", "type": "STUDENT" +Users Operations - Create Users +To create a user you will pass the value save through the parameter operation. +Key +Туре +Description +id +String +max: 255 +Required +This is the User ID. This MUST be unique inside the School Database and will be used for other services. +chars +operation +string +Required +save +name +String +Required +User Name +max: 100 +chars +type +string +Required +Possible values: +S: Student +T: Teacher +STAFF: Staff +email +String +max: 255 +chars +Required (Optional +User E-mail address +for students and +staff) +managed appleid String +max: 255 +chars +locations +Array +Required for +Students, Teachers, +and Staff +welcome email +Integer +Managed Apple ID created in ASM +Each array position should contain 2 keys: name, grade level. The key 'grade level' is required only for students (for +other user types this key can be omitted). Location Name and Grade Level have a limit of 50 characters each. +Required Values: 1 +(one): 0 (zero) +When the value is 1, Mosyle Manager will send an email with the instructions to login. This option will only work when +the email field is not blank. +idaccount +integer +Required if District +account +School account ID where the user should be added. +welcome email Integer +Required Values: 1 +Users Operations - Create Users +When the value is 1, Mosyle Manager will send an email with the instructions to login. This option will only work when +the email field is not blank. +(one): 0 (zero) +idaccount +integer +Required if District +account +School account ID where the user should be added. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/users +2 --header Content-Type: application/json" +3 --header 'Authorization: Bearer ((Bearer Token))' \ +4 --data-raw { +"accessToken": "Access Token" +"elements": [ +"operation": "save", +"id": "example.student" +"name": "Example Student "type": "S", +"email": "example.student@mosyle.com" "locations": [ +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +], +19 +20 +21 +"name": "Cityview Day School" +"grade_level": "Kindergarten" +"welcome_email": 0 +22 ) +Success Response: +1 ( +'status': 'OK', +'elements': [ +2 +3 +4 +5 +6 +7 +} +8 +1 +9} +id': user.staff.1' +'status': 'OK' +Users Operations - Update Users +To update a user you will pass the value update through the parameter operation. +Key +Type +id +String +Required +max: 255 +chars +Description +This is the User ID. This MUST be unique inside the School Database and will be used for other services. +operation +string +Required +update +name +String +User Name +max: 100 +type +chars +string +email +String +max: 255 +chars +CHICHINE +managed appleid String +Possible values: +S: Student +T: Teacher +STAFF: Staff +User E-mail address +Managed Apple ID created in ASM +max: 255 +chars +locations +Array +Each array position should contain 2 keys: name, grade level. The key grade level' is required only for students (for other user +types this key can be omitted). Location Name and Grade Level have a limit of 50 characters each. +idaccount +integer +Required if +District +account +School account ID where the user should be updated +chars +Users Operations - Update Users +managed_appleid String +max: 255 +chars +Managed Apple ID created in ASM +locations +Array +Each array position should contain 2 keys: name, grade level. The key 'grade level' is required only for students (for other user +types this key can be omitted). Location Name and Grade Level have a limit of 50 characters each. +idaccount +integer +Required if +School account ID where the user should be updated +District +account +Example request: +1 curl --location https://managerapi.nosyle.com/v2/users +2 --header 'Content-Type: application/json" V +3 --header Authorizations Bearer ((Bearer_Token)) A +4 --data-raw ( +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +"accessToken": "Access_Token" +"elements': [ +"operation": "update" +"id": "example.student", +"name": "Example student", "type": "", +"email": "example.student@mosyle.com +"locations": [ +"name": "Cityview Day School" +"grade_level": "Rindergarten" +Success Response: +1 +2 +'status': 'OK +3 +'elements': [ +4 +5 +'id': 'example.student +6 +'status'1 'OK! +7 +8 +9 +Users Operations - Delete User +Key +Туре +Description +id +String max: 255 chars +Required +This is the User ID. This MUST be unique inside the School Database and will be used in other services. +operation +string +Required +delete +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/users +2 --header 'Content-Type: application/json +3 --header Authorization: Bearer ((Bearer Token}} +4 --data-raw ( +"accessToken": "Access Token +"elements":[ +5 +6 +7 +8 +9 +10 +11 +12 }' +Success Response: +"operation": "delete" +"id": "new.user.1° +11 +2 +"status": "OK" +3 +"elements": [ +4 +5 +6 +"id": "user.staff.1", +"status": "OK" +7 +8 +1 +9} +Users Operations - Assign Devices +Key +Туре +id +String max: 255 chars +Required +operation +string +Required +Description +This is the User ID. This MUST be unique inside the School Database and will be used for other services. +assign_device +serial number +string +Required +Assign a specifc device to the user. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/users' +2 --header 'Content-Type: application/json' \ +3 --header Authorization: Bearer {{Bearer Token}}' \ +4 --data-raw ( +accessToken": "Access Token' +"elements":[ +5 +6 +7 +8 +9 +10 +11 +12 +1 +13) +"operation": "assign_device" +"id": "new.user.1", +serial number": "AAAAAAAAAAAA" +Success Response: +1 { +2 "status": "OK" +elements": [ +3 +4 +5 +6 +7 +} +8 +1 +9) +"id": "user.staff.1", +"status": "OK" +Key +Туре +id +String (max: 100) +operation +String +Classes - Save and Delete Classes +Description +Required Class ID in the Education Institution Database. +Required save: Save or update the class in the system. +delete: Delete the class +course_name +String max: 50 chars +Required Course Name +class_name +String max: 50 chars +Required +Class Name +location +String max: 50 chars +Required +Location name. If the Location does not exist, one will be created with this name. +idteacher +String +Required +Teacher ID, same ID value entered in the User Web Service. +students +Array +Array of student IDs. The Student must be the same modality of the class. Class 1:1 just contain students 1:1. +room +String max: 50 chars +Room where the class is offered. +coordinators +Array +platform +String +Array of Instructor User IDs. The User ID can not belong to a student. +The absence of this value will default to the "ios" platform. This value can be ios or mac. +You will hit the endpoint /classes and pass the value save or delete through the parameter operation. +Classes - Save and Delete Classes +course_name +String max: 50 chars +Required Course Name +class_name +String max: 50 chars +Required Class Name +location +String max: 50 chars +Required +Location name. If the Location does not exist, one will be created with this name. +idteacher +String +Required +Teacher ID, same ID value entered in the User Web Service. +students +Array +Array of student IDs. The Student must be the same modality of the class. Class 1:1 just contain students 1:1. +room +String max: 50 chars +Room where the class is offered. +coordinators +Array +platform +String +Array of Instructor User IDs. The User ID can not belong to a student. +The absence of this value will default to the "ios" platform. This value can be ios or mac. +You will hit the endpoint /classes and pass the value save or delete through the parameter operation. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/classes +2 --header +Content-Type: application/json' \ +3 --header Authorization: Bearer {{Bearer Token)) A +4-data +5 +6 +7 +( +accessToken": "Access Token +"elements": [ +8 +9 +10 +11 +12 +13 +14 +} +15 +16) +"operation": "save" +"id": "class.id", +course_name": "Test API" "class_name": "Class Test", "location": "Mosyle Training", "idteacher": "teacher.api" +Success Response: +1 ( +2 +3 +"status": "OK", +"uuid": "123456789" +4) +Classes - List Classes +Key +Type +Description +integer +Optional The API will not send the entire list of classes in one request, rather it uses pagination (default: 1). +page +specific_columns Array of +strings +Optional This option should be used to receive just the necessary attributes for each class. Possible values: id, class_name, course_name, +location, teacher, students, coordinators, account. +You will hit the endpoint /listclasses and can send the parameter options as an array to filter your search +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/listclasses +2 --header Content-Type: application/json' \ +3 --header Authorization: Bearer {{Bearer_Token}}' \ +"accessToken": "Access Token" +"options": +4 --data { +5 +6 +7 +8) +9) +"Access_Token" +"specific_columns": ["class_name", "teacher", "location"] +Success Response: +"OK" +"response": { +"classes" : [ +{ +"id": "dc093492-d2bf-4c0a-9a8e-5aadc541e250" +"idclass": "123", +"name": "class I", +11 +2 +"status": +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +} +15) +"teacher": "john.smith", "locations": [ +"Townsville" +X +Accounts (District Only) - Get Accounts +X +For district accounts, hit the endpoint /accounts to get a list of all accounts. +Example request: +1 curl --location https://managerapi.mosyle.com/v2/accounts' +2 --header 'Content-Type: application/json' \ +3 --header 'Authorization: Bearer ((Bearer_Token}} +4 --data +5 +6) +"accessToken": "Access Token" +"accessToken +Success Response: +1 ( +2 +"status": "OK" +"accounts": [ +3 +4 +5 +"idaccount": +6 +7 +8 +"name": "Account 1", +"address": "Street 1 +"date_created": "1556195183" +9 +10 +11 +12 +13 +"idaccount": "2", +"name": "Account 2", +"address": "Street 2 +14 +"date_created": "1556195196" +15 +} +16 +1 +17 } +Accounts (District Only) - Create new Account +Key +Type +Description +operation +String +Required +The value of this operation must be 'request: +school_name +String +Required +The name of the new account. +school address +String +Required +The address info of the new account. +leader_name +String max: 100 chars +Outional +The name of the account leader. +leader email +String max: 255 chars +Optional +The email of the account leader. +leader id +String max: 255 chars +Optional +The id of the account leader. +uuid +String max: 255 chars +Optional +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/accounts +2 --header Content-Type: application/json' \ +3 --header Authorization: Bearer ((Bearer_Token}}' V +4 --data-raw +5 +6 +7 +8 +"accessToken": "Access_Token" +"elements": [ +9 +10 +11 +} +12 +13) +"operation": "request", +"school_name": "New School" +school address": "New School Street" +Success Response: +1 ( +2 +"status": "OK", +3 +"uuid": "123123" +4) +Key +Туре +action +String Required +wifimac +String +Required +serialnumber +String +Required +model +String +Cisco ISE - Cisco ISE - Add and remove Devices +Description +Values can be add or remove, in order to add or remove the mac address and serial number from the Cisco ISE list. +Device model, Limit 50 characters. +You will hit the endpoint /ciscoise and pass the value add or remove through the parameter action. +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/ciscoise! +2 --header Content-Type: application/json' +3 --header 'Authorization: Bearer ((Bearer_Token}}' +4 --data( +5 +6 +7 +8 +9 +10 +11 +12 +accessToken": "Access Token +elements": [ +"action": "add", +"wifimac": "XX:XX:XX:XX:XX:XX" "serialnumber": "XXXXXXXXXXXX" +13} +X +Cisco ISE - Cisco ISE - Get Device +In this operation you just need to hit the endpoint /getciscoise and can send the parameter paging, check out the example below +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/getciscoise' +2 --header 'Content-Type: application/json' A +3 --header Authorization: Bearer ((Bearer_Token}} \ +4 --data ( +5 +6) +accessToken": "Access Token" +Dynamic Device Groups Operations - List Dynamic Device Groups +You will hit the endpoint /listdevicegroups and can send parameters to filter your request for the specific info you want to receive in your response or +receive all info about dynamic device groups. +Available options: +Key +Type +Required +Description +enum ('ios', 'mac, 'tvOS, 'visionos") +Required +Operational system +page +integer +Pagination starting with O +Dynamic Device Groups Operations - List Dynamic Device Groups +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/listdevicegroups' +2 --header +Content-Type: application/json +3 --header Authorization: Bearer ((Bearer Token}} +((Bearer_Token}}') +4 --data +5 +accessToken": "Access Token" +6 +"options": { +7 +"os": "mac" +8 +9) +Example Response: +1 { +2 +23 +4 +status: "OK", +response: [ +1 +groups: [ +id: "210" +name: "My Device Group device numbers: "3", +5 +6 +7 +8 +9 +10 +} +11 +J. +12 +rows: +13 +page size: 50 +14 +page: +15 +} +16 +1 +17 } +2 +3 +Without 'os' key: +1 ( +status: "OK" +response: [ +4 +{ +5 +status: "MISSING_DATA" +6 +7 +} +8 +1 +9) +info: "Missing key: os +Dynamic Device Groups Operations - List Devices +You will hit the endpoint/listdevicesbygroup and can send group ID to filter your request for the specific dynamic device group you want to receive in your +response. +Available options: +Key +Type +Required +Description +iddevicegroup +string Required Dynamic Device Group ID (you can obtain this data using the "List Dynamic Device Groups" operation) +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/listdevicesbygroup' +2 --header Content-Type: application/json' \ +3 --header Authorization: Bearer {{Bearer_Token)) A +4 --data-raw ( +5 +6 +7 +8 +accessToken": "Access Token +"options": { +"iddevicegroup":"123" +9) +Successful Response: +1 ( +2 +status: "OK +3 +response: ( +4 +5 +6 +7 +8 +9 +10 +11 } +group_name": "Class 101", +"udids":[ +J +} +1CD85FCF-04EA-5540-9E73-94FB4D36A392 +"22473995-BE4A-0CEO-FA60-26827D981212" +"E4ED28D6-6C5D-585C-93FB-AESAD12321J3" +X +Dynamic Device Groups Operations - Add/Remove Device from Dynamic Device Group +When you access the Mosyle API endpoint /devicegroups passing the value update_devices through the parameter operation you can add or remove specific device UDIDs from a device group. This action requires the key parameter idgroup to filter which Dynamic Device Group you want to add or remove the +devices. +Available options: +Key +Type +Required +Description +operation +string +Required +update_devices +idgroup +integer +Required +Device Group ID +add +[string] +remove +[string] +List of the Device UDIDs to add to the specific device group +List of the Device UDIDs to remove from the specific device group +* At least one must be included +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/devicegroups' +2 --header 'Content-Type: application/json' \ +3 --header Authorization: Bearer ((Bearer Token}} +4 --data-raw +5 +6 +7 +8 +9) +accessToken": "Access Token" +operation": "update devices +"idgroup":"154", +"add": [ "AAAAAAAA-1234-4321-A182-AAAAA +AAAA" 1 +Success Response: +1 ( +2 +status: "OK +3 +response: [ +4 +5 +status: "OK" +6 +7 1 +8) +info: "110", +Dynamic Device Groups Operations - List Devices in Device Groups +You will hit the endpoint /listdevicegroupsdevices and can send parameters to filter your request for the specific info you want to receive in your response about device groups. +Available options: +Key +Туре +Required +Description +OS +enum ('ios', 'mac, 'tvos') +Required +Operational system +page +integer +OutMail +Pagination starting with 1 +page_size +integer +Optional +Default is 50 +Dynamic Device Groups Operations - List Devices in Device Groups +X +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/listdevicegroupsdevices' +2 --header Content-Type: application/json' \ +3 --header Authorization: Bearer ((Bearer_Token}} \ +4 --data +"options": { +5 +"accessToken": "Access Token +6 +7 +"os": "mac" +8 +9) +Response: +1 ( +2 +status: 'OK' +3 +response: [ +4 +1 +5 +6 +7 +8 +9 +groups: L +id: '210', +name: 'My Device Group', +device_numbers: '1', +10 deviceudids: ["02345030-000A34203A83B02"], +11 +12 +13 +} +J. +14 +15 +rows: +page size: 50 +16 +page: +17 +18 +19 } +Without 'os' key: +1 { +2 status: 'OK' +3 +response: [ +4 +5 +6 +( +status: MISSING DATA +info: 'Missing key: os +7 +} +8 +9) +Dynamic Device Groups Operations - List Devices in Device Groups +You will hit the endpoint/listdevicegroupsdevices and can send parameters to filter your request for the specific info you want to receive in your response about device groups. +Available options: +Key +Туре +Required +Description +enum ('ios; 'mac, 'tvos') +Required +Operational system +page +integer +Optional +Pagination starting with 1 +page_size +integer +Optional +Default is 50 +Dynamic Device Groups Operations - List Devices in Device Groups +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/listdevicegroups devices' +2 --header Content-Type: application/json' \ +3 --header Authorization: Bearer ((Bearer_Token}}' \ +4 --data ( +5 +accessToken": "Access Token +6 +"options": { +7 +"os": "mac" +8 +9) +Response: +1 ( +response: [ +2 +status: 'OK' +3 +4 +5 +6 +7 +8 +9 +groups: [ +id: 210', +name: My Device Group +device_numbers: '1', +10 deviceudids: ["02345030-000A34203A83B02F"], +11 +12 +} +13 +1, +14 +15 +16 +17 +} +18 +J +rows: +page size: 50 +page: +19 } +Without 'os' key: +1 ( +2 +status: +OK, +3 +response: [ +4 +5 +status: MISSING DATA' +6 +info: Missing key: os' +7 +8 +1 +9) +Action Logs - List +Key +Type +page +Integer +filter_options Array of +strings +Description +The API does not send the entire list of logs in one request. Pagination should be used to get more data if the response has more pages (default: 1). +Values that can be used to filter the Action Logs: start date (timestamp), end_date (timestamp), idusers (array of users id). +page +Integer +Action Logs - List +The API does not send the entire list of logs in one request. Pagination should be used to get more data if the response has more pages (default: 1). +filter options Array of +Values that can be used to filter the Action Logs: start date (timestamp), end_date (timestamp), idusers (array of users id). +strings +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/adminlogs +2 --header 'Content-Type: application/json' \ +3 --header 'Authorization: Bearer ((Bearer_Token))' \ +4 --data-raw +5 +"accessToken": "Access Token" +6 +"filter options": +7 +"start_date": "1696561838" +8 +"end_date":"1696821038" +9) +10 } +Success Response: +1 ( +2 +"status": "OK", +"response": [ +3 +4 +{ +5 +6 +7 +8 +9 +"logs":[ +10 +11 +12 +13 +14 +15 +} +16 +1, +17 +18 +19 +20 +21 +J +22 } +"action": "Save Profile". +"details": { +}, +"Profile Type": "Install App +"Operating System": "macos +"username": "Catalog" +"action_date":"2021-03-01", "ip": "127.0.0.1" +"rows": "1", +"page_size": +"page": 1 +50 +Mosyle Logs Stream - Mosyle Logs Stream +To use the Mosyle Logs Stream API, you first need to configure the options under My School > Integrations > Mosyle Logs Stream. When configuring the integration method, choose "Mosyle Logs Stream API". +Obtain Access Token +Once Mosyle Logs Stream API is configured, you will see your access token and the option to configure the Access Method as well as select the Log Streams +of interest. +You'll make requests to the endpoint" +structured in JSON format. +*The Mosyle API supports the POST request method. All API responses are +Request Bearer Token +To start, make a request to the Mosyle API endpoint "/login" including the email and password in the body of the request and the access token in the header. +Mosyle Logs Stream - Mosyle Logs Stream +X +Example request: +1 curl --include --location +2 --header +https://schoolapilogs.moayle.com/vi/login' +accessTokens Access Token +3--header Content-Type: application/json" +4 --data-raw ( +5 +6 +7 +"email" "User Email +"password": "User Password" +Example response: +1 HTTP/1.1 200 OK +2 Date: Mon, 21 Aug 2023 17:31:09 GMT +3 Server: Apache +4 X-Frame-Options: SAMEORIGIN +5 X-XSS-Protection: ; mode=block +6 X-Content-Type-Options: nosniff +7 Content-Security-Policy: frame-src 'self' 'unsafe-eval' 'unsafe-inline' +8 Strict-Transport-Security: max-age=3072000; includeSubdomains; +.mosyle.com frame-ancestors 'self' +9 Set-Cookie: PHPSESSID=8901c23c1234e5678b901d2a34a56cc7; path=/; domain=.mosyle.com; secure; HttpOnly 10 Expires: Thu, 19 Nov 1981 08:52:00 GMT +11 Cache-Control: no-store, no-cache, must-revalidate +12 Pragma: no-cache +13 Authorization: Bearer Bearer_Token +14 Content-Length: 5) +15 Content-Type: application/json +16 +17 {"UserID":"User ID", "email":"User Email +The response will contain a +Mole as a JSON Web Token (JWT) in the header which will be needed for subsequent requests. The token will expire +every 24 hours and will need to be renewed. +When accessing any other Mosyle Logs Stream API endpoints, include the string "Bearer" followed by the JWT in the request header along with the access +token. +*Note: If you are using PowerShell, you will need to utilize 'Invoke-WebRequest' to view the Bearer token to then parse or copy/paste it as necessary. +The following snippet will be used in all subsequent requests: +1 curl --location https://schoolapilogs.mosyle.com/vi' \ +2 --header 'Content-Type: application/json" +3 --header +4 --header +accessTokens Access Token A +Authorization: Bearer Bearer_Token' +Request Logs Stream +Mosyle Logs Stream - Mosyle Logs Stream +When you access the Mosyle Logs Stream API endpoint /logsstream, all selected logs will be listed. You can pass an additional parameter to filter your search or change the result. +Available options: +Key +Туре +Required Description +LogType String [array] +page +Required Array containing the types of logs you want to retrieve (among those selected previously in Mosyle Logs Stream Form). +Available options: zero_trust, action_logs, compliance, av, and dns. +Integer CMW Default 1 +50 results per page +X +Mosyle Logs Stream - Mosyle Logs Stream +Example request: +1 curl --location 'https://schoolapilogs.mosyle.com/vi/logsstream' +2 --header 'Content-Type: application/json' \ +3--header accessToken: Access Token' \ +4 --header Authorization: Bearer Bearer Token' A +5 --data ( +"LogType" : [ +"zero trust", +'action logs +"compliance" +6 +7 +8 +9 +10 +11 +dns +12 +1 +13) +"av", +Example Response: +1 { +2 +"status": "OK" +3 +"response": { +4 +"av": { +5 +"Logs" : [ +6 +7 +1, +8 +9 +10 +11 +12 +}, +13 +14 +15 +"Page":1, +"ItensPerPage": 5000, +"TotalLogs": +"TotalPages": +"zero_trust":{ +"Events": { +"TotalLogs": +16 +17 +18 +"TotalPages": +"ItensPerPage": 2500, +19 +20 +{ +21 +22 +23 +24 +25 +26 +27 +28 +"Page": +"Logs":[ +"Device": "MacBook Air", +"Application": +"com.google.Chrome.UpdaterPrivilegedHelper "FileName": "com.google.Chrome.UpdaterPrivilegedHelper", "Action": "Trusted" +"Source": "Manual" +"Timestamp": "1710264696", +"Identifier": "com.google.Chrome.UpdaterPrivilegedHelper" "Hash": "4e28088b... +Mosyle Logs Stream - Mosyle Logs Stream +47 +1 +48 +}, +49 +"ios": { +50 +"Page": +51 +52 +"ItensPerPage": 2500, +"TotalLogs": +53 +"TotalPages": +54 +55 +1 +56 +57 +58 +59 +60 +"SerialNumber": "123456CD78" +61 +"Logs" : [ +"Status": "Lost Compliance" +"RuleName": "Cookies are allowed from visited websites only", +"Timestamp": "01:00 PM - 03/12/2024", +"DeviceName": "iPad 100", +"E-mail": "test@mail.com" +62 +63 +64 +65 +}, +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +"action_logs": { +"Page": +"ItensPerPage": 5000, +"TotalLogs": +"TotalPages": +"Logs" : [ +"UserName": "Jane Smith", +"Action": "Save Device Group" +"ActionDate": "1710267184", +"Content": "Name: ##DEVICE GROUP VS\n" "IP": +::1", +"E-mail": "jane.smith@mail.com" +79 +}, +80 +81 +82 +83 +84 +85 +86 +"UserName": "John Doe", +"Action": "Save Mosyle Logs Stream Profile" +"ActionDate": "1710267152", +"Content": "Profile Name: #1 - John Doe \nProfile Type: Mosyle Logs Streamin" +"IP": "192.168.65.1", +"E-mail": "john.doe@mosyle.com" +87 +88 +89 +90 } +91 ) +Custom Device Attributes - List Custom Device Attributes +To list the Custom Device Attributes you will access the Mosyle API endpoint/customdeviceattribute and pass the value list_custom_device_attributes through the parameter +operation. +Key +Type +operation +String +Required +Description +list_custom_device_attributes +String +Required +OS of the devices with the Custom Device Attribute (ios, tvos, mac, visionos) +Example request: +1 curl --location "https://managerapi.mosyle.com/v2/customdeviceattribute +2 --header 'Content-Type: application/json' \ +3 --header Authorizations Bearer ((Bearer_Token))" +4 --data ( +"accessToken": "Access_Token", +"elements":[ +5 +6 +7 +8 +9 +"operation": "list custom device attributes +"os": "mac" +10 +11 +12 +Example response: +1 +2 +"status": "Ox +3 +"response":[ +"status": "OK" +"info": [ +5 +6 +7 +( +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +"Name": "Custom Device Attribute" +"UniqueID": "custon oda", +"Value": "1234value" +"LastUpdate": "1710266724" +"Source": "API", +*IsDeleted": +Custom Device Attributes - Create Custom Device Attributes +To create Custom Device Attributes you will access the Mosyle API endpoint/customdeviceattribute and pass the value create_custom_device_attributes through the parameter +operation. +Key +Type +operation +String +Required +Description +create_custom_device_attributes +String +Required +OS of the devices with the Custom Device Attribute (ios, tvos, mac, visionos) +unique id +String +Required +Unique ID of the Custom Device Attribute +name +String +Required +Name of the Custom Device Attribute +value +String +Required +Designated Value of the Custom Device Attribute +devices +String (array) +Required +List of device UDIDs to be assigned the Custom Device Attribute +Example Request: +1 curl --location 'https://managerapi.monyle.com/v2/customdeviceattribute 2-header 'Content-Type: application/json" \ +3--header Authorization: Bearer ((Bearer_Token)) A +4 --data +"accessToken": "Access_Token" +"elements [ +"operation": "create custom device attributes" +"os": "mac +"unique_id": "custom_eda" +"name": "Custom Device Attribute", +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +1 +16 +17 +"value": "1234Value", +"devices": [ +AGDODAOA-FORF-000C-0C0B-0BA000000000" +18 ) +Example Response: +"status": "OK", +"response":{ +"status": "OK", +"info": "Custom Device Attribute saved successfully" +Custom Device Attributes - Assign Custom Device Attributes +To assign Custom Device Attributes to devices you will access the Mosyle API endpoint /customdeviceattribute and pass the value assign_custom_device_attributes through the +parameter operation. +Type +Description +Key +operation +String +Required +assign_custom_device_attributes +String +Required +OS of the devices with the Custom Device Attribute (ios, tvos, mac, visionos) +unique_id +String +Required +Unique ID of the Custom Device Attribute +value +String +Required +Value of the Custom Device Attribute to be assigned +devices +String (array) +Required +List of device UDIDs to be assigned the Custom Device Attribute +Example Request: +1 curl --location 'https://managerapi.mosyle.com/v2/customdevicesttribute" 2 --header +Content-Type: application/json" \ +3 --header Authorizations Bearer ((Bearer_Token)) +4 --data ( +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17) +"accessToken": "Access_Token" +"elements": [ +"operation": "assign_custom_device_attributes" +"os": "mac +"unique_id": "custom cda", +"value": "Custom Attribute", "devices": [ +"AGDODAOA-FORF-000C-0C0B-OBA000C00000 +Example Response: +2 +'status": "OK" +7 +"response": { +status" "OK" +"info": "Custom Device Attribute assigned successfully +9 +X +Custom Device Attributes - Update Custom Device Attributes +To update Custom Device Attributes you will access the Mosyle API endpoint/customdeviceattribute and pass the value update_custom_device_attributes through the parameter +operation. +To update the value of a Custom Device Attribute, the old_unique_id and unique id will remain the same. Just pass the updated value on the request. +Key +Туре +operation +String +Required +Description +update_custom_device_attributes +05 +String +Required +OS of the devices with the Custom Device Attribute (ios, tvos, mac, visionos) +old_unique_id +String +Required +Original Unique ID of the Custom Device Attribute that will be updated +unique id +String +Required +Unique ID of the updated Custom Device Attribute +name +String +Required +Name of the Custom Device Attribute +value +String +Required +Designated Value of the Custom Device Attribute +Example Request: +1 curl --location https://managerapi.nosyle.com/v2/customdeviceattribute +2 --header 'Content-Type: application/json" V +3 --header 'Authorization: Bearer ((Bearer_Token)) +4 --data ( +accessToken": "Access_Token" +"elements":[ +5 +6 +7 +( +8 +9 +10 +11 +12 +13 +14 +15 +16 +"operation": "update custom device attributes" "os" "mact +"old_unique_id": "custom_eda", +"unique_id": "new_custom_oda", +"name": "Custom Device Attribute", +"value": "1234Value" +Example Response: +1 +2 +"status": "Ox +3 +"response": { +"status": "OK", +5 +6 +"info": "Custom Device Attribute saved successfully" +7 +8 +9 +X +Custom Device Attributes - Remove Custom Device Attributes +To remove the assignment of Custom Device Attributes from devices you will access the Mosyle API endpoint /customdeviceattribute and pass the value remove_custom_device_attributes through the parameter operation. +Key +Type +Description +operation +String +Required +05 +String +Required +remove_custom_device_attributes +OS of the devices with the Custom Device Attribute (ios, tvos, mac, visionos) +unique_id +String +Required +Unique ID of the Custom Device Attribute +devices +String (array) +Required +List of device UDIDs to be removed/unassigned from the Custom Device Attribute +Example Request: +1 curl --location https://managerapi.mosyle.com/v2/customdeviceattribute +2 --header 'Content-Type: application/json" +3 --header Authorization: Bearer ((Bearer_Token))" \ +accessToken": "Access Token +"elements":[ +4 --data ( +5 +6 +7 +B +9 +10 +11 +12 +13 +14 +15 +16 +"operation": "remove_custom_device_attributes +"os": "mac +"unique_id": "custom_cda" +"devices":[ +A000DAOA-FOEF-000C-0C0B-0BA000000000" +Example Response: +1 ( +2 +"status":"0" +3 +6 +7 +8 +9) +"response": { +"status": "OK", +"info" : "Custom Device Attribute removed successfully" +Custom Device Attributes - Delete Custom Device Attributes +To delete a Custom Device Attribute you will access the Mosyle API endpoint /customdeviceattribute and pass the value delete_custom_device_attribute through the parameter +operation. +Key +Type +operation +String +Required +Description +delete_custom_device_attribute +05 +String +Required +OS of the devices with the Custom Device Attribute (ios, tvos, mac, visionos) +unique_id +String +Required +Unique ID of the Custom Device Attribute +Example Request: +1 curl --location 'https://managerapi.mosyle.com/v2/customdeviceattribute +2 --header 'Content-Type: application/json" \ +3--header Authorization: Bearer ((Bearer_Token)) +4 --data( +5 +6 +7 +8 +9 +10 +11 +12 +"accessToken": "Access Token" +"elements":[ +"operation": "delete_custom_device_attribute" +"os": "mac" +"unique_id": "new_custom_cda +13 ) +Example Response: +1 ( +2 +3 +"status": "Ox", +"response":{ +"status": "OK" +"info": "Custom Device Attribute deleted successfully" +7 +8 +9 +Shared Device Group Operations - Add/Remove Device from Shared Device Group +When you access the Mosyle API endpoint /shareddevicegroups passing the value assign_device through the parameter operation you can add or remove specific device UDIDs from a shared device group. This action requires the key parameter idshareddevicegroup to filter which Shared Device Group you want to add or remove the devices. +Available options: +Key +Type +Required +Description +operation +string +Required +assign_device +idshareddevicegroup +integer +Required +Shared Device Group ID +add +Array of strings +Cotional +List of the Device UDIDs to add to the specific shared device group +remove +Array of strings +Opfinnar +List of the Device UDIDs to remove from the specific shared device group +* At least one must be included +Example request: +1 curl --location 'https://managerapi.mosyle.com/v2/shareddevicegroups' 2 --header 'Content-Type: application/json' \ +3 --header 'Authorization: Bearer ((Bearer_Token}} +4 --data-raw +5 +6 +7 +8 +9 +accessToken": "Access Token" +operation": "assign device" +"idshareddevicegroup":"154" +"add": [ "AAAAAAAA-1234-4321-A182-AAAAAAAAAAAA"] +Success Response: +1 ( +2 +status: "OK +3 +response: [ +4 +5 +6 +status: "OK" +info: 110" +7 +1 +8) From b3bb3780b26ec05ad4d567de46260a9f4f61176a Mon Sep 17 00:00:00 2001 From: Tyler Diderich Date: Mon, 15 Dec 2025 16:04:38 -0600 Subject: [PATCH 2/6] working integration --- moysle/README.md | 13 +- moysle/custom-integration-moysle.star | 236 ++++++++++++++------------ 2 files changed, 135 insertions(+), 114 deletions(-) diff --git a/moysle/README.md b/moysle/README.md index 6f7cfbf..34cc20e 100644 --- a/moysle/README.md +++ b/moysle/README.md @@ -7,7 +7,7 @@ ## Moysle Requirements - Moysle API token (`access_key`). -- Moysle admin account email and password, combined as `email:password` in the `access_secret` field. +- Moysle admin account email and password, provided in `access_secret` as a JSON/dict (`{"email": "", "password": ""}` or `{"username": "", "password": ""}`). - Account must have permission to access device inventory. ## Steps @@ -16,11 +16,11 @@ 1. Gather your Moysle API credentials: - Obtain your **API token** from the Moysle admin portal. - - Use a valid Moysle admin email and password. + - Use a valid Moysle admin email and password. The script performs the login and bearer retrieval for you. -2. Test your credentials: +2. Test your credentials (optional but recommended): - Use a tool like Postman or curl to confirm login is working. - - Example request (token returned in the `Authorization` response header): + - Example request (bearer is returned in the `Authorization` response header; the script handles this automatically): ```bash curl -i -X POST "https://managerapi.mosyle.com/v2/login" \ -H "Content-Type: application/json" \ @@ -30,10 +30,9 @@ "password": "" }' ``` - - Copy the bearer token from the `Authorization: Bearer ` response header. 3. Verify device access: - - Use the bearer token and include the access token in the request body: + - 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`): ```bash curl -X POST "https://managerapi.mosyle.com/v2/listdevices" \ -H "Authorization: Bearer " \ @@ -54,7 +53,7 @@ 2. [Create the Credential for the Custom Integration](https://console.runzero.com/credentials). - Select the type `Custom Integration Script Secrets`. - Use the `access_key` field for your API token. - - Use the `access_secret` field as JSON or a dict with keys: `{"email": "", "password": ""}` (or `username` in place of `email`). You can optionally include a pre-issued bearer token as `bearer`/`token` to skip login parsing. + - Use the `access_secret` field as JSON/dict with keys `{"email": "", "password": ""}` (or `username`). Pre-issued bearer tokens are not used by the script. 3. [Create the Custom Integration](https://console.runzero.com/custom-integrations/new). - Add a Name and Icon for the integration (e.g., `moysle`). diff --git a/moysle/custom-integration-moysle.star b/moysle/custom-integration-moysle.star index 294100d..3567077 100644 --- a/moysle/custom-integration-moysle.star +++ b/moysle/custom-integration-moysle.star @@ -2,6 +2,7 @@ load('requests', 'Session') load('json', json_encode='encode', json_decode='decode') load('runzero.types', 'ImportAsset', 'NetworkInterface') load('net', 'ip_address') +load('flatten_json', 'flatten') BASE_URL = "https://managerapi.mosyle.com/v2" @@ -15,14 +16,10 @@ def parse_credentials(secret): creds = secret if type(secret) == "string": - print(creds) if secret.find("{") != -1: creds = json_decode(secret) - elif secret.find(":") != -1: - # Backward-compat for email:password format. - email, password = secret.split(":", 1) - if email and password: - return email, password + else: + print("access_secret must be a JSON string with email/password") return None, None if type(creds) == "dict": @@ -30,6 +27,9 @@ def parse_credentials(secret): password = creds.get("password") if email and password: return email, password + else: + print("Missing email or password in access_secret") + return None, None return None, None @@ -48,19 +48,19 @@ def get_bearer_token(session, access_token, email, password): if not resp or resp.status_code != 200: print("Login failed: {}".format(resp.status_code if resp else "no response")) return None - print("response: ", resp) auth_header = None if resp.headers: if "Authorization" in resp.headers: - auth_header = resp.headers["Authorization"] + auth_header = resp.headers.get("Authorization", None) elif "authorization" in resp.headers: - auth_header = resp.headers["authorization"] + auth_header = resp.headers.get("authorization", None) - if auth_header and auth_header.startswith("Bearer "): - return auth_header.split(" ", 1)[1] - - print("Login succeeded but bearer token missing from headers") - return None + if auth_header: + print("Login succeeded with bearer token") + return auth_header[0].split(" ")[1] + else: + print("Login succeeded but bearer token missing from headers") + return None def build_network_interface(mac, ips): @@ -72,6 +72,8 @@ def build_network_interface(mac, ips): for ip in ips: if not ip: continue + # IPv6 has a %interface appended + ip = ip.split("%")[0] addr = ip_address(ip) if addr.version == 4: ip4s.append(addr) @@ -89,24 +91,35 @@ def collect_hostnames(device): for key in ["device_name", "devicename", "HostName", "LocalHostName", "hostname"]: name = device.get(key, "") if name and name not in names: - names.append(name) + safe_name = name.replace(" ", "-") + names.append(safe_name) return names +def parse_tags(raw_tags, asset_tag): + tags = [] + if raw_tags and type(raw_tags) == "string": + for chunk in raw_tags.split(","): + for part in chunk.split(): + part = part.strip() + if part and part not in tags: + tags.append(part) + if asset_tag and asset_tag not in tags: + tags.append(asset_tag) + return tags if tags else None + + def build_custom_attributes(device, used_keys): + flat = flatten(device) attrs = {} - for key in device: + for key in flat: if key in used_keys: continue - value = device.get(key) + value = flat.get(key) if value == None: continue - # Normalize lists and dicts to JSON strings; primitives to strings. - if type(value) == "dict" or type(value) == "list": - attrs[key] = json_encode(value) - else: - attrs[key] = "{}".format(value) - return attrs + attrs[key] = "{}".format(value) + return attrs if attrs else None def main(*args, **kwargs): @@ -132,89 +145,98 @@ def main(*args, **kwargs): session.headers.set("Authorization", "Bearer {}".format(bearer)) assets = [] - page = 0 - - while True: - list_url = "{}/listdevices".format(BASE_URL) - list_payload = { - "accessToken": api_token, - "options": { - "os": "all", - "page": page, - }, - } - - device_resp = session.post(list_url, body=bytes(json_encode(list_payload))) - if not device_resp or device_resp.status_code != 200: - print("Device list request failed on page {}: {}".format(page, device_resp.status_code if device_resp else "no response")) - break - - data = json_decode(device_resp.body) - response = data.get("response", {}) - devices = response.get("devices", []) - if not devices: - break - - for d in devices: - device_id = d.get("deviceudid") or d.get("serial_number") or "" - if not device_id: - continue - - hostnames = collect_hostnames(d) - - wifi_mac = d.get("wifi_mac_address") - eth_mac = d.get("ethernet_mac_address") - wifi_ips = [] - if d.get("last_ip_beat"): - wifi_ips.append(d.get("last_ip_beat")) - eth_ips = [] - if d.get("last_lan_ip"): - eth_ips.append(d.get("last_lan_ip")) - - network_interfaces = [] - wifi_iface = build_network_interface(wifi_mac, wifi_ips) - if wifi_iface: - network_interfaces.append(wifi_iface) - eth_iface = build_network_interface(eth_mac, eth_ips) - if eth_iface: - network_interfaces.append(eth_iface) - - model = d.get("device_model_name") or d.get("model_name") or d.get("device_model") or d.get("model") or "" - os_name = d.get("os", "") - os_version = d.get("osversion", "") - - used_keys = set([ - "deviceudid", - "serial_number", - "device_name", - "devicename", - "HostName", - "LocalHostName", - "hostname", - "os", - "osversion", - "wifi_mac_address", - "ethernet_mac_address", - "last_ip_beat", - "last_lan_ip", - "device_model_name", - "model_name", - "device_model", - "model", - ]) - custom_attrs = build_custom_attributes(d, used_keys) - - asset = ImportAsset( - id=device_id, - hostnames=hostnames, - os=os_name, - osVersion=os_version, - model=model, - networkInterfaces=network_interfaces if network_interfaces else None, - customAttributes=custom_attrs if custom_attrs else None, - ) - assets.append(asset) - - page += 1 + + for os_type in ["ios", "mac", "tvos", "visionos"]: + print("Fetching {} devices".format(os_type)) + page = 0 + + while True: + list_url = "{}/listdevices".format(BASE_URL) + list_payload = { + "accessToken": api_token, + "options": { + "os": os_type, + "page": page, + }, + } + + device_resp = session.post(list_url, body=bytes(json_encode(list_payload))) + if not device_resp or device_resp.status_code != 200: + print("Device list request failed on page {}: {}".format(page, device_resp.status_code if device_resp else "no response")) + break + + data = json_decode(device_resp.body) + response = data.get("response", {}) + devices = response.get("devices", []) + if not devices: + break + + for d in devices: + device_id = d.get("deviceudid") or d.get("serial_number") or "" + if not device_id: + continue + + hostnames = collect_hostnames(d) + + wifi_mac = d.get("wifi_mac_address") + eth_mac = d.get("ethernet_mac_address") + wifi_ips = [] + if d.get("last_ip_beat"): + wifi_ips.append(d.get("last_ip_beat")) + eth_ips = [] + if d.get("last_lan_ip"): + eth_ips.append(d.get("last_lan_ip")) + + network_interfaces = [] + + if len(wifi_ips) > 0 and wifi_mac: + wifi_iface = build_network_interface(wifi_mac, wifi_ips) + network_interfaces.append(wifi_iface) + + if len(eth_ips) > 0 and eth_mac: + eth_iface = build_network_interface(eth_mac, eth_ips) + network_interfaces.append(eth_iface) + + model = d.get("device_model_name") or d.get("model_name") or d.get("device_model") or d.get("model") or "" + os_name = d.get("os", "") + os_version = d.get("osversion", "") + tags = parse_tags(d.get("tags"), d.get("asset_tag")) + + used_keys = set([ + "deviceudid", + "serial_number", + "device_name", + "devicename", + "HostName", + "LocalHostName", + "hostname", + "os", + "osversion", + "wifi_mac_address", + "ethernet_mac_address", + "last_ip_beat", + "last_lan_ip", + "device_model_name", + "model_name", + "device_model", + "model", + "tags", + "asset_tag", + ]) + custom_attrs = build_custom_attributes(d, used_keys) + + asset = ImportAsset( + id=device_id, + hostnames=hostnames, + os=os_name, + osVersion=os_version, + model=model, + networkInterfaces=network_interfaces if network_interfaces else None, + tags=tags, + customAttributes=custom_attrs, + ) + assets.append(asset) + + page += 1 return assets From 86973fce959621986ad58cde588e5f1ba4590f01 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 15 Dec 2025 22:05:58 +0000 Subject: [PATCH 3/6] Auto: update integrations JSON and README --- README.md | 1 + docs/integrations.json | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 73f6a9e..d1f1f5a 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ If you need help setting up a custom integration, you can create an [issue](http - [Kandji](https://github.com/runZeroInc/runzero-custom-integrations/blob/main/kandji/) - [Lima Charlie](https://github.com/runZeroInc/runzero-custom-integrations/blob/main/lima-charlie/) - [Manage Engine Endpoint Central](https://github.com/runZeroInc/runzero-custom-integrations/blob/main/manage-engine-endpoint-central/) +- [Moysle](https://github.com/runZeroInc/runzero-custom-integrations/blob/main/moysle/) - [Netskope](https://github.com/runZeroInc/runzero-custom-integrations/blob/main/netskope/) - [NinjaOne](https://github.com/runZeroInc/runzero-custom-integrations/blob/main/ninjaone/) - [Proxmox](https://github.com/runZeroInc/runzero-custom-integrations/blob/main/proxmox/) diff --git a/docs/integrations.json b/docs/integrations.json index ce74e24..21cb9df 100644 --- a/docs/integrations.json +++ b/docs/integrations.json @@ -1,7 +1,13 @@ { - "lastUpdated": "2025-12-11T19:44:50.765475Z", - "totalIntegrations": 29, + "lastUpdated": "2025-12-15T22:05:57.981839Z", + "totalIntegrations": 30, "integrationDetails": [ + { + "name": "Moysle", + "type": "inbound", + "readme": "https://github.com/runZeroInc/runzero-custom-integrations/blob/main/moysle/README.md", + "integration": "https://github.com/runZeroInc/runzero-custom-integrations/blob/main/moysle/custom-integration-moysle.star" + }, { "name": "Lima Charlie", "type": "inbound", From e6897066297b8e19f46b2a7f3415c01c24893a95 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 15 Dec 2025 22:06:03 +0000 Subject: [PATCH 4/6] Auto: update integrations JSON and README --- docs/integrations.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/integrations.json b/docs/integrations.json index 21cb9df..2cb9046 100644 --- a/docs/integrations.json +++ b/docs/integrations.json @@ -1,5 +1,5 @@ { - "lastUpdated": "2025-12-15T22:05:57.981839Z", + "lastUpdated": "2025-12-15T22:06:03.281948Z", "totalIntegrations": 30, "integrationDetails": [ { From 352db8f527087431f668e6cc8e984ff6fa84db35 Mon Sep 17 00:00:00 2001 From: Tyler Diderich Date: Mon, 15 Dec 2025 16:06:21 -0600 Subject: [PATCH 5/6] remove API docs --- moysle/moysle-api.txt | 2965 ----------------------------------------- 1 file changed, 2965 deletions(-) delete mode 100644 moysle/moysle-api.txt diff --git a/moysle/moysle-api.txt b/moysle/moysle-api.txt deleted file mode 100644 index 9078a37..0000000 --- a/moysle/moysle-api.txt +++ /dev/null @@ -1,2965 +0,0 @@ -Articles -Articles -Learn more how to use the API with the articles listed below. -First Steps -How to make a Request using the API -Discover how to integrate your system with our Mosyle Manager API and make requests. In this article you will learn about the general parameters used in every request you can make. -Devices Operations -List Devices -Check out this guide to learn how to list and search your devices through Mosyle Manager API, -Lock Devices -Check out this guide to learn how to lock your devices through Mosyle Manager API. -Lost Mode (only iOS) -Check out this guide to learn how to enable/disable lost mode on your devices through Mosyle Manager API. -Unassign Devices -Check out this guide to learn how to unassign devices through Mosyle Manager API. -Update Device Attributes -Check out this guide to learn how to update attributes of one or multiple devices using Mosyle Manager API. -Bulk Operations - Wipe Devices -Check out this guide to learn how to wipe devices through Mosyle Manager API. -Bulk Operations - Restart Devices -Check out this guide to learn how to restart devices through Mosyle Manager API. -Bulk Operations-Shutdown Devices -Check out this guide to learn how to shutdown devices through Mosyle Manager API. -Bulk Operations - Clear Commands -Check out this guide to learn how to clear commands through Mosyle Manager API. -Bulk Operations - Activation Lock -Check out this guide to learn how to enable/disable Activation Lock through Mosyle Manager API. -Bulk Operations - Move Devices to Accounts (District Only) -Check out this guide to learn how to move devices to accounts from the District Level through Mosyle Manager API. -Bulk Operations - Change/Update Limbo Location -Check out this guide to learn how to change or update the location of devices in Limbo through Mosyle Manager API. -X -Users Operations -List Users -Check out this guide to learn how to list and search users through Mosyle Manager API. -Create Users -Create users through Mosyle Manager API. -Update Users -Update users through Mosyle Manager API. -Delete User -Check out this guide to learn how to delete users using Mosyle Manager API. -Assign Devices -Check out this guide to learn how to assign devices to users through Mosyle Manager API. -Classes -Save and Delete Classes -Check out this guide and learn how to manage your classes through Mosyle Manager API. -List Classes -Check out this guide and learn how to list your classes through Mosyle Manager API, -Accounts (District Only) -Get Accounts -Get accounts list. -Create new Account -Check out this guide on how to create a new account (District Only). -Cisco ISE -Cisco ISE - Add and remove Devices -Check out this guide about how to add and remove devices from Cisco ISE. -Cisco ISE-Get Device -Check out this guide on managing devices in your Cisco ISE. -Dynamic Device Groups Operations -List Dynamic Device Groups -Check out this guide to learn how to list and search dynamic device groups through Mosyle Manager APL -List Devices -Check out this guide to learn how to list all device UDIDs of a specific dynamic device group through Mosyle Manager API. -Add/Remove Device from Dynamic Device Group -Check out this guide to learn how to add or remove devices to Dynamic Device Groups using Mosyle Manager API. -List Devices in Device Groups -Check out this guide to learn how to list devices in your device groups through Mosyle Manager API. -Action Logs -List -Check out this guide to learn how to list and search Action Logs through Mosyle Manager API. -Mosyle Logs Stream -Mosyle Logs Stream -Check out this guide to learn how to integrate with Mosyle Logs Stream APL -Custom Device Attributes -List Custom Device Attributes -Check out this guide to learn how to list your custom device attributes through Mosyle Manager API. -Create Custom Device Attributes -Check out this guide to learn how to create your custom device attributes through Mosyle Manager API. -Assign Custom Device Attributes -Check out this guide to learn how to assign your custom device attributes through Mosyle Manager API. -Update Custom Device Attributes -Check out this guide to learn how to update your custom device attributes through Mosyle Manager API. -Remove Custom Device Attributes -Check out this guide to learn how to remove your custom device attributes through Mosyle Manager API. -Delete Custom Device Attributes -Check out this guide to learn how to delete your custom device attributes through Mosyle Manager API. -Shared Device Group Operations -Add/Remove Device from Shared Device Group -Check out this guide to learn how to add or remove devices from Shared Device Groups using Mosyle Manager APL -First Steps - How to make a Request using the API -To use the Mosyle API you need to enable this feature in the API profile page (My School > API Integration > enable the profile). -Once enabled you will see your access token and make requests to the endpoint" -", every request will have some required -parameters as well as optional parameters. The Mosyle API supports the POST request method. All API responses are structured in JSON format. -If your current API integration is using Basic Authentication, please create a new API Token to use JWT Authentication as Basic Authentication has been deprecated. -JWT Authentication -First, make a request to the Mosyle API endpoint "/login" including the access token, email, and password in the body of the request. -Example request: -1 curl --include --location 'https://managerapi.moayle.com/v2/login -2 --header Content-Type: application/json -3-data-raw -4 -accessToken": Access Token -5 -"email": "User Email", -6 -"password": "User Password" -7}' -First Steps - How to make a Request using the API -First, make a request to the Mosyle API endpoint "/login" including the access token, email, and password in the body of the request. -Example request: -1 curl --include --location https://managerapi.mosyle.com/v2/login' \ -2 --header 'Content-Type: application/json' -3-data-raw ( -5 -6 -7} -accessToken": "Access Token" -email": "User Email", -password": "User Password" -Example response: -1 HTTP/1.1 200 OK -2 Date: Mon, 21 Aug 2023 17:31:09 GMT -3 Server: Apache -4 X-Frame-Options: SAMEORIGIN -5 X-XSS-Protection: ; mode=block -6 X-Content-Type-Options: nosniff -7 Content-Security-Policy: frame-src 'self' 'unsafe-eval' 'unsafe-inline.mosyle.com frame-ancestors 'self' -8 Strict-Transport-Security: max-age=3072000; includeSubdomains; -9 Set-Cookie: PHPSESSID=901c23c1234e5678b901d2a34a56cc7; path=/; domain=.mosyle.com; secure; HttpOnly -10 Expires: Thu, 19 Nov 1981 08:52:00 GMT -11 Cache-Control: no-store, no-cache, must-revalidate -12 Pragma: no-cache -13 Authorization: Bearer Bearer_Token -14 Content-Length: 59 -15 Content-Type: application/json -16 -17 {"UserID":"User ID", "email":"User_Email"} -The response will contain a -as a JSON Web Token (JWT) in the header which will be needed for subsequent requests. The token will expire -every 24 hours and will need to be renewed. -When accessing any other Mosyle API endpoints, include the string "Bearer" followed by the JWT in the request header. The access token will be included in the body of the request. -*Note: If you are using PowerShell, you will need to utilize 'Invoke-WebRequest' to view the Bearer token to then parse or copy/paste it as necessary. -X -4 X-Frame-Options: SAMEORIGIN -5 X-XSS-Protection: -; mode=block -First Steps - How to make a Request using the API -6 X-Content-Type-Options: nosniff -7 Content-Security-Policy: frame-src 'self' 'unsafe-eval' 'unsafe-inline -8 Strict-Transport-Security: max-age=3072000; includeSubdomains; -.mosyle.com frame-ancestors 'self' -9 Set-Cookie: PHPSESSID=0c23c1234e5678b901d2a34a56cc7; path=/; domain=.mosyle.com; secure; HttpOnly 10 Expires: Thu, 19 Nov 1981 0:52:00 GMT -11 Cache-Control: no-store, no-cache, must-revalidate -12 Pragma: no-cache -13 Authorization: Bearer Bearer_Token -14 Content-Length: 59 -15 Content-Type: application/json -16 -17 ("UserID":"User_ID", "email": "User Email"} -The response will contain a -as a JSON Web Token (JWT) in the header which will be needed for subsequent requests. The token will expire -every 24 hours and will need to be renewed. -When accessing any other Mosyle API endpoints, include the string "Bearer" followed by the JWT in the request header. The access token will be included in the body of the request. -*Note: If you are using PowerShell, you will need to utilize 'Invoke-WebRequest' to view the Bearer token to then parse or copy/paste it as necessary. -The following snippet will be used in all subsequent requests: -1 curl --location 'https://managerapi.mosyle.com/v2 -2 -3 --header 'Content-Type: application/json' -4 --header Authorization: Bearer ((Bearer_Token}}" -5 --data -6 -7} -"accessToken": "Access Token" -For more examples with other languages and to test the API, click here to download the sample API file. (Compatible with Postman and Insomnia) -Attention: You must change the environment variables and provide your API Token Access, Email and Password when you open the sample archive on -Postman or Insomnia. -Check the next articles to learn more about the services and their operations. -Devices Operations - List Devices -You will hit the endpoint /listdevices and can send parameters to filter your request for the specific info you want to receive in your response. -Key -Туре -Description -Required Which Operational System will be listed, values can be ios, mac, tvos, or visionos -05 -String -tags -Array -of -Optional -strings -osversions -Array -Offaman -of -strings -serial numbers -Array -of -page -strings -O Serial Numbers (filter by specific serial numbers) -Integer Option Pagination start with O -specific columns Array -Use this option to retrieve specific attributes for each device. If this option is excluded, all device attributes will be returned. -Example request -of -strings -Return only specific values: -deviceudid, total_disk, os, serial number, device_name, device model, idaccount, battery, osversion, date_info, carrier, -roaming enabled, isroaming, imei, meid, available_disk, wifi_mac_address, last_ip_beat, last_lan_ip, bluetooth_mac_address, -is_supervised, date_app_info, date_last_beat, date_last_push, status, isActivationLockEnabled, isDeviceLocatorServiceEnabled, -isDoNotDisturbinEffect, isCloud BackupEnabled, IsNetwork Tethered, needosupdate, productkeyupdate, device_type, -lostmode_status, is muted, date muted, activation bypass, date_media_info, tags (will not include Mosyle-generated tags). -iTunesStoreAccountHash, iTunesStoreAccountsActive, date profiles_info, ethernet_mac_address, model_name, -LastCloudBackupDate, SystemintegrityProtectionEnabled, BuildVersion, LocalHostName, HostName, OSUpdateSettings, ActiveManagedUsers, CurrentConsoleManaged User, date printers, AutoSetupAdminAccounts, appleTVid, asset tag. ManagementStatus, OSUpdateStatus, AvailableOSUpdates, appleTVid, enrollment_type, userid, useremail, username, usertype, SharedCartName, device_model_name, date_kinfo, location, latitude & longitude & altitude (only available for devices in lost mode), -DeviceAttestationStatus, CustomDeviceAttributes, last_ssid -If no specific columns are requested, all Service Subscription data for cellular devices will be returned in the response for both Slot 1 -and Slot 2. If you prefer to only receive specific data for Slot 1 and/or Slot 2, specify the keys below: -Slot 1: 'imeiOne', 'meid One', 'CarrierSettingsVersionOne', 'Current CarrierNetworkOne', 'CurrentMCCOne', 'CurrentMNCOne, -"ICCIDOne, 'IsDataPreferred One', 'IsRoamingOne, 'IsVoicePreferredOne', 'LabelOne', 'Labell DOne', 'PhoneNumberOne', "EIDOne' -Slot 2: 'imei Two', 'meid Two', 'CarrierSettingsVersion Two, 'CurrentCarrierNetwork Two', 'CurrentMCCTwo, 'CurrentMNCTwo' -"ICCIDTwo', 'IsDataPreferred Two', 'Is Roaming Two, 'Is VoicePreferred Two', 'LabelTwo", "Labell DTwo', 'PhoneNumber Two", "EIDTwo' -Devices Operations - List Devices -LastCloud BackupDate, SystemintegrityProtectionEnabled, BuildVersion, LocalHostName, HostName, OSUpdateSettings, ActiveManaged Users, CurrentConsoleManaged User, date printers, AutoSetupAdminAccounts, appleTVid, asset_tag ManagementStatus, OSUpdateStatus, AvailableOSUpdates, appleTVid, enrollment_type, userid, useremail, username, usertype, -SharedCartName, device model name, date kinfo, location, latitude & longitude & altitude (only available for devices in lost mode), -DeviceAttestationStatus, CustomDeviceAttributes, last_ssid -If no specific columns are requested, all Service Subscription data for cellular devices will be returned in the response for both Slot 1 and Slot 2. If you prefer to only receive specific data for Slot 1 and/or Slot 2, specify the keys below: -Slot 1: 'imeiOne', 'meidOne', 'CarrierSettingsVersionOne', 'CurrentCarrierNetworkOne', 'CurrentMCCOne', 'CurrentMNCOne', "ICCIDOne', 'IsDataPreferred One, 'IsRoamingOne', 'IsVoicePreferred One', 'LabelOne', "LabellDOne', "PhoneNumberOne, "EIDOne' -Slot 2: 'imei Two, 'meid Two', 'CarrierSettingsVersionTwo', 'CurrentCarrier Network Two', 'CurrentMCCTwo', 'CurrentMNCTwo', -"ICCIDTwo, 'IsDataPreferred Two', 'Is Roaming Two', 'Is VoicePreferred Two', 'LabelTwo", "Labell DTwo', 'PhoneNumberTwo", "EIDTwo' -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/1iatdevices! A -2 --header -Content-Type: application/json' \ -Content-Type: -3 --header Authorization: Bearer ((Bearer_Token}}' -4-data f -5 -6 -"accessToken": "Access Token" -"options": { -7 -"os": "ios" -8 -} -9) -Success Response: -1 1 -"status": "OK", -"response": { -"devices": [ -"deviceudid": "001DFCEB-B160-5F2C-B435-2D4D9F4570E0" -"total_disk": "256.0000000000", -"os": "ios" -others attributes and other devices -2 -3 -4 -5 -6 -7 -8 -9 -10 -} -11 -12 -13 -"rows":"1328 -"page_size": 100, -14 -"page": ! -15 -16} -Devices Operations - Lock Devices -To lock a device you will pass the value lock_device through the key operation and send the device UDID through the key parameter devices and the lock pin code through the key parameter pincode. You can send the message to display on the lock screen of the device through the key parameter lockmessage. -Key -Description -Type -Required -devices -Array[string] -Required -Devices UDID -pincode -Integer -Optional -Six-character PIN code (macOS only) -phonenumber -String -Optional -The phone number to display on the Lock Screen of the device -lockmessage -String -Ontional -The message to display on the Lock Screen of the device -*The pincode key value is available in macOS 10.8 and later. If no new pincode is provided, the last configured pincode will be used. It's important to note that this setting has no effect on iOS devices. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/bulkops -2 --header -Content-Type: application/json' -3 --header Authorization: Bearer ((Bearer Token))" -4 --data-raw { -"accessToken": "Access Token" -"elements":[ -"operation": "lock device", -"devices":["00001023-001234567890A018","1000a0bc0000000d123456e00fg99h10jk12345e"], -"pincode": "123456", -"lockmessage": "Your message!" -5 -6 -7 -8 -9 -10 -11 -12 -} -13 -1 -14) -Successful Response: -1 ( -status: "OK" -response: [ -2 -3 -4 -f -5 -6 -7 -} -8 -J -9) -status: "COMMAND SENT", -info: "Command sent successfully." -Devices Operations - Lock Devices -If a device is not found, the devices_notfound node will bring its udid: -1 ( -status: "OK", -response: [ -2 -3 -4 -5 -6 -7 -8 -} -9 -devices_notfound: [UDID2'], -status: "COMMAND SENT" -info: "Command sent successfully. -10) -Without 'devices' key: -1 ( -2 -3 -4 -5 -6 -7 -8 -status: "OK" -response: [ -status: "MISSING DATA info: "Missing key: devices" -9 } -Without 'devices' key: -1 ( -status: "OK -response: [ -status: "MISSING DATA" -info: "Missing key: devices" -2 -3 -4 -{ -5 -6 -7 -} -8 -1 -9) -The 'devices' key is empty: -Devices Operations - Lock Devices -status: "OK" -response: [ -status: "INVALID DATA" -info: "The device key is empty. Please, check and try again" -1 ( -2 -3 -4 -5 -6 -7 -8 -9 -1 -10) -The 'pincode' key is not an six-character integer: -1 { -2 -3 -4 -5 -6 -status: "OK" -response: [ -status: "INVALID_DATA", -info: "The pincode key must be a six-character integer" -7 -8 -1 -9) -No devices found: -status: "OK" -response: [ -{ -devices_notfound: ['UDID1', 'UDID2'], -status: "ERROR -info: The device selected is not valid. Please, check the device and try again" -1 ( -2 -3 -4 -5 -6 -7 -8 -9 -J -10 } -Devices Operations - Lost Mode (only iOS) -You will hit the endpoint /lostmode and send parameters to enable/disable lost mode and additional functions. -Key -Type -operation -String -Description -Required -enable -disable -play sound -request location -devices -Array of strings -Required -Array of Unique Device Identifier (Device UDID) -groups -Array of strings -Array of Device Group ID -message -String -Required -Message to be shown on the screen -phone_number -String -footnote -String -The phone number will be shown on the screen along with the message. -Footnote text will be shown on the screen along with the message. -*If any Device Group ID has been passed, it is not mandatory to inform the Unique Device Identifier. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/lostmode -2 --header 'Content-Type: application/json' -3 --header Authorization: Bearer {{Bearer_Token}} \ -4 --data-raw -accessToken": "Access Token' -elements" : [{ -5 -6 -7 -8 -9 -10 -11 -12 -}] -13) -"operation": "enable", -"groups":["210"], -"message": "I'm Lost :(", -"phone_number": "Call to (XXX) XXX-XXXX" -"footnote": "Footnote Text!" -operation -String -Required -Devices Operations - Lost Mode (only iOS) -enable -disable -play sound -request_location -devices -Array of strings -Required* -Array of Unique Device Identifier (Device UDID) -groups -Array of strings -Array of Device Group ID -message -String -Required -Message to be shown on the screen -phone_number -String -The phone number will be shown on the screen along with the message. -footnote -String -Footnote text will be shown on the screen along with the message. -*If any Device Group ID has been passed, it is not mandatory to inform the Unique Device Identifier. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/lostmode -2 --header -Content-Type: application/json' \ -3 --header Authorization: Bearer ((Bearer Token}}' \ -4 --data-raw ( -"accessToken": "Access Token", -elements": [{ -5 -6 -7 -8 -9 -10 -11 -12 -}] -13 } -operation": "enable" -groups":["210"], -"message": "I'm Lost :(", -"phone_number": "Call to (XXX) XXX-XXXX" -"footnote": "Footnote Text!" -Success Response: -1 ( -2 -3 -4 -5 -6 -7 -8 -9) -"status": "OK" "response":[ -"status":"COMMAND SENT" -"info":"Command sent successfully." -} -X -Devices Operations - Unassign Devices -To unassign a device you will pass the value change_to_limbo through the endpoint bulkops and send the Unique Device Identifier through the key parameter devices or/and Device Groups ID through the key parameter groups. You can also send both commands at the same time. -Key -Type -Description -operation -String -Required -change_to_limbo -devices -Array -Required* -An array of Unique Device Identifier (UDID). -groups -Array -Optional -An array of Device Group IDs - Sends the command to all devices in the group -*If any Device Group ID has been passed, it is not mandatory to inform the Unique Device Identifier. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/bulkops -2 --header 'Content-Type: application/json" -3 --header 'Authorization: Bearer ((Bearer_Token}} -4-data-raw { -5 -6 -7 -8 -accessToken": "Access Token" -elements -[ -"operation": "change to limbo" -"groups": [ -9 -10 -11 -12 -13 -14 } -Success Response: -"210" -11 -2 -3 -4 -5 -6 -status":"OK", -"response":[ -{ -"status":"COMMAND_SENT" -"info":"Command sent successfully." -7 -8 -1 -9} -Devices Operations - Update Device Attributes -Key -Type -serialnumber -String -Required -asset tag -String -tags -String -Description -Serial number of the device that will be updated. -To update the device asset tag. -To update the device tags. Multiple tags should be comma-separated. -name -String -To update the device name. -lock -String -To update the device lock message. -By hitting the endpoint /devices and sending those parameters like on the -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/devices 2 --header -Content-Type: application/json' -3 --header Authorization: Bearer {{Bearer_Token}}' \ -4 --data ( -"accessToken": "Access Token", -elements": [ -5 -6 -7 -f -8 -9 -10 -'serialnumber": "XX -"tags": "New Tag" -11 -12 } -Success Response: -11 -"status": "OK" -2 -3 -"devices": [ -4 -"AAAA AAAAA" -5 -1 -6) -20 -Devices Operations - Bulk Operations - Wipe Devices -To wipe a device you will pass the value bulkops through the endpoint and send the Unique Device Identifier through the key parameter devices or/and Device Groups ID through the key parameter groups. You can also send both commands at the same time. -Description -Key -Type -operation String -Required wipe devices -devices Array -Required An array of Unique Device Identifier (UDID). -groups -Array -An array of Device Group IDs - Sends the command to all devices in the group -options Object (key => -value) -pin_code (6 digits) [macOS only] -PreserveDataPlan (bool) (iOS only) -DisallowProximitySetup (bool) (iOS only) -RevokeVPPLicenses (bool) [iOS & tvOS only] -EnableReturn To Service (bool) [iOS & tvOS only) - When enabled, this service will use the default WiFi which can be set in the WiFi -Authentication profile. -*If any Device Group ID has been passed, it is not mandatory to inform the Unique Device Identifier. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/bulkops -2 --header 'Content-Type: application/json' -3 --header Authorization: Bearer {{Bearer_Token}} \ -4 --data-raw -АААААААААААААААА" -5 -"accessToken": "AccessToken" -6 -7 -8 -9 -"elements":[ -"operation": "wipe_devices" "devices":[ -10 -ΑΑΑΑΑ -AAA -11 -17 -12 -"options": { -13 -"RevokeVPPLicenses": "false" -14 -15 -16 -17 }' -Devices Operations - Bulk Operations - Wipe Devices -groups -Array -options -Object (key => -value) -An array of Device Group IDs - Sends the command to all devices in the group -pin_code (6 digits) [macOS only) -PreserveDataPlan (bool) (iOS only] -DisallowProximitySetup (bool) (iOS only] -RevokeVPPLicenses (bool) (iOS & tvOS only) -EnableReturn To Service (bool) [iOS & tvOS only] - When enabled, this service will use the default WiFi which can be set in the WiFi -Authentication profile. -*If any Device Group ID has been passed, it is not mandatory to inform the Unique Device Identifier. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/bulkops' -2 --header 'Content-Type: application/json' \ -3 --header Authorization: Bearer {{Bearer_Token}}' X -4-data-raw ( -accessToken": "Access Token", -"operation": "wipe_devices", -"devices": [ -"AAAAA -"options": { -5 -6 -"elements": [ -7 -8 -9 -10 -11 -12 -13 -14 -15 -} -16 -17 } -Success Response: -"RevokeVPPLicenses": "false" -11 -2 -"status":"OK" -"response":[ -3 -4 -{ -5 -6 -"status":"COMMAND_SENT" -"info":"Command sent successfully." -7 } -8 -1 -91 -AAAA -Devices Operations - Bulk Operations - Restart Devices -To restart a device you will pass the value bulkops through the endpoint and send the Unique Device Identifier through the key parameter devices or/and Device Groups ID through the key parameter groups. You can also send both commands at the same time. -Key -Туре -Description -operation -String -Required -restart_devices -devices -Array -Required -An array of Unique Device Identifier (UDID). -groups -Array -An array of Device Group IDs - Sends the command to all devices in the group -*If any Device Group ID has been passed, it is not mandatory to inform the Unique Device Identifier. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/bulkops -2 --header 'Content-Type: application/json -3 --header Authorization: Bearer {{Bearer_Token}} -4 --data-raw { -"accessToken": "Access Token -"elementa": [ -operation": "restart devices", "groups": [ -5 -6 -7 -8 -9 -10 -"210" -11 -J -12 -13 -1 -14 ) -Success Response: -1 ( -2 -3 -4 -5 -6 -7 -"status": "OK" -"response":[ -( -"status":"COMMAND_SENT" -"info":"Command sent successfully." -} -8 -1 -9) -Devices Operations - Bulk Operations - Shutdown Devices -To shutdown a device you will pass the value bulkops through the endpoint and send the Unique Device Identifier through the key parameter devices or/and Device Groups ID through the key parameter groups. You can also send both commands at the same time. -Description -Key -Type -operation -String -Required -shutdown devices -devices -Array -Required -An array of Unique Device Identifier (UDID). -Array -groups -An array of Device Group IDs - Sends the command to all devices in the group -*If any Device Group ID has been passed, it is not mandatory to inform the Unique Device Identifier. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/bulkops' -2 --header -Content-Type: application/json' \ -3 --header Authorization: Bearer ((Bearer_Token}} \ -4 --data-raw ( -5 -6 -7 -8 -9 -10 -11 -12 -13 -1 -14) -accessToken": "Access Token -elements": [ -"operation": "shutdown devices" -"groups": [ -"210" -Success Response: -1 ( -2 -"status":"OK" -"response":[ -f -"status":"COMMAND SENT" -"info":"Command sent successfully." -3 -4 -5 -6 -7 -} -8 -1 -9 } -Devices Operations - Bulk Operations - Clear Commands -To clear commands you will pass the value bulkops through the endpoint and send the Unique Device Identifier through the key parameter devices or/and Device Groups ID through the key parameter groups. You can also send both commands at the same time. -Key -Туре -operation -String -Required -Description -clear_commands (pending + failed) -clear pending.commands -clear_failed_commands -devices -Array -Required -An array of Unique Device Identifier (UDID). -Array -groups -An array of Device Group IDs - Sends the command to all devices in the group -*If any Device Group ID has been passed, it is not mandatory to inform the Unique Device Identifier. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/bulkops' -2 --header -Content-Type: application/json' -3 --header 'Authorization: Bearer {{Bearer_Token}}' \ -4 --data-raw ( -5 -accessToken": "Access Token -6 -"elements":[ -7 -8 -"operation": "clear commands -9 -10 -"groups" : [ -210" -11 -12 -} -13 -14) -Success Response: -11 -2 -3 -4 -5 -6 -"status":"OK", -"response":[ -"status":"COMMAND CLEARED" "info":"Command cleared successfully." -7 -8 -1 -9) -Devices Operations - Bulk Operations - Activation Lock -When you access the Mosyle API endpoint /bulkops passing the value enable activationlock through the parameter operation you will enable MDM -initiated Activation Lock on all listed devices. -To disable MDM initiated Activation Lock, access the Mosyle API endpoint /bulkops passing the value disable_activationlock through the parameter -operation. -Available options: -Key -Type -Required -Description -operation -String -Required -enable activationlock -disable activationlock -devices -Array [string] -Required -Array of Unique Device Identifier (Device UDID) -lost message -String -Optional -The message to display on the screen of the device -Example Request to Enable Activation Lock: -1 curl --location 'https://managerapi.mosyle.com/v1/bulkops -2 --header Content-Type: application/json' \ -3 --header Authorization: Bearer ((Bearer_Token}}' \ -4 --data { -5 -6 -7 -8 -"accessToken": "Access Token", -"elements": [ -"operation": "enable_activationlock", "devices": [ -"ABCDEF12-34567890ABCDEF12", -"ABCDEF12-34567890ABCDEF 34" -9 -10 -11 -12 -1, -13 -"lost_message": "Enter your Lost Message -14 -15 -16} -operation -String -Devices Operations - Bulk Operations - Activation Lock -Required -enable activationlock -disable activationlock -devices -Array [string] -Required -Array of Unique Device Identifier (Device UDID) -lost message -String -Optional -The message to display on the screen of the device -Example Request to Enable Activation Lock: -1 curl --location "https://managerapi.mosyle.com/vl/bulkops -2 --header 'Content-Type: application/json' \ -3 --header Authorization: Bearer ((Bearer_Token}}' \ -4 --data ( -accessToken": "Access Token -"elements": [ -5 -6 -7 -8 -9 -10 -11 -12 -}, -13 -14 -"operation": "enable activationlock" -"devices": [ -"ABCDEF12-34567890ABCDEF12" -"ABCDEF12-34567890ABCDEF34" -"lost_message": "Enter your Lost Message" -15 -16 ) -Example Request to Disable Activation Lock: -1 curl --location 'https://managerapi.mosyle.com/v1/bulkops -2 --header 'Content-Type: application/json' -3 --header 'Authorization: Bearer Bearer Token' -4 --data -5 -6 -7 -8 -"accessToken": "Access_Token" -elements": [ -"operation": "disable activationlock", -devices":[ -"ABCDEF12-34567890ABCDEF12" -"ABCDEF12-34567890ABCDEF34" -9 -10 -11 -12 -1 -13 -14 -1 -15) -Devices Operations - Bulk Operations - Move Devices to Accounts (District Only) -To move devices from the District Level to a specific account you will pass the value move_device_account through the key operation and send the Device UDID through the key parameter devices and/or the Device Group ID through the key parameter groups. You can send both commands at the same time. -Key -Description -move_device_account -Type -Required -operation -String -Required -devices -Array -Required -An array of Unique Device Identifiers (UDID) -AccountID -Integer -Required -Account ID where the device should be moved -groups -Array -Options -An array of Device Group IDs -NOTE: There is a limit of 200 elements per request. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/bulkops' -2 --header 'Content-Type: application/json' \ -3 --header Authorization: Bearer {{Bearer_Token}}' A -4 --data-raw ( -accessToken": "Access Token" -"operation": "move device account", -"devices":["00001023-001234567890A018","1000a0bc0000000d123456e001g99h10jk12345e"], -"AccountID": "123", -5 -6 -"elements": [ -7 -8 -9 -10 -11 -"groups": ["27"] -12 -} -13 -14) -Successful Response: -1 { -status: "OK -response: [ -2 -3 -4 -{ -5 -6 -7 -} -8 -1 -9) -Devices Operations - Bulk Operations - Move Devices to Accounts (District Only) -status: "COMMAND SENT" -info: "Command sent successfully." -If the account is not found: -status: "OK" -response: [ -status: "ACCOUNT_NOTFOUND" -info: "No account found." -1 ( -2 -3 -4 -5 -6 -7 -} -8 -1 -9) -Without 'AccountID' key: -1 ( -2 -3 -4 -5 -6 -status: "OK" -response: [ -status: "MISSING_DATA" -info: "Missing key: AccountID" -7 -} -8 -J -9) -If the request is made from an account that is not a District Account: -response: [ -status: "NOT ALLOWED -1 ( -2 -status: "OK" -3 -4 -5 -6 -7 -8 -} -9 -J -10 } -info: "This operation is available only for District Level" -Devices Operations - Bulk Operations - Change/Update Limbo Location -To change or update the location of devices in Limbo you will pass the value update limbo_location through the key operation and send the Device UDID through the key parameter -devices and/or the Device Group ID through the key parameter groups. You can send both commands at the same time. -Key -Type -Required -Description -operation -String -Required -update_limbo_location -devices -Array -Required -An array of Unique Device Identifiers (UDID) -location -String -Required -The name of the location to assign the devices. -groups -Array -An array of Device Group IDs - update the location of all devices in the group -NOTE: To update or change the location of limbo devices, the setting "Limbo devices belong to all locations must be disabled under My School > Preferences > Other Settings > General -Preferences. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/bulkopa -2 --header Content-Type: application/json" \ -3--header Authorization; Bearer ((Bearer_Token}} \ -4 --data-raw -5 -"accessToken": "Access_Token" -6 -"elements": [ -7 -B -9 -10 -11 -12 -13 -1 -14 -"operation": "update limbo_location" -"devices":["00001023-001234567890018","1000a0be0000000d123456c00fg99hi0jk12245e"], -"location": "Mosyle School", -"groups":["27" 1 -Successful Response: -1 ( -status: OK -2 -3 -( -6 -7 -response: [ -status: "COMMAND_SENT" -info: "Command sent successfully to all Limbo devices. -B -9) -20 -Users Operations - List Users -Key -page -Туре -integer -specific_columns Array of -strings -types -Array of -string -identifiers -idusers -Array of -integers -Description -The API does not send the entire list of users in one request, it needs to use pagination (default: 1). -Arboret This option should be used to receive just the necessary attributes for each user. Possible values: id, name, email, grades, -managedappleid, serial number, type, locations, account, assigned_devices -Filter users by type. Possible values: STUDENT, TEACHER, LOCATION LEADER, STAFF, ADMIN, ACCOUNT ADMIN, -DISTRICT ADMIN. -Chronian Filter users by User ID -Array of Amo Filter users by Unique Internal Mosyle ID integers -You will hit the endpoint /listusers and can send parameters to filter your request for the specific info you want to receive in your response. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/listusers' -2 --header -Content-Type: application/json' \ -3 --header Authorization: Bearer ((Bearer_Token)) A -4 --data( -5 -6 -7 -8 -9 -10 -"accessToken": "Access_Token", -"options": { -"specific_columns": [ -type -11) -page -Integer -specific columns Array of -strings -types -Array of -string -CHOWIT -identifiers -Array of -integers -Users Operations - List Users -The API does not send the entire list of users in one request, it needs to use pagination (default: 1). -This option should be used to receive just the necessary attributes for each user. Possible values: id, name, email, grades, -managedappleid, serial_number, type, locations, account, assigned_devices -Filter users by type. Possible values: STUDENT, TEACHER, LOCATION LEADER, STAFF, ADMIN, ACCOUNT ADMIN, -DISTRICT ADMIN. -Filter users by User ID -idusers -Array of -integers -Filter users by Unique Internal Mosyle ID -You will hit the endpoint /listusers and can send parameters to filter your request for the specific info you want to receive in your response. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/listusers -2 --header 'Content-Type: application/json' \ -3 --header Authorization: Bearer ((Bearer Token}} \ -4 --data -5 -6 -7 -8 -9 -"accessToken": "Access_Token" -"options": { -"specific_columns": [ -"type" -10 -11) -Success Response: -1 ( -2 -"status": "OK" -"response": { -3 -4 -5 -6 -7 -8 -9 -10 -} -11} -"users": [ -"id": "dc093492-d2bf-4c0a-9a8e-5aadc541e250", "type": "STUDENT" -Users Operations - Create Users -To create a user you will pass the value save through the parameter operation. -Key -Туре -Description -id -String -max: 255 -Required -This is the User ID. This MUST be unique inside the School Database and will be used for other services. -chars -operation -string -Required -save -name -String -Required -User Name -max: 100 -chars -type -string -Required -Possible values: -S: Student -T: Teacher -STAFF: Staff -email -String -max: 255 -chars -Required (Optional -User E-mail address -for students and -staff) -managed appleid String -max: 255 -chars -locations -Array -Required for -Students, Teachers, -and Staff -welcome email -Integer -Managed Apple ID created in ASM -Each array position should contain 2 keys: name, grade level. The key 'grade level' is required only for students (for -other user types this key can be omitted). Location Name and Grade Level have a limit of 50 characters each. -Required Values: 1 -(one): 0 (zero) -When the value is 1, Mosyle Manager will send an email with the instructions to login. This option will only work when -the email field is not blank. -idaccount -integer -Required if District -account -School account ID where the user should be added. -welcome email Integer -Required Values: 1 -Users Operations - Create Users -When the value is 1, Mosyle Manager will send an email with the instructions to login. This option will only work when -the email field is not blank. -(one): 0 (zero) -idaccount -integer -Required if District -account -School account ID where the user should be added. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/users -2 --header Content-Type: application/json" -3 --header 'Authorization: Bearer ((Bearer Token))' \ -4 --data-raw { -"accessToken": "Access Token" -"elements": [ -"operation": "save", -"id": "example.student" -"name": "Example Student "type": "S", -"email": "example.student@mosyle.com" "locations": [ -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -], -19 -20 -21 -"name": "Cityview Day School" -"grade_level": "Kindergarten" -"welcome_email": 0 -22 ) -Success Response: -1 ( -'status': 'OK', -'elements': [ -2 -3 -4 -5 -6 -7 -} -8 -1 -9} -id': user.staff.1' -'status': 'OK' -Users Operations - Update Users -To update a user you will pass the value update through the parameter operation. -Key -Type -id -String -Required -max: 255 -chars -Description -This is the User ID. This MUST be unique inside the School Database and will be used for other services. -operation -string -Required -update -name -String -User Name -max: 100 -type -chars -string -email -String -max: 255 -chars -CHICHINE -managed appleid String -Possible values: -S: Student -T: Teacher -STAFF: Staff -User E-mail address -Managed Apple ID created in ASM -max: 255 -chars -locations -Array -Each array position should contain 2 keys: name, grade level. The key grade level' is required only for students (for other user -types this key can be omitted). Location Name and Grade Level have a limit of 50 characters each. -idaccount -integer -Required if -District -account -School account ID where the user should be updated -chars -Users Operations - Update Users -managed_appleid String -max: 255 -chars -Managed Apple ID created in ASM -locations -Array -Each array position should contain 2 keys: name, grade level. The key 'grade level' is required only for students (for other user -types this key can be omitted). Location Name and Grade Level have a limit of 50 characters each. -idaccount -integer -Required if -School account ID where the user should be updated -District -account -Example request: -1 curl --location https://managerapi.nosyle.com/v2/users -2 --header 'Content-Type: application/json" V -3 --header Authorizations Bearer ((Bearer_Token)) A -4 --data-raw ( -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -"accessToken": "Access_Token" -"elements': [ -"operation": "update" -"id": "example.student", -"name": "Example student", "type": "", -"email": "example.student@mosyle.com -"locations": [ -"name": "Cityview Day School" -"grade_level": "Rindergarten" -Success Response: -1 -2 -'status': 'OK -3 -'elements': [ -4 -5 -'id': 'example.student -6 -'status'1 'OK! -7 -8 -9 -Users Operations - Delete User -Key -Туре -Description -id -String max: 255 chars -Required -This is the User ID. This MUST be unique inside the School Database and will be used in other services. -operation -string -Required -delete -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/users -2 --header 'Content-Type: application/json -3 --header Authorization: Bearer ((Bearer Token}} -4 --data-raw ( -"accessToken": "Access Token -"elements":[ -5 -6 -7 -8 -9 -10 -11 -12 }' -Success Response: -"operation": "delete" -"id": "new.user.1° -11 -2 -"status": "OK" -3 -"elements": [ -4 -5 -6 -"id": "user.staff.1", -"status": "OK" -7 -8 -1 -9} -Users Operations - Assign Devices -Key -Туре -id -String max: 255 chars -Required -operation -string -Required -Description -This is the User ID. This MUST be unique inside the School Database and will be used for other services. -assign_device -serial number -string -Required -Assign a specifc device to the user. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/users' -2 --header 'Content-Type: application/json' \ -3 --header Authorization: Bearer {{Bearer Token}}' \ -4 --data-raw ( -accessToken": "Access Token' -"elements":[ -5 -6 -7 -8 -9 -10 -11 -12 -1 -13) -"operation": "assign_device" -"id": "new.user.1", -serial number": "AAAAAAAAAAAA" -Success Response: -1 { -2 "status": "OK" -elements": [ -3 -4 -5 -6 -7 -} -8 -1 -9) -"id": "user.staff.1", -"status": "OK" -Key -Туре -id -String (max: 100) -operation -String -Classes - Save and Delete Classes -Description -Required Class ID in the Education Institution Database. -Required save: Save or update the class in the system. -delete: Delete the class -course_name -String max: 50 chars -Required Course Name -class_name -String max: 50 chars -Required -Class Name -location -String max: 50 chars -Required -Location name. If the Location does not exist, one will be created with this name. -idteacher -String -Required -Teacher ID, same ID value entered in the User Web Service. -students -Array -Array of student IDs. The Student must be the same modality of the class. Class 1:1 just contain students 1:1. -room -String max: 50 chars -Room where the class is offered. -coordinators -Array -platform -String -Array of Instructor User IDs. The User ID can not belong to a student. -The absence of this value will default to the "ios" platform. This value can be ios or mac. -You will hit the endpoint /classes and pass the value save or delete through the parameter operation. -Classes - Save and Delete Classes -course_name -String max: 50 chars -Required Course Name -class_name -String max: 50 chars -Required Class Name -location -String max: 50 chars -Required -Location name. If the Location does not exist, one will be created with this name. -idteacher -String -Required -Teacher ID, same ID value entered in the User Web Service. -students -Array -Array of student IDs. The Student must be the same modality of the class. Class 1:1 just contain students 1:1. -room -String max: 50 chars -Room where the class is offered. -coordinators -Array -platform -String -Array of Instructor User IDs. The User ID can not belong to a student. -The absence of this value will default to the "ios" platform. This value can be ios or mac. -You will hit the endpoint /classes and pass the value save or delete through the parameter operation. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/classes -2 --header -Content-Type: application/json' \ -3 --header Authorization: Bearer {{Bearer Token)) A -4-data -5 -6 -7 -( -accessToken": "Access Token -"elements": [ -8 -9 -10 -11 -12 -13 -14 -} -15 -16) -"operation": "save" -"id": "class.id", -course_name": "Test API" "class_name": "Class Test", "location": "Mosyle Training", "idteacher": "teacher.api" -Success Response: -1 ( -2 -3 -"status": "OK", -"uuid": "123456789" -4) -Classes - List Classes -Key -Type -Description -integer -Optional The API will not send the entire list of classes in one request, rather it uses pagination (default: 1). -page -specific_columns Array of -strings -Optional This option should be used to receive just the necessary attributes for each class. Possible values: id, class_name, course_name, -location, teacher, students, coordinators, account. -You will hit the endpoint /listclasses and can send the parameter options as an array to filter your search -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/listclasses -2 --header Content-Type: application/json' \ -3 --header Authorization: Bearer {{Bearer_Token}}' \ -"accessToken": "Access Token" -"options": -4 --data { -5 -6 -7 -8) -9) -"Access_Token" -"specific_columns": ["class_name", "teacher", "location"] -Success Response: -"OK" -"response": { -"classes" : [ -{ -"id": "dc093492-d2bf-4c0a-9a8e-5aadc541e250" -"idclass": "123", -"name": "class I", -11 -2 -"status": -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -} -15) -"teacher": "john.smith", "locations": [ -"Townsville" -X -Accounts (District Only) - Get Accounts -X -For district accounts, hit the endpoint /accounts to get a list of all accounts. -Example request: -1 curl --location https://managerapi.mosyle.com/v2/accounts' -2 --header 'Content-Type: application/json' \ -3 --header 'Authorization: Bearer ((Bearer_Token}} -4 --data -5 -6) -"accessToken": "Access Token" -"accessToken -Success Response: -1 ( -2 -"status": "OK" -"accounts": [ -3 -4 -5 -"idaccount": -6 -7 -8 -"name": "Account 1", -"address": "Street 1 -"date_created": "1556195183" -9 -10 -11 -12 -13 -"idaccount": "2", -"name": "Account 2", -"address": "Street 2 -14 -"date_created": "1556195196" -15 -} -16 -1 -17 } -Accounts (District Only) - Create new Account -Key -Type -Description -operation -String -Required -The value of this operation must be 'request: -school_name -String -Required -The name of the new account. -school address -String -Required -The address info of the new account. -leader_name -String max: 100 chars -Outional -The name of the account leader. -leader email -String max: 255 chars -Optional -The email of the account leader. -leader id -String max: 255 chars -Optional -The id of the account leader. -uuid -String max: 255 chars -Optional -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/accounts -2 --header Content-Type: application/json' \ -3 --header Authorization: Bearer ((Bearer_Token}}' V -4 --data-raw -5 -6 -7 -8 -"accessToken": "Access_Token" -"elements": [ -9 -10 -11 -} -12 -13) -"operation": "request", -"school_name": "New School" -school address": "New School Street" -Success Response: -1 ( -2 -"status": "OK", -3 -"uuid": "123123" -4) -Key -Туре -action -String Required -wifimac -String -Required -serialnumber -String -Required -model -String -Cisco ISE - Cisco ISE - Add and remove Devices -Description -Values can be add or remove, in order to add or remove the mac address and serial number from the Cisco ISE list. -Device model, Limit 50 characters. -You will hit the endpoint /ciscoise and pass the value add or remove through the parameter action. -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/ciscoise! -2 --header Content-Type: application/json' -3 --header 'Authorization: Bearer ((Bearer_Token}}' -4 --data( -5 -6 -7 -8 -9 -10 -11 -12 -accessToken": "Access Token -elements": [ -"action": "add", -"wifimac": "XX:XX:XX:XX:XX:XX" "serialnumber": "XXXXXXXXXXXX" -13} -X -Cisco ISE - Cisco ISE - Get Device -In this operation you just need to hit the endpoint /getciscoise and can send the parameter paging, check out the example below -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/getciscoise' -2 --header 'Content-Type: application/json' A -3 --header Authorization: Bearer ((Bearer_Token}} \ -4 --data ( -5 -6) -accessToken": "Access Token" -Dynamic Device Groups Operations - List Dynamic Device Groups -You will hit the endpoint /listdevicegroups and can send parameters to filter your request for the specific info you want to receive in your response or -receive all info about dynamic device groups. -Available options: -Key -Type -Required -Description -enum ('ios', 'mac, 'tvOS, 'visionos") -Required -Operational system -page -integer -Pagination starting with O -Dynamic Device Groups Operations - List Dynamic Device Groups -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/listdevicegroups' -2 --header -Content-Type: application/json -3 --header Authorization: Bearer ((Bearer Token}} -((Bearer_Token}}') -4 --data -5 -accessToken": "Access Token" -6 -"options": { -7 -"os": "mac" -8 -9) -Example Response: -1 { -2 -23 -4 -status: "OK", -response: [ -1 -groups: [ -id: "210" -name: "My Device Group device numbers: "3", -5 -6 -7 -8 -9 -10 -} -11 -J. -12 -rows: -13 -page size: 50 -14 -page: -15 -} -16 -1 -17 } -2 -3 -Without 'os' key: -1 ( -status: "OK" -response: [ -4 -{ -5 -status: "MISSING_DATA" -6 -7 -} -8 -1 -9) -info: "Missing key: os -Dynamic Device Groups Operations - List Devices -You will hit the endpoint/listdevicesbygroup and can send group ID to filter your request for the specific dynamic device group you want to receive in your -response. -Available options: -Key -Type -Required -Description -iddevicegroup -string Required Dynamic Device Group ID (you can obtain this data using the "List Dynamic Device Groups" operation) -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/listdevicesbygroup' -2 --header Content-Type: application/json' \ -3 --header Authorization: Bearer {{Bearer_Token)) A -4 --data-raw ( -5 -6 -7 -8 -accessToken": "Access Token -"options": { -"iddevicegroup":"123" -9) -Successful Response: -1 ( -2 -status: "OK -3 -response: ( -4 -5 -6 -7 -8 -9 -10 -11 } -group_name": "Class 101", -"udids":[ -J -} -1CD85FCF-04EA-5540-9E73-94FB4D36A392 -"22473995-BE4A-0CEO-FA60-26827D981212" -"E4ED28D6-6C5D-585C-93FB-AESAD12321J3" -X -Dynamic Device Groups Operations - Add/Remove Device from Dynamic Device Group -When you access the Mosyle API endpoint /devicegroups passing the value update_devices through the parameter operation you can add or remove specific device UDIDs from a device group. This action requires the key parameter idgroup to filter which Dynamic Device Group you want to add or remove the -devices. -Available options: -Key -Type -Required -Description -operation -string -Required -update_devices -idgroup -integer -Required -Device Group ID -add -[string] -remove -[string] -List of the Device UDIDs to add to the specific device group -List of the Device UDIDs to remove from the specific device group -* At least one must be included -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/devicegroups' -2 --header 'Content-Type: application/json' \ -3 --header Authorization: Bearer ((Bearer Token}} -4 --data-raw -5 -6 -7 -8 -9) -accessToken": "Access Token" -operation": "update devices -"idgroup":"154", -"add": [ "AAAAAAAA-1234-4321-A182-AAAAA -AAAA" 1 -Success Response: -1 ( -2 -status: "OK -3 -response: [ -4 -5 -status: "OK" -6 -7 1 -8) -info: "110", -Dynamic Device Groups Operations - List Devices in Device Groups -You will hit the endpoint /listdevicegroupsdevices and can send parameters to filter your request for the specific info you want to receive in your response about device groups. -Available options: -Key -Туре -Required -Description -OS -enum ('ios', 'mac, 'tvos') -Required -Operational system -page -integer -OutMail -Pagination starting with 1 -page_size -integer -Optional -Default is 50 -Dynamic Device Groups Operations - List Devices in Device Groups -X -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/listdevicegroupsdevices' -2 --header Content-Type: application/json' \ -3 --header Authorization: Bearer ((Bearer_Token}} \ -4 --data -"options": { -5 -"accessToken": "Access Token -6 -7 -"os": "mac" -8 -9) -Response: -1 ( -2 -status: 'OK' -3 -response: [ -4 -1 -5 -6 -7 -8 -9 -groups: L -id: '210', -name: 'My Device Group', -device_numbers: '1', -10 deviceudids: ["02345030-000A34203A83B02"], -11 -12 -13 -} -J. -14 -15 -rows: -page size: 50 -16 -page: -17 -18 -19 } -Without 'os' key: -1 { -2 status: 'OK' -3 -response: [ -4 -5 -6 -( -status: MISSING DATA -info: 'Missing key: os -7 -} -8 -9) -Dynamic Device Groups Operations - List Devices in Device Groups -You will hit the endpoint/listdevicegroupsdevices and can send parameters to filter your request for the specific info you want to receive in your response about device groups. -Available options: -Key -Туре -Required -Description -enum ('ios; 'mac, 'tvos') -Required -Operational system -page -integer -Optional -Pagination starting with 1 -page_size -integer -Optional -Default is 50 -Dynamic Device Groups Operations - List Devices in Device Groups -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/listdevicegroups devices' -2 --header Content-Type: application/json' \ -3 --header Authorization: Bearer ((Bearer_Token}}' \ -4 --data ( -5 -accessToken": "Access Token -6 -"options": { -7 -"os": "mac" -8 -9) -Response: -1 ( -response: [ -2 -status: 'OK' -3 -4 -5 -6 -7 -8 -9 -groups: [ -id: 210', -name: My Device Group -device_numbers: '1', -10 deviceudids: ["02345030-000A34203A83B02F"], -11 -12 -} -13 -1, -14 -15 -16 -17 -} -18 -J -rows: -page size: 50 -page: -19 } -Without 'os' key: -1 ( -2 -status: -OK, -3 -response: [ -4 -5 -status: MISSING DATA' -6 -info: Missing key: os' -7 -8 -1 -9) -Action Logs - List -Key -Type -page -Integer -filter_options Array of -strings -Description -The API does not send the entire list of logs in one request. Pagination should be used to get more data if the response has more pages (default: 1). -Values that can be used to filter the Action Logs: start date (timestamp), end_date (timestamp), idusers (array of users id). -page -Integer -Action Logs - List -The API does not send the entire list of logs in one request. Pagination should be used to get more data if the response has more pages (default: 1). -filter options Array of -Values that can be used to filter the Action Logs: start date (timestamp), end_date (timestamp), idusers (array of users id). -strings -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/adminlogs -2 --header 'Content-Type: application/json' \ -3 --header 'Authorization: Bearer ((Bearer_Token))' \ -4 --data-raw -5 -"accessToken": "Access Token" -6 -"filter options": -7 -"start_date": "1696561838" -8 -"end_date":"1696821038" -9) -10 } -Success Response: -1 ( -2 -"status": "OK", -"response": [ -3 -4 -{ -5 -6 -7 -8 -9 -"logs":[ -10 -11 -12 -13 -14 -15 -} -16 -1, -17 -18 -19 -20 -21 -J -22 } -"action": "Save Profile". -"details": { -}, -"Profile Type": "Install App -"Operating System": "macos -"username": "Catalog" -"action_date":"2021-03-01", "ip": "127.0.0.1" -"rows": "1", -"page_size": -"page": 1 -50 -Mosyle Logs Stream - Mosyle Logs Stream -To use the Mosyle Logs Stream API, you first need to configure the options under My School > Integrations > Mosyle Logs Stream. When configuring the integration method, choose "Mosyle Logs Stream API". -Obtain Access Token -Once Mosyle Logs Stream API is configured, you will see your access token and the option to configure the Access Method as well as select the Log Streams -of interest. -You'll make requests to the endpoint" -structured in JSON format. -*The Mosyle API supports the POST request method. All API responses are -Request Bearer Token -To start, make a request to the Mosyle API endpoint "/login" including the email and password in the body of the request and the access token in the header. -Mosyle Logs Stream - Mosyle Logs Stream -X -Example request: -1 curl --include --location -2 --header -https://schoolapilogs.moayle.com/vi/login' -accessTokens Access Token -3--header Content-Type: application/json" -4 --data-raw ( -5 -6 -7 -"email" "User Email -"password": "User Password" -Example response: -1 HTTP/1.1 200 OK -2 Date: Mon, 21 Aug 2023 17:31:09 GMT -3 Server: Apache -4 X-Frame-Options: SAMEORIGIN -5 X-XSS-Protection: ; mode=block -6 X-Content-Type-Options: nosniff -7 Content-Security-Policy: frame-src 'self' 'unsafe-eval' 'unsafe-inline' -8 Strict-Transport-Security: max-age=3072000; includeSubdomains; -.mosyle.com frame-ancestors 'self' -9 Set-Cookie: PHPSESSID=8901c23c1234e5678b901d2a34a56cc7; path=/; domain=.mosyle.com; secure; HttpOnly 10 Expires: Thu, 19 Nov 1981 08:52:00 GMT -11 Cache-Control: no-store, no-cache, must-revalidate -12 Pragma: no-cache -13 Authorization: Bearer Bearer_Token -14 Content-Length: 5) -15 Content-Type: application/json -16 -17 {"UserID":"User ID", "email":"User Email -The response will contain a -Mole as a JSON Web Token (JWT) in the header which will be needed for subsequent requests. The token will expire -every 24 hours and will need to be renewed. -When accessing any other Mosyle Logs Stream API endpoints, include the string "Bearer" followed by the JWT in the request header along with the access -token. -*Note: If you are using PowerShell, you will need to utilize 'Invoke-WebRequest' to view the Bearer token to then parse or copy/paste it as necessary. -The following snippet will be used in all subsequent requests: -1 curl --location https://schoolapilogs.mosyle.com/vi' \ -2 --header 'Content-Type: application/json" -3 --header -4 --header -accessTokens Access Token A -Authorization: Bearer Bearer_Token' -Request Logs Stream -Mosyle Logs Stream - Mosyle Logs Stream -When you access the Mosyle Logs Stream API endpoint /logsstream, all selected logs will be listed. You can pass an additional parameter to filter your search or change the result. -Available options: -Key -Туре -Required Description -LogType String [array] -page -Required Array containing the types of logs you want to retrieve (among those selected previously in Mosyle Logs Stream Form). -Available options: zero_trust, action_logs, compliance, av, and dns. -Integer CMW Default 1 -50 results per page -X -Mosyle Logs Stream - Mosyle Logs Stream -Example request: -1 curl --location 'https://schoolapilogs.mosyle.com/vi/logsstream' -2 --header 'Content-Type: application/json' \ -3--header accessToken: Access Token' \ -4 --header Authorization: Bearer Bearer Token' A -5 --data ( -"LogType" : [ -"zero trust", -'action logs -"compliance" -6 -7 -8 -9 -10 -11 -dns -12 -1 -13) -"av", -Example Response: -1 { -2 -"status": "OK" -3 -"response": { -4 -"av": { -5 -"Logs" : [ -6 -7 -1, -8 -9 -10 -11 -12 -}, -13 -14 -15 -"Page":1, -"ItensPerPage": 5000, -"TotalLogs": -"TotalPages": -"zero_trust":{ -"Events": { -"TotalLogs": -16 -17 -18 -"TotalPages": -"ItensPerPage": 2500, -19 -20 -{ -21 -22 -23 -24 -25 -26 -27 -28 -"Page": -"Logs":[ -"Device": "MacBook Air", -"Application": -"com.google.Chrome.UpdaterPrivilegedHelper "FileName": "com.google.Chrome.UpdaterPrivilegedHelper", "Action": "Trusted" -"Source": "Manual" -"Timestamp": "1710264696", -"Identifier": "com.google.Chrome.UpdaterPrivilegedHelper" "Hash": "4e28088b... -Mosyle Logs Stream - Mosyle Logs Stream -47 -1 -48 -}, -49 -"ios": { -50 -"Page": -51 -52 -"ItensPerPage": 2500, -"TotalLogs": -53 -"TotalPages": -54 -55 -1 -56 -57 -58 -59 -60 -"SerialNumber": "123456CD78" -61 -"Logs" : [ -"Status": "Lost Compliance" -"RuleName": "Cookies are allowed from visited websites only", -"Timestamp": "01:00 PM - 03/12/2024", -"DeviceName": "iPad 100", -"E-mail": "test@mail.com" -62 -63 -64 -65 -}, -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -"action_logs": { -"Page": -"ItensPerPage": 5000, -"TotalLogs": -"TotalPages": -"Logs" : [ -"UserName": "Jane Smith", -"Action": "Save Device Group" -"ActionDate": "1710267184", -"Content": "Name: ##DEVICE GROUP VS\n" "IP": -::1", -"E-mail": "jane.smith@mail.com" -79 -}, -80 -81 -82 -83 -84 -85 -86 -"UserName": "John Doe", -"Action": "Save Mosyle Logs Stream Profile" -"ActionDate": "1710267152", -"Content": "Profile Name: #1 - John Doe \nProfile Type: Mosyle Logs Streamin" -"IP": "192.168.65.1", -"E-mail": "john.doe@mosyle.com" -87 -88 -89 -90 } -91 ) -Custom Device Attributes - List Custom Device Attributes -To list the Custom Device Attributes you will access the Mosyle API endpoint/customdeviceattribute and pass the value list_custom_device_attributes through the parameter -operation. -Key -Type -operation -String -Required -Description -list_custom_device_attributes -String -Required -OS of the devices with the Custom Device Attribute (ios, tvos, mac, visionos) -Example request: -1 curl --location "https://managerapi.mosyle.com/v2/customdeviceattribute -2 --header 'Content-Type: application/json' \ -3 --header Authorizations Bearer ((Bearer_Token))" -4 --data ( -"accessToken": "Access_Token", -"elements":[ -5 -6 -7 -8 -9 -"operation": "list custom device attributes -"os": "mac" -10 -11 -12 -Example response: -1 -2 -"status": "Ox -3 -"response":[ -"status": "OK" -"info": [ -5 -6 -7 -( -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -"Name": "Custom Device Attribute" -"UniqueID": "custon oda", -"Value": "1234value" -"LastUpdate": "1710266724" -"Source": "API", -*IsDeleted": -Custom Device Attributes - Create Custom Device Attributes -To create Custom Device Attributes you will access the Mosyle API endpoint/customdeviceattribute and pass the value create_custom_device_attributes through the parameter -operation. -Key -Type -operation -String -Required -Description -create_custom_device_attributes -String -Required -OS of the devices with the Custom Device Attribute (ios, tvos, mac, visionos) -unique id -String -Required -Unique ID of the Custom Device Attribute -name -String -Required -Name of the Custom Device Attribute -value -String -Required -Designated Value of the Custom Device Attribute -devices -String (array) -Required -List of device UDIDs to be assigned the Custom Device Attribute -Example Request: -1 curl --location 'https://managerapi.monyle.com/v2/customdeviceattribute 2-header 'Content-Type: application/json" \ -3--header Authorization: Bearer ((Bearer_Token)) A -4 --data -"accessToken": "Access_Token" -"elements [ -"operation": "create custom device attributes" -"os": "mac -"unique_id": "custom_eda" -"name": "Custom Device Attribute", -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -1 -16 -17 -"value": "1234Value", -"devices": [ -AGDODAOA-FORF-000C-0C0B-0BA000000000" -18 ) -Example Response: -"status": "OK", -"response":{ -"status": "OK", -"info": "Custom Device Attribute saved successfully" -Custom Device Attributes - Assign Custom Device Attributes -To assign Custom Device Attributes to devices you will access the Mosyle API endpoint /customdeviceattribute and pass the value assign_custom_device_attributes through the -parameter operation. -Type -Description -Key -operation -String -Required -assign_custom_device_attributes -String -Required -OS of the devices with the Custom Device Attribute (ios, tvos, mac, visionos) -unique_id -String -Required -Unique ID of the Custom Device Attribute -value -String -Required -Value of the Custom Device Attribute to be assigned -devices -String (array) -Required -List of device UDIDs to be assigned the Custom Device Attribute -Example Request: -1 curl --location 'https://managerapi.mosyle.com/v2/customdevicesttribute" 2 --header -Content-Type: application/json" \ -3 --header Authorizations Bearer ((Bearer_Token)) -4 --data ( -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17) -"accessToken": "Access_Token" -"elements": [ -"operation": "assign_custom_device_attributes" -"os": "mac -"unique_id": "custom cda", -"value": "Custom Attribute", "devices": [ -"AGDODAOA-FORF-000C-0C0B-OBA000C00000 -Example Response: -2 -'status": "OK" -7 -"response": { -status" "OK" -"info": "Custom Device Attribute assigned successfully -9 -X -Custom Device Attributes - Update Custom Device Attributes -To update Custom Device Attributes you will access the Mosyle API endpoint/customdeviceattribute and pass the value update_custom_device_attributes through the parameter -operation. -To update the value of a Custom Device Attribute, the old_unique_id and unique id will remain the same. Just pass the updated value on the request. -Key -Туре -operation -String -Required -Description -update_custom_device_attributes -05 -String -Required -OS of the devices with the Custom Device Attribute (ios, tvos, mac, visionos) -old_unique_id -String -Required -Original Unique ID of the Custom Device Attribute that will be updated -unique id -String -Required -Unique ID of the updated Custom Device Attribute -name -String -Required -Name of the Custom Device Attribute -value -String -Required -Designated Value of the Custom Device Attribute -Example Request: -1 curl --location https://managerapi.nosyle.com/v2/customdeviceattribute -2 --header 'Content-Type: application/json" V -3 --header 'Authorization: Bearer ((Bearer_Token)) -4 --data ( -accessToken": "Access_Token" -"elements":[ -5 -6 -7 -( -8 -9 -10 -11 -12 -13 -14 -15 -16 -"operation": "update custom device attributes" "os" "mact -"old_unique_id": "custom_eda", -"unique_id": "new_custom_oda", -"name": "Custom Device Attribute", -"value": "1234Value" -Example Response: -1 -2 -"status": "Ox -3 -"response": { -"status": "OK", -5 -6 -"info": "Custom Device Attribute saved successfully" -7 -8 -9 -X -Custom Device Attributes - Remove Custom Device Attributes -To remove the assignment of Custom Device Attributes from devices you will access the Mosyle API endpoint /customdeviceattribute and pass the value remove_custom_device_attributes through the parameter operation. -Key -Type -Description -operation -String -Required -05 -String -Required -remove_custom_device_attributes -OS of the devices with the Custom Device Attribute (ios, tvos, mac, visionos) -unique_id -String -Required -Unique ID of the Custom Device Attribute -devices -String (array) -Required -List of device UDIDs to be removed/unassigned from the Custom Device Attribute -Example Request: -1 curl --location https://managerapi.mosyle.com/v2/customdeviceattribute -2 --header 'Content-Type: application/json" -3 --header Authorization: Bearer ((Bearer_Token))" \ -accessToken": "Access Token -"elements":[ -4 --data ( -5 -6 -7 -B -9 -10 -11 -12 -13 -14 -15 -16 -"operation": "remove_custom_device_attributes -"os": "mac -"unique_id": "custom_cda" -"devices":[ -A000DAOA-FOEF-000C-0C0B-0BA000000000" -Example Response: -1 ( -2 -"status":"0" -3 -6 -7 -8 -9) -"response": { -"status": "OK", -"info" : "Custom Device Attribute removed successfully" -Custom Device Attributes - Delete Custom Device Attributes -To delete a Custom Device Attribute you will access the Mosyle API endpoint /customdeviceattribute and pass the value delete_custom_device_attribute through the parameter -operation. -Key -Type -operation -String -Required -Description -delete_custom_device_attribute -05 -String -Required -OS of the devices with the Custom Device Attribute (ios, tvos, mac, visionos) -unique_id -String -Required -Unique ID of the Custom Device Attribute -Example Request: -1 curl --location 'https://managerapi.mosyle.com/v2/customdeviceattribute -2 --header 'Content-Type: application/json" \ -3--header Authorization: Bearer ((Bearer_Token)) -4 --data( -5 -6 -7 -8 -9 -10 -11 -12 -"accessToken": "Access Token" -"elements":[ -"operation": "delete_custom_device_attribute" -"os": "mac" -"unique_id": "new_custom_cda -13 ) -Example Response: -1 ( -2 -3 -"status": "Ox", -"response":{ -"status": "OK" -"info": "Custom Device Attribute deleted successfully" -7 -8 -9 -Shared Device Group Operations - Add/Remove Device from Shared Device Group -When you access the Mosyle API endpoint /shareddevicegroups passing the value assign_device through the parameter operation you can add or remove specific device UDIDs from a shared device group. This action requires the key parameter idshareddevicegroup to filter which Shared Device Group you want to add or remove the devices. -Available options: -Key -Type -Required -Description -operation -string -Required -assign_device -idshareddevicegroup -integer -Required -Shared Device Group ID -add -Array of strings -Cotional -List of the Device UDIDs to add to the specific shared device group -remove -Array of strings -Opfinnar -List of the Device UDIDs to remove from the specific shared device group -* At least one must be included -Example request: -1 curl --location 'https://managerapi.mosyle.com/v2/shareddevicegroups' 2 --header 'Content-Type: application/json' \ -3 --header 'Authorization: Bearer ((Bearer_Token}} -4 --data-raw -5 -6 -7 -8 -9 -accessToken": "Access Token" -operation": "assign device" -"idshareddevicegroup":"154" -"add": [ "AAAAAAAA-1234-4321-A182-AAAAAAAAAAAA"] -Success Response: -1 ( -2 -status: "OK -3 -response: [ -4 -5 -6 -status: "OK" -info: 110" -7 -1 -8) From 2de608d08118d47ed988a4bfa142af86896898f2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 15 Dec 2025 22:06:49 +0000 Subject: [PATCH 6/6] Auto: update integrations JSON and README --- docs/integrations.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/integrations.json b/docs/integrations.json index 2cb9046..abab71b 100644 --- a/docs/integrations.json +++ b/docs/integrations.json @@ -1,5 +1,5 @@ { - "lastUpdated": "2025-12-15T22:06:03.281948Z", + "lastUpdated": "2025-12-15T22:06:49.938502Z", "totalIntegrations": 30, "integrationDetails": [ {