Skip to main content

Device Management APIs

The following APIs allow users to check device availability, reserve devices for automation sessions, and retrieve connection details required for Android browser automation using AstroFarm. These operations ensure that devices are properly allocated and ready for testing.

Device Readiness Check

This API verifies whether a device is connected to AstroFarm and available for automation.

API:

GET api/v1/devices/{serial}

Key Response Fields:

  • present - Indicates that the device is connected to AstroFarm

  • ready - Indicates that the device is available for use

Sample response:

{
"device": {
"present": true,
"ready": true,
"serial": "R9ZX8056D5L",
"model": "Samsung Galaxy S21"
}
}

If both present and ready are true, the device can be allocated for automation.

Adding Device Under User Control

This API reserves a device for the current automation session, preventing other users from accessing it during the session.

API: POST api/v1/user/devices

Sample Payload:

{
"serial": "R9ZX8056D5L",
"timeout": 480
}

Sample Response:

{
"description": "Device successfully added to your account",
"status": "success"
}

Once successfully added, the device is locked for your session and cannot be used by other users.

Fetching Remote Connection Details

This API retrieves the endpoints required to connect to the device via ADB or other automation tools.

API: POST api/v1/user/devices/{serial}/remoteConnect

Sample Response:

{
"remoteConnectUrl": "192.168.1.100:5555",
"remoteAutomationUrl": "http://192.168.1.100:4723/wd/hub"
}

Connection Details:

  • remoteConnectUrl – Used to establish an ADB connection

  • remoteAutomationUrl – Used for Appium-based automation (optional)