Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions api-reference/get-device-farm-config.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
title: "Get Device Farm Configuration"
description: "Get the Device Farm configuration for your organization, including whether it's enabled and the default device ARNs."
openapi: get /device-farm/config
---

## Overview

Returns the Device Farm configuration for your organization, including whether Device Farm is enabled and the default device ARNs for Android and iOS.

## Endpoint

```
GET /api/device-farm/config
```

## Authentication

This endpoint requires API key authentication using both headers:

- `autonoma-client-id`: Your API client ID
- `autonoma-client-secret`: Your API client secret

## Response

### Success (200 OK)

```json
{
"enabled": true,
"project_arn": "arn:aws:devicefarm:us-west-2:123456789012:project:abc123...",
"default_android_device_arn": "arn:aws:devicefarm:us-west-2::device:ABC123...",
"default_ios_device_arn": "arn:aws:devicefarm:us-west-2::device:DEF456..."
}
```

### Error Responses

- `401 Unauthorized`: Invalid or missing authentication credentials
- `404 Not Found`: Device Farm is not enabled for this organization

## Response Fields

| Field | Type | Description |
|----------------------------|---------|------------------------------------------------|
| `enabled` | boolean | Whether Device Farm is enabled |
| `project_arn` | string | AWS Device Farm project ARN |
| `default_android_device_arn` | string \| null | Default Android device ARN (if configured) |
| `default_ios_device_arn` | string \| null | Default iOS device ARN (if configured) |

## Examples

### Get Device Farm configuration

```bash
curl -X GET "https://autonoma.app/api/device-farm/config" \
--header "autonoma-client-id: YOUR_CLIENT_ID" \
--header "autonoma-client-secret: YOUR_CLIENT_SECRET"
```

### JavaScript Example

```javascript
const response = await fetch('https://autonoma.app/api/device-farm/config', {
method: 'GET',
headers: {
'autonoma-client-id': 'YOUR_CLIENT_ID',
'autonoma-client-secret': 'YOUR_CLIENT_SECRET'
}
});

if (response.status === 200) {
const config = await response.json();
console.log('Device Farm enabled:', config.enabled);
console.log('Project ARN:', config.project_arn);
console.log('Default iOS device:', config.default_ios_device_arn);
} else if (response.status === 404) {
console.log('Device Farm is not enabled');
}
```

### Python Example

```python
import requests

headers = {
'autonoma-client-id': 'YOUR_CLIENT_ID',
'autonoma-client-secret': 'YOUR_CLIENT_SECRET'
}

response = requests.get(
'https://autonoma.app/api/device-farm/config',
headers=headers
)

if response.status_code == 200:
config = response.json()
print(f"Device Farm enabled: {config['enabled']}")
print(f"Project ARN: {config['project_arn']}")
elif response.status_code == 404:
print("Device Farm is not enabled")
```

## Notes

- Returns `404` if Device Farm is not enabled for your organization
- Default device ARNs may be `null` if not configured
- The project ARN is required for Device Farm operations
- Default device ARNs are used when no specific device is requested in test runs

## Related Endpoints

- `GET /api/device-farm/devices` - List available devices
- `POST /api/test/{test_id}/run` - Run a test (can use Device Farm)
3 changes: 3 additions & 0 deletions api-reference/get-device-farm-configuration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: get /device-farm/config
---
191 changes: 191 additions & 0 deletions api-reference/get-device-farm-devices.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
---
title: "List Device Farm Devices"
description: "Get a list of available physical devices from AWS Device Farm that can be used for test runs."
openapi: get /device-farm/devices
---

## Overview

Returns a list of available physical devices from AWS Device Farm that can be used for test runs. Devices are filtered by platform (Android or iOS).

## Endpoint

```
GET /api/device-farm/devices?platform={platform}
```

## Authentication

This endpoint requires API key authentication using both headers:

- `autonoma-client-id`: Your API client ID
- `autonoma-client-secret`: Your API client secret

## Query Parameters

| Parameter | Type | Required | Description |
|-----------|--------|----------|--------------------------------|
| `platform` | string | Yes | Device platform: `android` or `ios` |

## Response

### Success (200 OK)

```json
{
"devices": [
{
"arn": "arn:aws:devicefarm:us-west-2::device:ABC123...",
"name": "Apple iPhone 16",
"model": "iPhone16,1",
"manufacturer": "Apple",
"platform": "IOS",
"availability": "HIGHLY_AVAILABLE",
"formFactor": "PHONE",
"os": "18.0"
},
{
"arn": "arn:aws:devicefarm:us-west-2::device:DEF456...",
"name": "Apple iPhone 15 Pro",
"model": "iPhone15,2",
"manufacturer": "Apple",
"platform": "IOS",
"availability": "AVAILABLE",
"formFactor": "PHONE",
"os": "17.5"
}
],
"default_device_arn": "arn:aws:devicefarm:us-west-2::device:ABC123...",
"project_arn": "arn:aws:devicefarm:us-west-2:123456789012:project:abc123..."
}
```

### Device Availability Values

- `HIGHLY_AVAILABLE`: Device is readily available
- `AVAILABLE`: Device is available
- `BUSY`: Device is currently in use but can be queued
- `TEMPORARY_NOT_AVAILABLE`: Device is temporarily unavailable

### Error Responses

- `400 Bad Request`: Missing or invalid platform parameter
- `401 Unauthorized`: Invalid or missing authentication credentials
- `404 Not Found`: Device Farm is not enabled or not configured

## Response Fields

| Field | Type | Description |
|--------------------|--------|------------------------------------------------|
| `devices` | array | List of available devices |
| `devices[].arn` | string | Device ARN (use this in test run requests) |
| `devices[].name` | string | Device name |
| `devices[].model` | string \| null | Device model |
| `devices[].manufacturer` | string \| null | Device manufacturer |
| `devices[].platform` | string | Platform: `ANDROID` or `IOS` |
| `devices[].availability` | string \| null | Device availability status |
| `devices[].formFactor` | string \| null | Device form factor (e.g., `PHONE`) |
| `devices[].os` | string \| null | Operating system version |
| `default_device_arn` | string \| null | Organization's default device ARN for this platform |
| `project_arn` | string | AWS Device Farm project ARN |

## Examples

### List iOS Devices

```bash
curl -X GET "https://autonoma.app/api/device-farm/devices?platform=ios" \
--header "autonoma-client-id: YOUR_CLIENT_ID" \
--header "autonoma-client-secret: YOUR_CLIENT_SECRET"
```

### List Android Devices

```bash
curl -X GET "https://autonoma.app/api/device-farm/devices?platform=android" \
--header "autonoma-client-id: YOUR_CLIENT_ID" \
--header "autonoma-client-secret: YOUR_CLIENT_SECRET"
```

### JavaScript Example

```javascript
const response = await fetch('https://autonoma.app/api/device-farm/devices?platform=ios', {
method: 'GET',
headers: {
'autonoma-client-id': 'YOUR_CLIENT_ID',
'autonoma-client-secret': 'YOUR_CLIENT_SECRET'
}
});

if (response.status === 200) {
const data = await response.json();
console.log(`Found ${data.devices.length} iOS devices`);
data.devices.forEach(device => {
console.log(`${device.name} (${device.os}) - ${device.availability}`);
});
console.log('Default device:', data.default_device_arn);
}
```

### Python Example

```python
import requests

headers = {
'autonoma-client-id': 'YOUR_CLIENT_ID',
'autonoma-client-secret': 'YOUR_CLIENT_SECRET'
}

response = requests.get(
'https://autonoma.app/api/device-farm/devices',
params={'platform': 'ios'},
headers=headers
)

if response.status_code == 200:
data = response.json()
print(f"Found {len(data['devices'])} iOS devices")
for device in data['devices']:
print(f"{device['name']} ({device['os']}) - {device['availability']}")
print(f"Default device: {data['default_device_arn']}")
```

## Usage with Test Runs

1. Call this endpoint to get the list of available devices
2. Choose a device ARN from the response
3. Pass the `device_arn` in your test run request:

```bash
# Get available iOS devices
DEVICES=$(curl -s "https://autonoma.app/api/device-farm/devices?platform=ios" \
--header "autonoma-client-id: YOUR_CLIENT_ID" \
--header "autonoma-client-secret: YOUR_CLIENT_SECRET")

# Extract a device ARN (example using jq)
DEVICE_ARN=$(echo $DEVICES | jq -r '.devices[0].arn')

# Run test on that device
curl -X POST "https://autonoma.app/api/test/test_123/run" \
--header "autonoma-client-id: YOUR_CLIENT_ID" \
--header "autonoma-client-secret: YOUR_CLIENT_SECRET" \
--header "Content-Type: application/json" \
-d "{
\"use_physical_device\": true,
\"device_arn\": \"$DEVICE_ARN\"
}"
```

## Notes

- Devices are sorted alphabetically by name
- The `default_device_arn` field shows your organization's default device for the requested platform
- Device availability can change in real-time
- Use the device ARN in test run requests to specify a particular device

## Related Endpoints

- `GET /api/device-farm/config` - Get Device Farm configuration
- `POST /api/test/{test_id}/run` - Run a test (can specify device_arn)
3 changes: 3 additions & 0 deletions api-reference/list-available-devices.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: get /device-farm/devices
---
Loading