# Get All Drones

This API provides programmatic access to information about registered and unregistered assigned drones.&#x20;

### 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**: **Retrieve GCS-Enabled Drones**

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

<mark style="color:blue;">`https://ags.aeromegh.com/Aeromegh/GCSDrones`</mark>

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

Response Codes Explanation:

| Code | Details                     | Message                      |
| ---- | --------------------------- | ---------------------------- |
| 200  | The request was successful. | "OK"                         |
| 400  | Request parameters missing. | "Request parameters missing" |
| 500  | Internal server error.      | "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/GCSDrones' \
--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/GCSDrones',
  headers: { 
    'Authorization': '<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/GCSDrones"

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 AeroGCS.
{% endhint %}

### &#x20;API Response

Example of API Response in JSON format.

```json
        {
          "drones": [
              {
                  "drone_id": "P00001DESKTOP-4R4A4U6E",
                  "drone_name": "DroneD",
                  "userid": "edb1bf33-0a01-4362-8474-e54e97873391",
                  "project": null,
                  "plan": null,
                  "last_keep_alive": null,
                  "last_tele_data": null,
                  "total_flight_time": {
                      "minutes": 41,
                      "seconds": 24,
                      "milliseconds": 181
                  },
                  "last_flight_log": null,
                  "flight_id": null,
                  "stream_key": null,
                  "registered_date": "2023-08-24T13:36:35.451Z",
                  "lease_drone": false,
                  "drone_rent": "0",
                  "dsp_drone_id": null,
                  "uin": null,
                  "id": "edf7cf95-9a09-44b4-b887-cdd3039f91b9"
              },
              {
                  "drone_id": "P00001DESKTOP-A7J4QKQ",
                  "drone_name": "drone29",
                  "userid": "edb1bf33-0a01-4362-8474-e54e97873391",
                  "project": null,
                  "plan": null,
                  "last_keep_alive": null,
                  "last_tele_data": null,
                  "total_flight_time": {},
                  "last_flight_log": null,
                  "flight_id": null,
                  "stream_key": null,
                  "registered_date": "2023-08-29T11:24:22.275Z",
                  "lease_drone": false,
                  "drone_rent": "0",
                  "dsp_drone_id": null,
                  "uin": null,
                  "id": "03063e58-a012-4a91-9b0f-bc2aedc9bf06"
              }
          ],
          "unregisteredAssignedDrones": []
      }
```

### API Response Parameter

The API response contains details about both registered and unregistered assigned drones. Parameters include:

| Parameter                      | Description                                                                                          | Subparameters                                                                                                                                                                                                                                         |
| ------------------------------ | ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **drones**                     | An array containing information about registered drones in the system.                               | -                                                                                                                                                                                                                                                     |
| **drone\_id**                  | Unique identifier for the drone.                                                                     | -                                                                                                                                                                                                                                                     |
| **drone\_name**                | Name assigned to the drone.                                                                          | -                                                                                                                                                                                                                                                     |
| **userid**                     | Unique identifier for the user associated with the drone.                                            | -                                                                                                                                                                                                                                                     |
| **project**                    | Project associated with the drone.                                                                   | -                                                                                                                                                                                                                                                     |
| **plan**                       | Plan associated with the drone.                                                                      | -                                                                                                                                                                                                                                                     |
| **last\_keep\_alive**          | Timestamp indicating the last time the drone communicated its status.                                | -                                                                                                                                                                                                                                                     |
| **last\_tele\_data**           | Information about the last telemetry data received from the drone, including a message and its type. | <p>- <strong>message</strong>: Message received from the drone.</p><p> - <strong>type</strong>: Type of telemetry data (e.g., INFO).</p>                                                                                                              |
| **total\_flight\_time**        | Total duration of flight recorded in minutes, seconds, and milliseconds.                             | <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> |
| **last\_flight\_log**          | Timestamp of the last recorded flight log.                                                           | -                                                                                                                                                                                                                                                     |
| **flight\_id**                 | Unique identifier for the flight.                                                                    | -                                                                                                                                                                                                                                                     |
| **stream\_key**                | Key for streaming data.                                                                              | -                                                                                                                                                                                                                                                     |
| **registered\_date**           | Timestamp indicating the date and time when the drone was registered.                                | -                                                                                                                                                                                                                                                     |
| **lease\_drone**               | Indicates whether the drone is leased.                                                               | -                                                                                                                                                                                                                                                     |
| **drone\_rent**                | Rental fee for the drone.                                                                            | -                                                                                                                                                                                                                                                     |
| **dsp\_drone\_id**             | Identifier for the drone in the Digital Sky Platform.                                                | -                                                                                                                                                                                                                                                     |
| **uin**                        | Unique Identification Number associated with the drone.                                              | -                                                                                                                                                                                                                                                     |
| **id**                         | Unique identifier for the drone registration.                                                        | -                                                                                                                                                                                                                                                     |
| **unregisteredAssignedDrones** | An array containing information about unregistered assigned drones.                                  | -                                                                                                                                                                                                                                                     |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://aerogcs-api-docs.aeromegh.com/aerogcs-enterprise-apis/get-all-drones.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
