# Get All Drones Status

This API offers programmatic access to details about drones registered by users in AeroGCS Enterprise, including status and telemetry data. Integrate real-time drone information into your applications

### Authentication&#x20;

To use the API, insert your API key in the Authorization header like this:

```javascript
Authorization: Bearer <YOUR_API_KEY>
```

Replace `<YOUR_API_KEY>` with your AeroGCS API key. Without it, you'll get a 401 Unauthorized error.

### Method

**GET : retrieves the status of all drones.**

### HTTP Request <a href="#http-request-33" id="http-request-33"></a>

&#x20;<https://ags.aeromegh.com/AeroMegh/getDronesStatus>

Headers: `"authorization": "Bearer <API_key>"`

### HTTP Response <a href="#http-response-32" id="http-response-32"></a>

Response codes explanation

| Code | Details                    |
| ---- | -------------------------- |
| 200  | message: "ok"              |
| 400  | request parameters missing |
| 500  | internal server error      |

### Code Snippet

Examples of how you can call this API using curl, Node.js, and Python

{% tabs %}
{% tab title="curl" %}

```json
curl --location 'https://ags.aeromegh.com/AeroMegh/getDronesStatus' \
--header 'Authorization: Bearer <API_KEY>'
```

{% endtab %}

{% tab title="Node" %}

```javascript
//Please install 'axios' module first
//Set your API key before making the request
const axios = require('axios');

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://ags.aeromegh.com/AeroMegh/getDronesStatus',
  headers: { 
    'Authorization': 'Bearer <API_KEY>'
  }
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

```

{% endtab %}

{% tab title="Python" %}

```python
//Please install 'requests' package first
//Set your API key before making the request
import requests

url = "https://ags.aeromegh.com/AeroMegh/getDronesStatus"

payload = {}
headers = {
  'Authorization': 'Bearer <API_KEY>'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Note:** Replace **`<API_KEY>`** with the actual API\_KEY provided by Aeromegh.
{% endhint %}

### API Response

Example of API Response in JSON format.

```json
{
    "drones": [
        {
            "drone_id": "P000010024003B3131510137383337",
            "drone_name": "KAM29032024",
            "userid": "598cc675-8126-4d62-be60-03c8d4b5e62b",
            "project": "ManualProject",
            "plan": "SprayingPlan",
            "last_keep_alive": "2024-05-06T10:37:39.645Z",
            "last_tele_data": "{\"message\":\"Disarming Motors\",\"type\":\"INFO\"}",
            "total_flight_time": {
                "hours": 4,
                "minutes": 50,
                "seconds": 56,
                "milliseconds": 744
            },
            "last_flight_log": null,
            "flight_id": "f45c2575-c5f4-4323-baf3-7e719e3c8059",
            "stream_key": "",
            "registered_date": "2024-03-29T06:46:45.691Z",
            "lease_drone": false,
            "drone_rent": "0",
            "dsp_drone_id": null,
            "uin": "dfgdfgfg",
            "id": "ba3c252a-e624-4850-9cf7-6845ba9af631",
            "model": null,
            "serial_no": null,
            "fcsno": "1234",
            "rcsno": "MK15",
            "board_type": null,
            "green_build_number": null,
            "device_ram": null,
            "android_version": null,
            "device_model_name": null,
            "firmware_version": null,
            "license_type": null,
            "topic": "rbxx6tw60sjf24snu3zot97t31s5rt2gnec2qcwtkk3yw06j91jrwa563116ai07",
            "status": "{\"type\":\"INFO\",\"message\":\"Flight moving safely\",\"timestamp\":1715325835.472}",
            "online": false,
            "flightID": "f45c2575-c5f4-4323-baf3-7e719e3c8059",
            "teleData": {
                "message": "Disarming Motors",
                "type": "INFO"
            }
        },
        {
            "drone_id": "P00001DESKTOP-QFR1AP5",
            "drone_name": "Abhishek",
            "userid": "598cc675-8126-4d62-be60-03c8d4b5e62b",
            "project": "ManualProject",
            "plan": "SprayingPlan",
            "last_keep_alive": "2024-04-27T07:02:06.951Z",
            "last_tele_data": "{\"message\":\"Disarming Motors\",\"type\":\"INFO\"}",
            "total_flight_time": {
                "seconds": 8,
                "milliseconds": 80
            },
            "last_flight_log": null,
            "flight_id": "a043e414-664a-4369-8201-8bc5e3886195",
            "stream_key": "",
            "registered_date": "2024-04-26T09:58:09.562Z",
            "lease_drone": false,
            "drone_rent": "0",
            "dsp_drone_id": null,
            "uin": "fyuiighj",
            "id": "7efc6dcf-93ad-44ce-8fa0-8d0a85c50e89",
            "model": null,
            "serial_no": null,
            "fcsno": "",
            "rcsno": "",
            "board_type": null,
            "green_build_number": "102.257.20240419.01",
            "device_ram": "5.73 GB",
            "android_version": "Android 14",
            "device_model_name": "Realme RMX3710",
            "firmware_version": "ArduCopter V4.5.1 (913ec4b2)",
            "license_type": "15 Days Trial",
            "topic": "cbglr44gomuslhdslyyrklvopwigwew0059c0pbln5evwt7mu5hz8rlh4zui5ewd",
            "status": "{\"type\":\"INFO\",\"message\":\"Flight moving safely\",\"timestamp\":1715325835.472}",
            "online": false,
            "flightID": "a043e414-664a-4369-8201-8bc5e3886195",
            "teleData": {
                "message": "Disarming Motors",
                "type": "INFO"
            }
        },
        {
            "drone_id": "P00001004C00333032511433383839",
            "drone_name": "mo-hit",
            "userid": "598cc675-8126-4d62-be60-03c8d4b5e62b",
            "project": "2",
            "plan": "2",
            "last_keep_alive": "2024-04-15T12:31:55.537Z",
            "last_tele_data": "{\"message\":\"Disarming Motors\",\"type\":\"INFO\"}",
            "total_flight_time": {
                "minutes": 12,
                "seconds": 42,
                "milliseconds": 55
            },
            "last_flight_log": null,
            "flight_id": "6ba9d881-2552-4cbe-9017-592b1d7305e2",
            "stream_key": "",
            "registered_date": "2024-04-15T12:08:00.734Z",
            "lease_drone": false,
            "drone_rent": "0",
            "dsp_drone_id": null,
            "uin": ".......",
            "id": "ab406ac3-4253-45c0-94e3-b1318b7d0cdb",
            "model": null,
            "serial_no": null,
            "fcsno": "",
            "rcsno": "",
            "board_type": "CubeOrangePlus",
            "green_build_number": "101.221.20240405.01",
            "device_ram": "11.22 GB",
            "android_version": "Android 14",
            "device_model_name": "OnePlus CPH2415",
            "firmware_version": "ArduCopter V4.4.4",
            "license_type": "OEM",
            "topic": "67b6sqxemr1m6bqtcd4o49r95uz7egpkp347w9hg43cfndfp6n4k005j6w4vaggt",
            "status": "{\"type\":\"INFO\",\"message\":\"Flight moving safely\",\"timestamp\":1715325835.472}",
            "online": false,
            "flightID": "6ba9d881-2552-4cbe-9017-592b1d7305e2",
            "teleData": {
                "message": "Disarming Motors",
                "type": "INFO"
            }
        }
    ]
}
```

### API Response Parameter&#x20;

The following table outlines the parameters included in the API response for each drone:

<table data-full-width="true"><thead><tr><th>Parameter</th><th>Description</th><th>Sub-Parameters</th></tr></thead><tbody><tr><td><strong>drone_id</strong></td><td>Unique identifier for the drone.</td><td>-</td></tr><tr><td><strong>drone_name</strong></td><td>Name assigned to the drone.</td><td>-</td></tr><tr><td><strong>userid</strong></td><td>Unique identifier for the user associated with the drone.</td><td>-</td></tr><tr><td><strong>project</strong></td><td>Project the drone is assigned to.</td><td>-</td></tr><tr><td><strong>plan</strong></td><td>Plan associated with the drone.</td><td>-</td></tr><tr><td><strong>last_keep_alive</strong></td><td>Timestamp indicating the last time the drone communicated its status.</td><td>-</td></tr><tr><td><strong>last_tele_data</strong></td><td>Information about the last telemetry data received from the drone, including a message and its type.</td><td><p>- <strong>message</strong>: Message received from the drone. </p><p>- <strong>type</strong>: Type of telemetry data (e.g., INFO).</p></td></tr><tr><td><strong>total_flight_time</strong></td><td>Total duration of flight recorded in hours, minutes, seconds, and milliseconds.</td><td><p>- <strong>hours</strong>: Total hours of flight. </p><p>- <strong>minutes</strong>: Total minutes of flight. </p><p>- <strong>seconds</strong>: Total seconds of flight. </p><p>- <strong>milliseconds</strong>: Total milliseconds of flight.</p></td></tr><tr><td><strong>last_flight_log</strong></td><td>Timestamp of the last recorded flight log.</td><td>-</td></tr><tr><td><strong>flight_id</strong></td><td>Unique identifier for the flight.</td><td>-</td></tr><tr><td><strong>stream_key</strong></td><td>Key for streaming data.</td><td>-</td></tr><tr><td><strong>registered_date</strong></td><td>Timestamp indicating the date and time when the drone was registered.</td><td>-</td></tr><tr><td><strong>lease_drone</strong></td><td>Indicates whether the drone is leased.</td><td>-</td></tr><tr><td><strong>drone_rent</strong></td><td>Rental fee for the drone.</td><td>-</td></tr><tr><td><strong>dsp_drone_id</strong></td><td>Identifier for the drone in the Digital Sky Platform.</td><td>-</td></tr><tr><td><strong>uin</strong></td><td>Unique Identification Number associated with the drone.</td><td>-</td></tr><tr><td><strong>model</strong></td><td>Model of the drone.</td><td>-</td></tr><tr><td><strong>serial_no</strong></td><td>Serial number of the drone.</td><td>-</td></tr><tr><td><strong>fcsno</strong></td><td>Flight Control System number.</td><td>-</td></tr><tr><td><strong>rcsno</strong></td><td>Remote Control System number.</td><td>-</td></tr><tr><td><strong>board_type</strong></td><td>Type of board used in the drone.</td><td>-</td></tr><tr><td><strong>green_build_number</strong></td><td>Build number for the green firmware.</td><td>-</td></tr><tr><td><strong>device_ram</strong></td><td>Amount of RAM available on the device.</td><td>-</td></tr><tr><td><strong>android_version</strong></td><td>Version of the Android operating system.</td><td>-</td></tr><tr><td><strong>device_model_name</strong></td><td>Name of the device model.</td><td>-</td></tr><tr><td><strong>firmware_version</strong></td><td>Version of the firmware installed on the drone.</td><td>-</td></tr><tr><td><strong>license_type</strong></td><td>Type of license associated with the drone.</td><td>-</td></tr><tr><td><strong>topic</strong></td><td>Topic associated with the drone.</td><td>-</td></tr><tr><td><strong>status</strong></td><td>Current status of the drone, including a message, type, and timestamp.</td><td><p>- <strong>message</strong>: Current status message (e.g., "Flight moving safely"). </p><p>- <strong>type</strong>: Type of status message (e.g., INFO). </p><p>- <strong>timestamp</strong>: Timestamp of the status message.</p></td></tr><tr><td><strong>online</strong></td><td>Indicates whether the drone is online.</td><td>-</td></tr><tr><td><strong>flightID</strong></td><td>Unique identifier for the flight (alternative field).</td><td>-</td></tr><tr><td><strong>teleData</strong></td><td>Information about telemetry data received from the drone, including a message and its type (alternative field).</td><td><p>- <strong>message</strong>: Message received from the drone. </p><p>- <strong>type</strong>: Type of telemetry data (e.g., INFO).</p></td></tr></tbody></table>
