Tool Name: airdroid_business_get_devices_with_filter
Risk Level: 🟢 Low Risk
Execution Mode: âš¡ Synchronous
Category: Device Management
Quick Start (Copy & Use)
Summary: Retrieve a paginated list of AirDroid Business devices with advanced Filter expressions supporting comparison operators and logical combinations.
Prerequisites: A valid OAuth2 AccessToken configured in the GI node Credential.
Success Criteria: StatusCode == 200 and ErrorMessage == "".
What to Do Next: Use Devices[].device_id as input for subsequent device action tools (e.g., Reboot Device, Lock a Device).
Minimal Request Example (recommended to copy directly):
{
"SelectedColumns": ["device_name", "device_id", "note"],
"Page": 1,
"PageSize": 50,
"Filter": {}
}
Minimal Response Example (from publish):
{
"Devices": [
{
"device_id": "ad0ea16dcb",
"device_name": "Air 1",
"note": ""
}
],
"Pagination": {
"total": 100,
"page_size": 50,
"current_page": 1,
"last_page": 2
},
"StatusCode": 200,
"ErrorMessage": ""
}
Recipes (Common Recipes)
Recipe 1: Minimal Field Set (Save Tokens)
When to use: For dashboards or inspections where you only need to identify devices along with online status, battery, and group.
{
"SelectedColumns": ["device_id", "device_name", "online", "battery", "group_name"],
"Page": 1,
"PageSize": 50,
"Filter": {}
}
Recipe 2: Advanced Filter (Battery > 50%)
When to use: Filter for online devices with battery above 50%.
{
"SelectedColumns": ["device_id", "device_name", "online", "battery"],
"Page": 1,
"PageSize": 50,
"Filter": {
"online": 1,
"battery": {"gt": 50}
}
}
Recipe 3: Multi-Condition Combination
When to use: Filter for online devices with battery above 80%.
{
"SelectedColumns": ["device_id", "device_name", "online", "battery", "batterycharging"],
"Page": 1,
"PageSize": 50,
"Filter": {
"online": 1,
"battery": {"gt": 80}
}
}
Recipe 4: IN and BETWEEN Operators
When to use: Filter for Wi-Fi or Ethernet connected devices with battery between 20%-80%.
{
"SelectedColumns": ["device_id", "device_name", "network_type", "battery"],
"Page": 1,
"PageSize": 50,
"Filter": {
"network_type": {"in": [3, 4]},
"battery": {"between": [20, 80]}
}
}
Recipe 5: LIKE Fuzzy Match
When to use: Filter for devices with names containing "test" (case-insensitive).
{
"SelectedColumns": ["device_id", "device_name", "online"],
"Page": 1,
"PageSize": 50,
"Filter": {
"device_name": {"like": "test"}
}
}
1. Overview
1.1 Description
Retrieve a paginated device list with support for:
- Advanced filtering via Filter (supports comparison operators and logical combinations)
- Field selection via SelectedColumns (reduce response size and token usage)
1.2 When to Use
- Pre-query for batch device operations: Fetch the device list first, then perform Reboot Device / Lock a Device on selected devices
- Complex condition filtering: When you need >, <, between, in and other operators
- Device inventory / export: Paginate through all devices and aggregate
- Status monitoring: Retrieve only online/battery status fields for quick dashboard data
1.3 Execution Mode and Response
This operation is synchronous and returns:
- Devices: Array of device objects
- Pagination: Pagination metadata (when using Filter, total reflects the filtered record count)
- StatusCode / ErrorMessage: Call status and error information
1.4 Prerequisites
| Condition | Description | How to Check |
|---|---|---|
| Valid credential | A valid OAuth2 AccessToken is required | Configure AirDroid Business OAuth2 credential in the GI node |
1.5 Prerequisite Tools
| Dependency Tool | Purpose | Necessity |
|---|---|---|
| Get Device Info Push | Refresh real-time device status | If you need the most up-to-date online/battery data |
1.6 Differences from Similar Tools
| Tool | Use Case | Key Difference |
|---|---|---|
| Get All Devices With Filter | Complex condition filtering, comparison operators and logical combinations | Supports Filter parameter with gt/lt/in/between operators |
| Get All Devices | Bulk query, basic single-field filtering | Only supports Keyword filtering (one field at a time) |
| Get a Device by Name | Single device lookup | Better suited for querying a single device |
2. Inputs
2.1 Parameter List
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| SelectedColumns | string-array | No | ["device_name","device_id","note"] | Field whitelist for response (max 10) |
| Page | number | No | 1 | Page number, starting from 1 |
| PageSize | number | No | 50 | Records per page, range 1-50 |
| Filter | object | No | {} | Advanced filter expression (supports operators and logical combinations) |
2.2 Parameter Details
`SelectedColumns`
- Type: string-array
- Format: String array (list of field names), max 10 items (DSL: MaxItems=10)
- Available values: See the field list in the DSL description (extensive list, see appendix)
- Example:
["device_id", "device_name", "online", "battery", "group_name"]
`Page`
- Type: number (code requires int)
- Format: Positive integer starting from 1
- Example:
1
`PageSize`
- Type: number (code requires int)
- Format: 1-50 (exceeding returns StatusCode=-1)
- Example:
50
`Filter`
- Type: object
- Format: Filter expression supporting operators and logical combinations
- Multiple conditions: Multiple fields listed together form an AND relationship
- Maximum conditions: 5
Supported Operators
| Operator | Description | Example |
|---|---|---|
| eq | Equals | {"online": {"eq": 1}} |
| ne | Not equals | {"online": {"ne": 0}} |
| gt | Greater than | {"battery": {"gt": 50}} |
| gte | Greater than or equals | {"battery": {"gte": 50}} |
| lt | Less than | {"cpu_usage": {"lt": 80}} |
| lte | Less than or equals | {"cpu_usage": {"lte": 80}} |
| in | Value in array | {"network_type": {"in": [3, 4]}} |
| like | Fuzzy match (case-insensitive) | {"device_name": {"like": "test"}} |
| between | Range | {"battery": {"between": [20, 80]}} |
Field Type and Operator Restrictions
Different field types support different operators:
| Field Type | Supported Operators | Fields |
|---|---|---|
| ID type | eq, in | device_id, group_id (requires ownership check) |
| Numeric | eq, ne, gt, gte, lt, lte, between, in | battery, cpu_usage, battery_temperature, screen_brightness, sdk_api_level, update_unix |
| String | eq, like, in | device_name, note, model, manu, snid, os_version, imei, imei2, mac, eth_mac, ip |
| Enum | eq, ne, in | online, daemon_status, am_state, network_type, battery_source, batterycharging, lost_mode_status, signal_strength, battery_health, hdmi |
If a field-operator combination is not supported, an error "Field 'xxx' does not support operator 'yyy'" will be returned.
Enum Field Values
Filter supports both numeric and string formats, consistent with Get All Devices Keyword parameter.
| Field | Numeric | String | Meaning |
|---|---|---|---|
| online | 0 / 1 | "Offline" / "Online" | Offline / Online |
| batterycharging | 0 / 1 | "Not charging" / "Charging" | Not charging / Charging |
| daemon_status | 0 / 1 | "Some not granted" / "All Granted" | Partially unauthorized / Fully authorized |
| am_state | 0 / 1 / 2 | "Not Rooted" / "Rooted" / "Granted Non-Root permission" | Root status |
| network_type | 1 / 2 / 3 / 4 | "3G" / "4G" / "Wi-Fi" / "Ethernet" | Network type |
| battery_source | -1 / 1 / 2 / 4 | "Unknown" / "AC" / "USB" / "Wireless" | Power source |
| lost_mode_status | 0 / 1 | "Not in lost mode" / "In lost mode" | Lost mode status |
| signal_strength | -1 / 0 / 1 / 2 / 3 / 4 | "Unknown" / "No signal" / "Poor" / "Fair" / "Good" / "Excellent" | Signal strength |
| battery_health | 1 / 2 / 3 / 4 / 5 / 7 | "Unknown" / "Good" / "Overheat" / "Depleted" / "Overvoltage" / "Cold" | Battery health |
| hdmi | 0 / 1 | "Not detected" / "Detected" | HDMI status |
Example (the following two formats are equivalent):
- Numeric: {"online": 1, "network_type": {"in": [3, 4]}}
- String: {"online": "Online", "network_type": {"in": ["Wi-Fi", "Ethernet"]}}
Multi-Condition Queries
Multiple fields in the Filter form an AND relationship (all conditions must be met simultaneously).
- Example: Filter for online devices with battery above 80%
{
"online": 1,
"battery": {"gt": 80}
}
2.3 Parameter Combination Logic
- Multiple fields in Filter automatically form an AND relationship
- SelectedColumns and Filter can be used together: filter first, then return specified fields
- For no filtering: use an empty object Filter: {}
3. Outputs
3.1 Response Example
{
"Devices": [
{
"device_id": "ad0ea16dcb",
"device_name": "Air 1",
"online": 1,
"battery": 85,
"batterycharging": 1
},
{
"device_id": "bd1fb27edc",
"device_name": "Air 2",
"online": 1,
"battery": 92,
"batterycharging": 0
}
],
"Pagination": {
"total": 15,
"page_size": 50,
"current_page": 1,
"last_page": 1
},
"StatusCode": 200,
"ErrorMessage": ""
}
3.2 Field Descriptions
| Field Path | Type | Description |
|---|---|---|
| Devices | object-array | Array of device objects (fields depend on SelectedColumns) |
| Devices[].device_id | string | Device unique identifier (typically used for subsequent device operations) |
| Devices[].device_name | string | Device name |
| Pagination | object | Pagination metadata object |
| Pagination.total | number | Total record count (reflects filtered count when using Filter) |
| Pagination.page_size | number | Records per page |
| Pagination.current_page | number | Current page number |
| Pagination.last_page | number | Last page number |
| StatusCode | number | Status code: 200=success, -1=parameter error, 500=exception |
| ErrorMessage | string | Error message, empty on success |
3.3 Pagination Information
Pagination Strategy:
- When current_page < last_page, use Page = current_page + 1 for the next request
- Keep PageSize consistent to avoid missing or duplicating records during traversal
Note: When using the Filter parameter, Pagination.total reflects the filtered record count.
4. Examples
4.1 Basic Example: Get First Page (No Filter)
Request Parameters:
{
"SelectedColumns": ["device_id", "device_name", "online", "battery", "group_name"],
"Page": 1,
"PageSize": 50,
"Filter": {}
}
4.2 Advanced Example: Filter for High Battery Devices
Request Parameters:
{
"SelectedColumns": ["device_id", "device_name", "online", "battery"],
"Page": 1,
"PageSize": 50,
"Filter": {
"online": 1,
"battery": {"gte": 80}
}
}
4.3 Advanced Example: Multi-Condition Combination
Scenario: Filter for online devices with battery below 20%.
Request Parameters:
{
"SelectedColumns": ["device_id", "device_name", "online", "battery", "last_connect_date"],
"Page": 1,
"PageSize": 50,
"Filter": {
"online": 1,
"battery": {"lt": 20}
}
}
4.4 Error Example: Exceeding Maximum Conditions
Request Parameters (error):
{
"Filter": {
"online": 1,
"battery": {"gt": 50},
"cpu_usage": {"lt": 80},
"network_type": 3,
"device_name": {"like": "test"},
"model": "Samsung"
}
}
Note: Filter supports a maximum of 5 conditions; exceeding this returns an error.
Response:
{
"Devices": [],
"Pagination": {},
"StatusCode": -1,
"ErrorMessage": "Filter conditions exceeded (max: 5, got: 6)"
}
5. Error Handling
5.1 Common Errors
| StatusCode | ErrorMessage Example | Cause | Fix |
|---|---|---|---|
| -1 | access_token is invalid. | Credential not configured or token is empty | Configure AirDroid Business OAuth2 Credential in GI node |
| -1 | Invalid page_size, must be between 1 and 50. | PageSize out of range | Change to 1-50 |
| -1 | Nested conditions ($and/$or) are not supported | Unsupported syntax used | List multiple fields directly |
| -1 | Filter conditions exceeded (max: 5, got: X) | Filter conditions exceed 5 | Reduce the number of filter conditions |
| -1 | Filter does not support the following fields: xxx | Unsupported field used in Filter | Check that field names are in the supported list |
| -1 | Field 'xxx' does not support operator 'yyy' | Unsupported field-operator combination | Refer to the field type and operator restriction table |
| 200 | API returned HTTP 401: ... | Token expired/invalid | Refresh token and retry |
| 200 | API returned HTTP 429: ... | Rate limited | Reduce frequency, wait and retry |
| 500 | Request timeout after 60 seconds. | Network or server timeout | Reduce SelectedColumns / add filter / retry later |
5.2 Agent Self-Healing Guide
| Condition | Handling Strategy |
|---|---|
| StatusCode == 200 and ErrorMessage == "" | Success, read Devices and Pagination |
| StatusCode == 200 and ErrorMessage != "" | Business error (includes upstream HTTP errors like 401/429 in ErrorMessage), stop retrying, check filter conditions/permissions |
| StatusCode == -1 | Fix input or Credential and retry |
| StatusCode == 500 | Retry up to 2 times (5-second interval), escalate to manual intervention if persistent |
6. Best Practices
6.1 Performance Optimization
- Always specify SelectedColumns: Recommended ["device_id","device_name","online","battery","group_name"]
- Use Filter wisely: Complex Filter expressions may impact performance
- Keep PageSize stable: Maintain consistency during traversal to reduce duplication/omission risk
6.2 Security Considerations
This action is a read operation, but returned fields may contain sensitive information (e.g., SIM/phone/location fields). It is recommended not to retrieve these by default; add them to SelectedColumns only when business needs require it.
6.3 Idempotency
This is a read operation and is naturally idempotent. However, device status is dynamic, so the same parameters may yield different results on repeated calls.
7. Related Tools
7.1 Prerequisite Tools
| Tool Name | Purpose |
|---|---|
| Get Device Info Push | Refresh device status (if you need the most up-to-date online/battery data) |
7.2 Follow-up Tools
| Tool Name | Purpose |
|---|---|
| Reboot Device | Send reboot command to a device (using device_id) |
| Lock a Device | Lock screen (using device_id) |
| Update a Device Name | Update device name (using device_id) |
| Set Tags | Set tags (using device_id) |
| Move a Device | Move device to a different group (using device_id) |
7.3 Similar Tool Comparison
| Tool Name | Use Case | Difference |
|---|---|---|
| Get All Devices With Filter | Complex condition filtering / comparison operators | Supports Filter with advanced operators |
| Get All Devices | Basic query / simple single-field filtering | Only supports Keyword (one field at a time) |
| Get a Device by Name | Single device lookup | Better suited for querying a single device |
8. Tool Chains
8.1 Batch Reboot Low-Battery Online Devices
Scenario: Reboot all online devices with battery below 20%.
Tool Chain:
Get All Devices With Filter → Reboot Device
Steps:
- Call Get All Devices With Filter:
- Filter={"online": 1, "battery": {"lt": 20}} (multiple fields listed directly, default AND relationship)
- SelectedColumns=["device_id","device_name","battery"]
- Iterate through Devices[] and pass each device_id to Reboot Device's DeviceId parameter
8.2 Filter by Network Type and Set Tags
Scenario: Add a "Stable Network" tag to all devices connected via Wi-Fi or Ethernet.
Tool Chain:
Get All Devices With Filter → Set Tags
Steps:
- Call Get All Devices With Filter:
- Filter={"network_type": {"in": [3, 4]}} (3=Wi-Fi, 4=Ethernet)
- SelectedColumns=["device_id","device_name","network_type"]
- Iterate through Devices[] and call Set Tags for each device
Appendix Reference:
- Field Reference: https://www.goinsight.ai/tools/field-reference/
- Error Code Quick Reference: https://www.goinsight.ai/tools/error-codes/
Leave a Reply.