# AeroGCS Enterprise APIs

We are empowering seamless drone data integration and analysis with AeroGCS Enterprise or custom dashboards.

## **Introduction**

Welcome to the AeroGCS Enterprise API documentation! This guide helps developers integrate AeroGCS Enterprise API into their applications.

### **Key Features:**

* **Comprehensive API Reference:** Detailed descriptions of each API endpoint, including authentication, request parameters, and response formats.
* **Multilingual Code Examples:** Code snippets in Shell, Python, and JavaScript, located next to each API description for easy access.
* **Language Flexibility:** Switch between programming languages using tabs in the top right corner of the documentation.

#### **Beyond AeroGCS Enterprise APIs:**

This documentation can also assist with other cloud APIs, enhancing its value for your projects.

Harness the power of AeroGCS Enterprise API with clear explanations and multilingual support to streamline your drone management and data integration..


# Get All Drones

This API is used to retrieve all registered and unregistered 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.                                  | -                                                                                                                                                                                                                                                     |


# Get All Drones Status

This API is called to query all the registered drones of the user and retrieve their latest 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>


# Get All Flights

This API is used to retrieve all flight logs

This API provides programmatic access to details about all flights within AeroGCS Enterprise. Retrieve comprehensive information for each flight, such as start and end times, drone ID, status, area covered, distance covered, and more. Integrate detailed flight data seamlessly 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: retrieve all the flight**

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

[https://ags.aeromegh.com/Aeromegh/remoteMission/AllFlightsLogs/{start}/{end}/{page}/{pageSize}?type={type}](<https://ags.aeromegh.com/Aeromegh/remoteMission/AllFlightsLogs/{start}/{end}/{page}/{pageSize}?type={type}&#xD;&#xA;>)

### URL Parameters  <a href="#http-response-32" id="http-response-32"></a>

URL parameters are

| Key                    | Description                         |
| ---------------------- | ----------------------------------- |
| searchString :         | search by drone\_id                 |
| startDate / fromDate : | get data between fromdate to todate |
| startIndex (offset)    | fetch records from offsets          |
| pageSize (limit)       | fetch limited records               |

{% hint style="info" %}
**Note:** To retrieve all records, set both the **startIndex** and **pageSize** values to '0' (zero).
{% endhint %}

{% hint style="info" %}
**Note:** Convert human-readable date/time to Unix timestamp for using epoch time in the URL start time parameter, ensuring API compatibility.
{% endhint %}

### 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/remoteMission/AllFlightsLogs/${droneId}/${fromDate}/${toDate}/${startIndex}/${pageSize}?type=${type}' \
--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/remoteMission/AllFlightsLogs/%20/1000000000/1692602986154/0/8?type=null',
  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/remoteMission/AllFlightsLogs/%20/1000000000/1692602986154/0/8?type=null"

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 %}

### &#x20;API Response

Example of API Response in JSON format.

```json
{
    "logs": [
        {
            "id": "02abe77f-75e5-4e6d-9f8d-ec09e6a1f481",
            "project_name": "ManualProject",
            "plan_name": "SprayingPlan",
            "user_id": "598cc675-8126-4d62-be60-03c8d4b5e62b",
            "start_time": "2024-05-06T13:12:11.000Z",
            "end_time": "2024-05-06T13:13:14.000Z",
            "drone_id": "P00001003A00433032511533383839",
            "streamkey": "apig87b47le",
            "stream_uploaded": true,
            "title": null,
            "stream_viewer_minutes": "0",
            "status": "ended",
            "last_activity": "2024-05-06T13:13:14.000Z",
            "area_covered": "0",
            "distance_covered": "66",
            "customer_id": null,
            "size": "0",
            "stream_base_id": null,
            "area_calculation_method": "spraying",
            "firmware_version_number": "ArduCopter V4.4.4 Secured",
            "green_build_number": "104.301.20240504.02",
            "drone_name": null,
            "uin": null
        },
        {
            "id": "c8f46700-248f-4d82-88ad-6ad9dc8780f7",
            "project_name": "ManualProject",
            "plan_name": "SprayingPlan",
            "user_id": "598cc675-8126-4d62-be60-03c8d4b5e62b",
            "start_time": "2024-05-04T06:32:27.008Z",
            "end_time": "2024-05-04T06:35:37.449Z",
            "drone_id": "P000010024003B3131510137383337",
            "streamkey": "apirxflz7xd",
            "stream_uploaded": true,
            "title": null,
            "stream_viewer_minutes": "0",
            "status": "ended",
            "last_activity": "2024-05-04T06:35:35.294Z",
            "area_covered": "9978",
            "distance_covered": "444",
            "customer_id": null,
            "size": "16.154824256896973",
            "stream_base_id": "9fb7b0b0-1a6e-4fbf-aaed-a74c9f4c53dd",
            "area_calculation_method": "plot",
            "firmware_version_number": "ArduCopter V4.4.4 Secured",
            "green_build_number": "104.298.20240503.01",
            "drone_name": "KAM29032024",
            "uin": "145897"
        }
    ],
    "count": "2"
}
```

### API Response Parameter&#x20;

The following table outlines the parameters included in the API response for retrieving all flight logs

| Parameter                     | Description                                                                                          |
| ----------------------------- | ---------------------------------------------------------------------------------------------------- |
| **logs**                      | An array containing log entries for drone operations.                                                |
| **id**                        | Unique identifier for each log entry.                                                                |
| **project\_name**             | The name of the project associated with the log entry.                                               |
| **plan\_name**                | The name of the plan associated with the log entry.                                                  |
| **user\_id**                  | The unique identifier of the user who initiated the drone operation.                                 |
| **start\_time**               | The timestamp indicating the start time of the drone operation.                                      |
| **end\_time**                 | The timestamp indicating the end time of the drone operation.                                        |
| **drone\_id**                 | The unique identifier of the drone involved in the operation.                                        |
| **streamkey**                 | The stream key associated with the drone operation.                                                  |
| **stream\_uploaded**          | A boolean value indicating whether the stream was uploaded successfully.                             |
| **title**                     | The title of the log entry.                                                                          |
| **stream\_viewer\_minutes**   | The duration, in minutes, for which the stream was viewed.                                           |
| **status**                    | The status of the drone operation (e.g., "ended", "ongoing").                                        |
| **last\_activity**            | The timestamp indicating the time of the last activity in the drone operation.                       |
| **area\_covered**             | The area covered, in square units, during the drone operation.                                       |
| **distance\_covered**         | The distance covered, in units, during the drone operation.                                          |
| **customer\_id**              | The unique identifier of the customer associated with the drone operation.                           |
| **size**                      | The size, in units, associated with the drone operation.                                             |
| **stream\_base\_id**          | The base identifier of the stream associated with the drone operation.                               |
| **area\_calculation\_method** | The method used to calculate the area covered during the drone operation (e.g., "spraying", "plot"). |
| **firmware\_version\_number** | The version number of the drone's firmware used during the operation.                                |
| **green\_build\_number**      | The build number of the green (secure) firmware version used during the operation.                   |
| **drone\_name**               | The name of the drone involved in the operation.                                                     |
| **uin**                       | The unique identifier number associated with the drone.                                              |
| **count**                     | The total count of log entries returned in the response.                                             |


# Get Flight Logs

API is a service that allows users to retrieve historical flight logs recorded by a drone during its missions. These logs typically contain detailed information about the drone's flight.

This API provides programmatic access to detailed drone operation information, including telemetry data and flight statuses. Integrate with this API to efficiently retrieve logs for analysis, monitoring, and reporting.

### 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 : get flight log**

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

[<mark style="color:blue;">https://ags.aeromegh.com/AeroMegh/AeroStack/flightLogs/${pageSize}/${offset}?flightID=${flightid}\&keys=${keys}</mark>](https://ags.aeromegh.com/AeroMegh/AeroStack/flightLogs/${pageSize}/${pageNumber}?flightID=${flightid}\&keys=${keys}\&limit=${limit}\&pagination=${pagination}")

### Query Parameters

Query Parameters are

| Key        | Description                                    |
| ---------- | ---------------------------------------------- |
| Flight\_ID | take id from get flights API response          |
| keys       | AS\_FLIGHT\_LOG/AS\_TELE\_DATA/AS\_KEEP\_ALIVE |

### URL Parameters <a href="#http-response-32" id="http-response-32"></a>

URL parameters are

| Key        | Description              |
| ---------- | ------------------------ |
| pageSize : | 20 records on each page  |
| offset :   | page size \* page number |

### 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" %}

```javascript
  curl --location 'https://ags.aeromegh.com/AeroMegh/AeroStack/flightLogs/${pageSize}/${pageNumber}?flightID=${flightid}&keys=${keys} ' \
--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/AeroStack/flightLogs/0/8?keys=AS_TELE_DATA&flightID=902252eb-f926-47a3-8996-becb7e6d0144',
  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/AeroStack/flightLogs/0/8?keys=AS_TELE_DATA&flightID=902252eb-f926-47a3-8996-becb7e6d0144"

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 %}

{% hint style="success" %}
**Usage Note** : To specify the type of data you wish to retrieve from the API, set the key accordingly:

* For accessing flight logs, use the key AS\_FLIGHT\_LOG.
* To retrieve telemetry data, set the key as AS\_TELE\_DATA.
* For obtaining keep-alive signals, utilize the key AS\_KEEP\_ALIVE.

Remember, you can only set one key at a time to specify the type of data you want to receive. Choose between AS\_FLIGHT\_LOG, AS\_TELE\_DATA, or AS\_KEEP\_ALIVE based on your requirements.
{% endhint %}

### API Response

Example of API Response in JSON format.

```json
            
              {
                "logs": [
                    {
                        "id": "c50087e9-11b7-48dd-b3f2-f6627abd24f4",
                        "key": "AS_TELE_DATA",
                        "droneid": "P00001DESKTOP-E762V7V",
                        "timestamp": "2023-08-19T12:16:08.000Z",
                        "aerostackid": "21baf594-0400-4afa-a214-dff78990751e",
                        "data": "{\"alt\":\"0.0\",\"bat\":\"12.587\",\"dir\":\"178.00\",\"lat\":\"-35.3638563\",\"lon\":\"149.1655674\",\"mod\":\"4\",\"pit\":\"-0.1300536986872789\",\"rol\":\"-0.6019573781579175\",\"sat\":\"10\",\"vel\":\"0.01667754352092743\",\"yaw\":\"178.28035462124387\",\"timestamp\":\"1692447368\",\"liquidConsumed\":\"00\",\"remainingLiquidPercentage\":\"0\",\"sprayedArea\":\"0.0000\",\"sprayedDistance\":\"0.000\",\"sprayPumpRate\":\"10\",\"flowRate\":\"0\",\"liveObstacleDistance\":\"0\"}",
                        "flight_id": "923dbb64-39e5-4751-88ad-4ef3496f4afa",
                        "totalCount": {
                            "count": "1584"
                        }
                    },
                    {
                        "id": "6ec20f32-b516-4edd-890e-d32011a8dea5",
                        "key": "AS_TELE_DATA",
                        "droneid": "P00001DESKTOP-E762V7V",
                        "timestamp": "2023-08-19T12:16:08.000Z",
                        "aerostackid": "21baf594-0400-4afa-a214-dff78990751e",
                        "data": "{\"alt\":\"0.0\",\"bat\":\"12.587\",\"dir\":\"178.00\",\"lat\":\"-35.3638563\",\"lon\":\"149.1655674\",\"mod\":\"4\",\"pit\":\"-0.1300536986872789\",\"rol\":\"-0.6019573781579175\",\"sat\":\"10\",\"vel\":\"0.016485927626490593\",\"yaw\":\"178.28035462124387\",\"timestamp\":\"1692447368\",\"liquidConsumed\":\"00\",\"remainingLiquidPercentage\":\"0\",\"sprayedArea\":\"0.0000\",\"sprayedDistance\":\"0.000\",\"sprayPumpRate\":\"10\",\"flowRate\":\"0\",\"liveObstacleDistance\":\"0\"}",
                        "flight_id": "923dbb64-39e5-4751-88ad-4ef3496f4afa"
                    },
                    {
                        "id": "a3fb8377-da26-4fc4-94b2-9e78a69a08de",
                        "key": "AS_TELE_DATA",
                        "droneid": "P00001DESKTOP-E762V7V",
                        "timestamp": "2023-08-19T12:16:08.000Z",
                        "aerostackid": "21baf594-0400-4afa-a214-dff78990751e",
                        "data": "{\"alt\":\"0.0\",\"bat\":\"12.587\",\"dir\":\"178.00\",\"lat\":\"-35.3638563\",\"lon\":\"149.1655674\",\"mod\":\"4\",\"pit\":\"-0.1300536986872789\",\"rol\":\"-0.6019573781579175\",\"sat\":\"10\",\"vel\":\"0.016485927626490593\",\"yaw\":\"178.28035462124387\",\"timestamp\":\"1692447368\",\"liquidConsumed\":\"00\",\"remainingLiquidPercentage\":\"0\",\"sprayedArea\":\"0.0000\",\"sprayedDistance\":\"0.000\",\"sprayPumpRate\":\"10\",\"flowRate\":\"0\",\"liveObstacleDistance\":\"0\"}",
                        "flight_id": "923dbb64-39e5-4751-88ad-4ef3496f4afa"
                    }
                ]
            }
```

### API Response Parameter&#x20;

The following parameters are included in the API response for Flight logs

* **id :** Unique identifier for the log
* **key :** Key used to identify if the log entry contains telemetry data or flight data.
* **droneid** : Unique identifier for the drone associated with this log entry
* **timestamp :** Timestamp indicating the time when the telemetry data was recorded.
* **aerostackid :** Identifier associated with an Aerostack system or component.
* **data :** The actual drone data or information captured by the log entry.
  * **Parameters and Units of Measurement**

    The table below outlines the parameters included in the data along with their respective units of measurement:

<table><thead><tr><th>Parameter</th><th>Unit Of Measurement</th><th data-hidden></th></tr></thead><tbody><tr><td>alt</td><td>m (meter)</td><td></td></tr><tr><td>bat</td><td>v (volt)</td><td></td></tr><tr><td>dir</td><td>° (degrees)</td><td></td></tr><tr><td>lat</td><td>° (degrees)</td><td></td></tr><tr><td>lon</td><td>° (degrees)</td><td></td></tr><tr><td>mod</td><td><p>Return as numerical values, where the number represents </p><ol><li>Acro</li><li>Airmode</li><li>Alt Hold</li><li>Auto</li><li>AutoTune</li><li>Brake</li><li>Circle</li><li>Drift</li><li>Flip</li><li>FlowHold</li><li>Follow</li><li>Guided</li><li>Heli_Autorotate</li><li>Land</li><li>Loiter</li><li>PosHold</li><li>RTL</li><li>SmartRTL</li><li>Sport</li><li>Stabilize</li><li>SysID</li><li>Throw</li><li>Turtle</li><li>ZigZag</li></ol></td><td></td></tr><tr><td>pit</td><td>° (degrees)</td><td></td></tr><tr><td>rol</td><td>° (degrees)</td><td></td></tr><tr><td>sat</td><td>satellite count in number</td><td></td></tr><tr><td>vel</td><td>m/s (meter per second)</td><td></td></tr><tr><td>yaw</td><td>° (degrees)</td><td></td></tr><tr><td>timestamp</td><td>ms (milliseconds)</td><td></td></tr><tr><td>liquidConsumed</td><td>ml (milliliter)</td><td></td></tr><tr><td>remainingLiquidPercentage</td><td>% ( percentage)</td><td></td></tr><tr><td>sprayedArea</td><td>m² ( square meter)</td><td></td></tr><tr><td>sprayedDistance</td><td>m ( meter)</td><td></td></tr><tr><td>sprayPumpRate</td><td>% ( percentage)</td><td></td></tr><tr><td>flowRate</td><td>L/min ( liter per minute)</td><td></td></tr><tr><td>liveObstacleDistance</td><td>cm (centimeter)</td><td></td></tr></tbody></table>

* **flight\_id :** Identifier for a specific flight associated with this log entry.


# Get All Projects

This API is used to retrieve user projects.

This API provides programmatic access to project information from the AeroGCS Enterprise system. Authenticate with API keys and send a GET request to obtain project IDs, names, creation dates, and more. Integrate for efficient project management.

### 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 : get all the projects**

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

[<mark style="color:blue;">`https://ags.aeromegh.com/AeroMegh/AeroCapture/projects/:searchString/:startIndex/:pageSize`</mark>](https://ags.aeromegh.com/AeroMegh/AeroCapture/projects/:searchString/:startIndex/:pageSize)

### URL Parameters

URL parameters are:

searchString : the search string provided by the user.

pageSize : the number of projects to display on the page.

startIndex : the starting point for the project results.

| Key            | Description             |
| -------------- | ----------------------- |
| searchString : | search project          |
| startIndex :   | get record start offset |
| pageSize :     | records on each page    |

### 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/:searchString/:startIndex/:pageSize' \
--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/AeroCapture/projects/12/20/50/eb4d317f-6703-44ea-83e7-5c654b1df06a',
  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/AeroCapture/projects/12/20/50/eb4d317f-6703-44ea-83e7-5c654b1df06a"

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
{
    "projects": [
        {
            "id": "79bd643d-fd32-4fa4-ab27-14d0330d012e",
            "project_name": "13maysapkal",
            "plan_name": null,
            "created_date": "2024-05-13T07:45:17.852Z",
            "user_id": "598cc675-8126-4d62-be60-03c8d4b5e62b",
            "location_name": null,
            "location_latlng": null,
            "service": "AeroGCS Enterprise",
            "pilot_id": "st=2024-05-11T22%3A28%3A53Z&se=2025-05-13T07%3A48%3A53Z&sp=racwdl&sv=2018-03-28&sr=c&sig=ObOvuoi%2BvhAwoEls52xzM0fTgyWihK53pa%2Fyeom0aEo%3D",
            "thumb": "https://pdrlimage.blob.core.windows.net/user-598cc675-8126-4d62-be60-03c8d4b5e62b/AeroGCSWorkspace/13maysapkal/plan1/Assets/planMap.png",
            "plan_count": "2",
            "tasks": "0",
            "images": 0
        },
        {
            "id": "555679a3-9b91-47ae-a172-5b78c3a79aeb",
            "project_name": "A1",
            "plan_name": null,
            "created_date": "2024-05-06T13:28:57.623Z",
            "user_id": "598cc675-8126-4d62-be60-03c8d4b5e62b",
            "location_name": null,
            "location_latlng": null,
            "service": "AeroGCS Enterprise",
            "pilot_id": "st=2024-05-11T22%3A28%3A53Z&se=2025-05-13T07%3A48%3A53Z&sp=racwdl&sv=2018-03-28&sr=c&sig=ObOvuoi%2BvhAwoEls52xzM0fTgyWihK53pa%2Fyeom0aEo%3D",
            "plan_count": "0",
            "tasks": "0",
            "images": 0
        },
        {
            "id": "c3d8e280-dee1-49a6-92c8-c78283a49e79",
            "project_name": "proi1",
            "plan_name": null,
            "created_date": "2024-04-02T11:08:54.900Z",
            "user_id": "598cc675-8126-4d62-be60-03c8d4b5e62b",
            "location_name": null,
            "location_latlng": null,
            "service": "AeroGCS Enterprise",
            "pilot_id": "st=2024-05-11T22%3A28%3A53Z&se=2025-05-13T07%3A48%3A53Z&sp=racwdl&sv=2018-03-28&sr=c&sig=ObOvuoi%2BvhAwoEls52xzM0fTgyWihK53pa%2Fyeom0aEo%3D",
            "thumb": "https://pdrlimage.blob.core.windows.net/user-598cc675-8126-4d62-be60-03c8d4b5e62b/AeroGCSWorkspace/proi1/plan1/Assets/planMap.png",
            "plan_count": "1",
            "tasks": "0",
            "images": 0
        }
    ],
    "count": "3"
}
```

### API Response Parameter&#x20;

The following parameters are included in the API response :

| Parameter            | Description                                                                                             |
| -------------------- | ------------------------------------------------------------------------------------------------------- |
| **projects**         | An array containing information about each project.                                                     |
| **count**            | Total count of projects returned in the response.                                                       |
| **id**               | Unique identifier for the project.                                                                      |
| **project\_name**    | Name of the project.                                                                                    |
| **plan\_name**       | Name of the plan associated with the project. (null if not available)                                   |
| **created\_date**    | Date and time when the project was created.                                                             |
| **user\_id**         | Unique identifier for the user who created the project.                                                 |
| **location\_name**   | Name of the location associated with the project. (null if not available)                               |
| **location\_latlng** | Latitude and longitude coordinates of the location associated with the project. (null if not available) |
| **service**          | Service type associated with the project.                                                               |
| **pilot\_id**        | Unique identifier for the pilot associated with the project.                                            |
| **thumb**            | URL pointing to the thumbnail image of the project.                                                     |
| **plan\_count**      | Total count of plans associated with the project.                                                       |
| **tasks**            | Total count of tasks associated with the project. (null if not available)                               |
| **images**           | Total count of images associated with the project. (null if not available)                              |

Each "projects" object in the response array contains these subparameters, providing detailed information about each project.


# Get Plans

The above API provides list of plans by project name with details. you can search plans by plan name or paginate plan list through this API.

This API provides programmatic access to detailed plan information for projects. Authenticate with an API key in the Authorization header. Retrieve plan IDs, project names, creation dates, and more. Integrate to streamline plan management.

### 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 : get all the plans**

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

[https://ags.aeromegh.com/AeroMegh/AeroCapture/plans/\<projectId>/\<projectName>/\<searchString>/\<startIndex>/\<pageSize>](https://ags.aeromegh.com/AeroMegh/AeroCapture/plans/<projectId>/<projectName>/<searchString>/<startIndex>/<pageSize>)

### URL Parameters

URL parameters are

| Key            | Description                                     |
| -------------- | ----------------------------------------------- |
| project Name : | project name to fetch plans under this projects |
| project Id     | project id to fetch plans under this projects   |
| searchString : | search by planname                              |
| startIndex :   | get records start offset                        |
| pageSize :     | records on each page                            |

### HTTP Response Code

Response codes explanation:

| Code | Details                    |
| ---- | -------------------------- |
| 200  | message: "ok"              |
| 204  | No content                 |
| 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/AeroCapture/plans/<projectName>/<searchString>/<startIndex>/<pageSize>' \
--header 'Authorization: Bearer <API_key>'

```

{% endtab %}

{% tab title="Node" %}

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

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://ags.aeromegh.com/AeroMegh/AeroCapture/plans/xdcf/%20/0/1000/eb4d317f-6703-44ea-83e7-5c654b1df06a?tasktype=0',
  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/AeroCapture/plans/xdcf/%20/0/1000/eb4d317f-6703-44ea-83e7-5c654b1df06a?tasktype=0"

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
{
    
      {
        "plans": [
            {
                "id": "b8b016dc-a6e4-44ae-ad67-91c9c9c7a236",
                "project_name": "ndmvp2",
                "plan_name": "plan1",
                "user_id": "edb1bf33-0a01-4362-8474-e54e97873391",
                "date_and_time": "2023-08-29T11:25:48.317Z",
                "flight_source": "20.01507542048126  73.76465920705655",
                "flight_destination": "20.014820933045964  73.76443928606061",
                "plan_source_latlng": "20.01507542048126  73.76465920705655",
                "linked_map": null,
                "thumb": "https://pdrlimage.blob.core.windows.net/user-edb1bf33-0a01-4362-8474-e54e97873391/AeroGCSWorkspace/ndmvp2/plan1/Assets/planMap.png",
                "MissionType": 2,
                "geofenceData": {
                    "geofence": [
                        {
                            "lat": 20.0151333,
                            "lon": 73.7646886,
                            "alt": 7
                        },
                        {
                            "lat": 20.014784366616542,
                            "lon": 73.76462853922483,
                            "alt": 7
                        },
                        {
                            "lat": 20.01481353323206,
                            "lon": 73.76442703533068,
                            "alt": 7
                        },
                        {
                            "lat": 20.015172999998708,
                            "lon": 73.76448139600608,
                            "alt": 7
                        },
                        {
                            "lat": 20.0151333,
                            "lon": 73.7646886,
                            "alt": 7
                        }
                    ]
                },
                "pilot_id": "st=2023-09-11T00%3A02%3A58Z&se=2024-09-11T09%3A22%3A58Z&sp=racwdl&sv=2018-03-28&sr=c&sig=94WHOurXVxKFMEOCATOP1trAJRq12ZTgwYjA3PpleCk%3D"
            }
        ]
    }
    
}
```

### API Response Parameter Details

The following parameters are included in the API response :

* **id**: Unique identifier for the plan.
* **project\_name**: Name of the project to which this plan belongs.
* **plan\_name**: Name of the specific plan.
* **user\_id**: Unique identifier for the user associated with this plan.
* **date\_and\_time**: Date and time when the plan was created
* **flight\_source**: Latitude and longitude coordinates representing the source of the flight&#x20;
* **flight\_destination**: Latitude and longitude coordinates representing the destination of the flight&#x20;
* **plan\_source\_latlng**: Latitude and longitude coordinates representing the source of the plan&#x20;
* **linked\_map**: This attribute appears to be null, indicating there is no linked map associated with this plan.
* **thumb**: URL pointing to a thumbnail image associated with the plan&#x20;
* **MissionType**: Indicates the type of mission (`spraying plan`).
  * **Mission Type Values and Associated Plans:-** The API response includes a missionType value, represented as an integer, which corresponds to different plans. Below is a table illustrating the missionType values along with their associated plan names:

<table data-full-width="false"><thead><tr><th>missionType Value</th><th>Plan Name</th><th data-hidden></th></tr></thead><tbody><tr><td>0</td><td>Waypoints </td><td></td></tr><tr><td>1</td><td>Survey</td><td></td></tr><tr><td>2</td><td>Spraying</td><td></td></tr><tr><td>3</td><td>Vertical</td><td></td></tr><tr><td>5</td><td>Corridor</td><td></td></tr><tr><td>6</td><td>Circular</td><td></td></tr></tbody></table>

* **geofenceData**: Contains an array of geofence coordinates with their respective latitude, longitude, and altitude.
* **pilot\_id**: represent authentication or authorization token.


# Get Plan Data

The above API provides list of plan data. you can search plans by plan name or paginate plan list through this API.

This API provides programmatic access to plan data with secure API key authentication. Use a GET request to retrieve details like geofence points, mission waypoints, statistics, and project configuration. Comprehensive documentation helps developers leverage the API effectively.

### 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 : get plan data**

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

[<mark style="color:blue;">`https://ags.aeromegh.com/AeroMegh/AeroStack/getPlan?projectName=test&planName=xx`</mark>](https://ags.aeromegh.com/AeroMegh/AeroStack/getPlan?projectName=test\&planName=xx)

### 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/AeroStack/getPlan?projectName=test&planName=xx' \
--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/AeroStack/getPlan?projectName=test&planName=xx',
  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/AeroStack/getPlan?projectName=test&planName=xx"

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
        
{
            
              {
                "Geofence": {
                    "geofence": [
                        {
                            "lat": 20.009584292136523,
                            "lon": 73.7541407905519,
                            "alt": 1
                        },
                        {
                            "lat": 20.009079601546873,
                            "lon": 73.754923325032,
                            "alt": 1
                        },
                        {
                            "lat": 20.00857553941703,
                            "lon": 73.754204493016,
                            "alt": 1
                        },
                        {
                            "lat": 20.008862224951415,
                            "lon": 73.75354332849383,
                            "alt": 1
                        },
                        {
                            "lat": 20.009584292136523,
                            "lon": 73.7541407905519,
                            "alt": 1
                        }
                    ]
                },
                "Mission": {
                    "waypoints": [
                        {
                            "alt": 1,
                            "coordType": 1,
                            "lat": 20.008864460155227,
                            "lon": 73.75356073295823,
                            "speed": 1
                        },
                        {
                            "alt": 1,
                            "coordType": 0,
                            "lat": 20.008868663387137,
                            "lon": 73.75356073295823,
                            "speed": 1
                        },
                        {
                            "alt": 1,
                            "coordType": 1,
                            "lat": 20.008891803010293,
                            "lon": 73.7535798542622,
                            "speed": 1
                        },
                        {
                            "alt": 1,
                            "coordType": 0,
                            "lat": 20.00885612626373,
                            "lon": 73.7535798542622,
                            "speed": 1
                        },
                        {
                            "alt": 1,
                            "coordType": 1,
                            "lat": 20.008847792618187,
                            "lon": 73.75359897499509,
                            "speed": 1
                        }
                    ]
                },
                "MissionStatistics": {
                    "missionStatistics": [
                        {
                            "sprayingSpacing": 2,
                            "headingLockStatus": true,
                            "sprayLockHeading": 0,
                            "sprayingPumpRate": 10,
                            "sprayingSpeedMin": 1,
                            "sprayingArea": 8167.118676843368,
                            "sprayingAltitude": 1,
                            "sprayingSpot": 579,
                            "sprayingTrigger": 1,
                            "landAltLatitue": 0,
                            "landAltLongitude": 0,
                            "landAltitude": 0,
                            "landLatitue": 0,
                            "landLongitude": 0,
                            "missionDefaultAltitude": 10,
                            "missionDefaultSpeed": 5,
                            "missionHomeAltitude": 0,
                            "missionHomeLatitude": 0,
                            "missionHomeLongitude": 0,
                            "missionType": 2,
                            "planeMaxSpeed": 0,
                            "planeMinSpeed": 0,
                            "sprayingSpeed": 1,
                            "surveyCoordCount": 0,
                            "takeOffAltitude": 0,
                            "takeOffLatitue": 0,
                            "takeOffLongitude": 0,
                            "totalPlanDistance": 0,
                            "turnaroundDistance": 0,
                            "turnaroundAngle": 0,
                            "vehicleType": 0,
                            "verticalMission": 0,
                            "verticalRularScaleMaxValue": 0,
                            "wpRadius": 0
                        }
                    ]
                },
                "DGCAfence": {
                    "geofence": [
                        {
                            "lat": 20.00960202004002,
                            "lon": 73.754137683502,
                            "alt": 1
                        },
                        {
                            "lat": 20.00907992797021,
                            "lon": 73.75494244273294,
                            "alt": 1
                        },
                        {
                            "lat": 20.00855767389576,
                            "lon": 73.75420651930422,
                            "alt": 1
                        },
                        {
                            "lat": 20.008858273393678,
                            "lon": 73.75352467585893,
                            "alt": 1
                        },
                        {
                            "lat": 20.00960202004002,
                            "lon": 73.754137683502,
                            "alt": 1
                        }
                    ]
                },
                "planConfiguration": {
                    "projectDetails": [
                        {
                            "clientName": "",
                            "dateTime": "Sept 08,2023 16:53 pm",
                            "planCompletedStatus": 0,
                            "planName": "xx",
                            "projectName": "/AeroGCSWorkspace/test"
                        }
                    ]
                },
                "projectName": "test",
                "planName": "xx",
                "corridor": "File not found in DB",
                "obstacle": {
                    "polygons": [],
                    "circles": []
                }
            }
                      
            
        }
```

### API Response Parameter&#x20;

The following parameters are included in the API response :

| Parameter             | Description                                                                                                                          |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| Geofence              | Contains a list of geofence points with latitude, longitude, and altitude coordinates.                                               |
| **Mission**           | Contains a list of waypoints for the mission, each specifying altitude, coordinate type, latitude, longitude, and speed.             |
| **MissionStatistics** | Contains statistics related to the mission, including parameters like spraying spacing, spraying speed, altitude, area covered, etc. |
| **DGCAfence**         | Similar to the Geofence section, contains a list of geofence points with latitude, longitude, and altitude coordinates.              |
| **planConfiguration** | Contains project details, including client name, date and time, plan completion status, plan name, and project name.                 |
| **projectName**       | Specifies the name of the project ("test").                                                                                          |
| **planName**          | Specifies the name of the plan ("xx").                                                                                               |
| **corridor**          | Provides information about a corridor, indicating that a file associated with it was not found in the database.                      |
| **obstacle**          | Contains information about obstacles, including polygons and circles.                                                                |


# Start Flight

"Seamlessly initiate flights with detailed telemetry data retrieval using Aeromegh's startFlight API."

This API provides programmatic access to detailed startFlight information with secure API key authentication. Retrieve parameters like flight ID, upstream topic, downstream topic, stream key, validity period, stream URI, and stream server base.

### 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

**POST**&#x20;

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

{% code overflow="wrap" %}

```url
https://ags.aeromegh.com/Aeromegh/startFlight?projectName={projectName}&planName={planName}&droneId={droneId}&teamId={teamId}&firmwareVersion={firmwareVersion}&greenBuildNumber={greenBuildNumber}&areaCalculateMethod={areaCalculateMethod}

```

{% endcode %}

### URL Parameters <a href="#http-response-32" id="http-response-32"></a>

URL Parameters are:

| Parameter               | Description                                                                                |
| ----------------------- | ------------------------------------------------------------------------------------------ |
| **projectName**         | Name of the project associated with the flight.                                            |
| **planName**            | Name of the flight plan to execute.                                                        |
| **droneId**             | Unique identifier for the drone initiating the flight.                                     |
| **teamId**              | Unique identifier for the team managing the flight.                                        |
| **firmwareVersion**     | (Optional) Version of the drone's firmware.                                                |
| **greenBuildNumber**    | (Optional) Build number for the green version.                                             |
| **areaCalculateMethod** | (Optional) Specifies the method for area calculation, must be either "spraying" or "plot". |

### 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 --request POST 'https://ags.aeromegh.com/Aeromegh/startFlight?projectName=sandip24april&planName=435pm&droneId=P00001004F002B3131510137383337&teamId=a16afc9b-5205-4fa5-8c42-6276ce1e3281&firmwareVersion=4.4.4&greenBuildNumber=103.265.20240425.01&areaCalculateMethod=spraying' \
--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: 'post',
  maxBodyLength: Infinity,
  url: 'https://ags.aeromegh.com/Aeromegh/startFlight?projectName=sandip24april&planName=435pm&droneId=P00001004F002B3131510137383337&teamId=a16afc9b-5205-4fa5-8c42-6276ce1e3281&firmwareVersion=4.4.4&greenBuildNumber=103.265.20240425.01&areaCalculateMethod=spraying',
  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/startFlight?projectName=sandip24april&planName=435pm&droneId=P00001004F002B3131510137383337&teamId=a16afc9b-5205-4fa5-8c42-6276ce1e3281&firmwareVersion=4.4.4&greenBuildNumber=103.265.20240425.01&areaCalculateMethod=spraying"

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

response = requests.request("POST", 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 %}

### &#x20;API Response

Example of API response in JSON format:

```json
{
    "flightId": "54e9ce7b-e2b8-455e-b351-590c1bf2abdf",
    "upStreamTopic": "wicqkj7f433mhkzxr8yzf5644vpnv36rtsept99wmq3zwq6h26xqhzaf2k1jlr32",
    "downStreamTopic": "8ft0jnqc14va4tf2hfxmsqt8yg565yzf1hso86cfqp2dgdje1v8rj6o9464syefn",
    "streamKey": "20pr1ospms",
    "validTill": "Sun, 12 May 2024 07:53:48 GMT",
    "streamUri": "rtmp://stream02.aeromegh.com/LiveApp",
    "streamServerBase": "stream02.aeromegh.com"
}
```

### API Response Parameter&#x20;

The following parameters are included in API response:&#x20;

| Parameter            | Description                                                                                     |
| -------------------- | ----------------------------------------------------------------------------------------------- |
| **flightId**         | Unique identifier for the initiated flight.                                                     |
| **upStreamTopic**    | Topic for upstream communication, facilitating data transmission from the drone to the server.  |
| **downStreamTopic**  | Topic for downstream communication, enabling data reception from the server to the drone.       |
| **streamKey**        | Key used for stream authentication.                                                             |
| **validTill**        | Timestamp indicating the expiration time of the initiated flight.                               |
| **streamUri**        | Uniform Resource Identifier (URI) for streaming, specifying the destination for streaming data. |
| **streamServerBase** | Base URL of the streaming server facilitating data transmission.                                |


# Get End Flight

"Effortlessly manage flight sessions and retrieve essential data with Aeromegh's endFlight API."

This API facilitates programmatic access to flight session management, enabling authorized users to efficiently terminate flights and gather pertinent information for further analysis.

### 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 Flight Ended Status**

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

{% code overflow="wrap" %}

```url
https://ags.aeromegh.com/Aeromegh/endFlight?flightId={flightId}&teamId={teamId}&distanceCovered={distanceCovered}&areaCovered={areaCovered}

```

{% endcode %}

### URL Parameters <a href="#http-response-32" id="http-response-32"></a>

URL parameters are

| Parameter           | Description                                                     |
| ------------------- | --------------------------------------------------------------- |
| **flightId**        | Unique identifier for the flight session.                       |
| **teamId**          | Unique identifier for the team managing the flight.             |
| **distanceCovered** | Distance covered during the flight (in meters).                 |
| **areaCovered**     | Area covered by the drone during the flight (in square meters). |

### 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/endFlight?flightId=1887ab99-f7e2-4926-b5f4-a6341c75e951&teamId=a16afc9b-5205-4fa5-8c42-6276ce1e3281&distanceCovered=12.5&areaCovered=25' \
--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/endFlight?flightId=1887ab99-f7e2-4926-b5f4-a6341c75e951&teamId=a16afc9b-5205-4fa5-8c42-6276ce1e3281&distanceCovered=12.5&areaCovered=25',
  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/endFlight?flightId=1887ab99-f7e2-4926-b5f4-a6341c75e951&teamId=a16afc9b-5205-4fa5-8c42-6276ce1e3281&distanceCovered=12.5&areaCovered=25"

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 %}

### &#x20;API Response

Example of API response in JSON format:

```json
{
    "message": "Flight Ended."
}
```

### API Response Parameter&#x20;

The API response provides details about the flight session termination status, including the following parameter:

* **Message**: A textual message indicating the status of the ended flight session.


# Add Drone

"Seamlessly integrate new drones into your system with Aeromegh's addDrone API."

This API provides programmatic access to add a new drone to the system with secure API key authentication for authorized users.

### 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

**POST**&#x20;

#### **Post Data Parameters**

| Parameter                | Description                                | Optional |
| ------------------------ | ------------------------------------------ | -------- |
| **droneID**              | Unique identifier for the drone.           | No       |
| **droneName**            | Name assigned to the drone.                | No       |
| **uin**                  | Unique Identification Number of the drone. | No       |
| **model**                | Model of the drone.                        | Yes      |
| **serialNo**             | Serial number of the drone.                | Yes      |
| **fcsNo**                | Flight control system number of the drone. | Yes      |
| **rcsNo**                | Remote control system number of the drone. | Yes      |
| **board\_type**          | Type of board used in the drone.           | Yes      |
| **green\_build\_number** | Build number for the green version.        | Yes      |
| **device\_ram**          | RAM capacity of the device.                | Yes      |
| **android\_version**     | Version of the Android operating system.   | Yes      |
| **device\_model\_name**  | Model name of the device.                  | Yes      |
| **firmware\_version**    | Version of the drone's firmware.           | Yes      |
| **license\_type**        | Type of license associated with the drone. | Yes      |

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

{% code overflow="wrap" %}

```json
https://ags.aeromegh.com/Aeromegh/addDrone?${teamId}
```

{% endcode %}

### URL Parameters <a href="#http-response-32" id="http-response-32"></a>

URL Parameters are:

| Parameter  | Description                                         |
| ---------- | --------------------------------------------------- |
| **teamID** | Unique identifier for the team managing the drones. |

### 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/addDrone?teamId=a16afc9b-5205-4fa5-8c42-6276ce1e3281' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API_KEY>' \
--data '{
    "droneID": "P000010024003B3131510137381045",
    "droneName": "testapi",
    "uin": "BTASD123DB746",
    "model": "134", 
    "serialNo": "34665dffd4554", 
    "fcsNo": "dgf34554", 
    "rcsNo": "ws43433", 
    "board_type": "cubeOrangePlus", 
    "green_build_number": "103.265.20240425.01", 
    "device_ram": "12GB", 
    "android_version": "Android 9", 
    "device_model_name": "QUALCOMM MK15", 
    "firmware_version": "4.4.4", 
    "license_type": "OEM" 
}'
```

{% endtab %}

{% tab title="Node" %}

```javascript
//Please install 'axios' module first
//Set your API key before making the request
const axios = require('axios');
let data = JSON.stringify({
  "droneID": "P000010024003B3131510137381045",
  "droneName": "testapi",
  "uin": "BTASD123DB746",
  "model": "134",
  "serialNo": "34665dffd4554",
  "fcsNo": "dgf34554",
  "rcsNo": "ws43433",
  "board_type": "cubeOrangePlus",
  "green_build_number": "103.265.20240425.01",
  "device_ram": "12GB",
  "android_version": "Android 9",
  "device_model_name": "QUALCOMM MK15",
  "firmware_version": "4.4.4",
  "license_type": "OEM"
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://ags.aeromegh.com/Aeromegh/addDrone?teamId=a16afc9b-5205-4fa5-8c42-6276ce1e3281',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': 'Bearer <API_KEY>'
  },
  data : data
};

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

```

{% endtab %}

{% tab title="Python" %}

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

url = "https://ags.aeromegh.com/Aeromegh/addDrone?teamId=a16afc9b-5205-4fa5-8c42-6276ce1e3281"

payload = json.dumps({
  "droneID": "P000010024003B3131510137381045",
  "droneName": "testapi",
  "uin": "BTASD123DB746",
  "model": "134",
  "serialNo": "34665dffd4554",
  "fcsNo": "dgf34554",
  "rcsNo": "ws43433",
  "board_type": "cubeOrangePlus",
  "green_build_number": "103.265.20240425.01",
  "device_ram": "12GB",
  "android_version": "Android 9",
  "device_model_name": "QUALCOMM MK15",
  "firmware_version": "4.4.4",
  "license_type": "OEM"
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <API_KEY>'
}

response = requests.request("POST", 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 %}

### &#x20;API Response

Example of API response in JSON format:

```json
{
    "message" : "Drone has been registered"
}
```

### API Response Parameter&#x20;

Following parameter is included in API response:

| Parameter   | Description                          |
| ----------- | ------------------------------------ |
| **message** | returned message indicating response |


# Get All Reports

"Effortlessly access and analyze all your reports with Aeromegh's allReports API."

This API provides programmatic access to retrieve all reports within a specified timeframe based on search criteria, with secure API key authentication. Authorized users can use it for analysis or reference.

### 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 all reports**&#x20;

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

{% code overflow="wrap" %}

```json
https://ags.aeromegh.com/Aeromegh/getAllReports?searchString={searchString}&fromDateTime={fromDateTime}&toDateTime={toDateTime}&orderBy={orderBy}&orderType={orderType}&pageSize={pageSize}&pageNumber={pageNumber}
```

{% endcode %}

### URL Parameters <a href="#http-response-32" id="http-response-32"></a>

URL parameters are:

| Parameter        | Description                                                     | Optional | Example                  |
| ---------------- | --------------------------------------------------------------- | -------- | ------------------------ |
| **searchString** | User can search by customer name.                               | Yes      | "John Doe"               |
| **fromDateTime** | Start date and time in UTC.                                     | Yes      | 2023-08-19T00:00:20.335Z |
| **toDateTime**   | End date and time in UTC.                                       | Yes      | 2024-05-07T23:59:20.335Z |
| **orderBy**      | Field name to order the results by. Default is `register_date`. | Yes      | "register\_date"         |
| **orderType**    | Order type, either ASC or DESC. Default is DESC.                | Yes      | "DESC"                   |
| **pageSize**     | Number of records to show on each page.                         | Yes      | 15                       |
| **pageNumber**   | Page number, greater than zero.                                 | Yes      | 1                        |

### 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/getAllReports?searchString=t&fromDateTime=2023-08-19T00%3A00%3A20.335Z&toDateTime=2024-05-07T23%3A59%3A20.335Z&orderBy=created_datetime&orderType=DESC&pageSize=15&pageNumber=2' \
--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/getAllReports?searchString=t&fromDateTime=2023-08-19T00:00:20.335Z&toDateTime=2024-05-07T23:59:20.335Z&orderBy=created_datetime&orderType=DESC&pageSize=15&pageNumber=2',
  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/getAllReports?searchString=t&fromDateTime=2023-08-19T00:00:20.335Z&toDateTime=2024-05-07T23:59:20.335Z&orderBy=created_datetime&orderType=DESC&pageSize=15&pageNumber=2"

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 %}

### &#x20;API Response

Example of API response in JSON format:

```json
{
    "allReports": [
        {
            "id": "40128c02-993d-4405-bb50-3725a284a056",
            "userid": "d5dc6351-d96b-49e2-afa8-ff7d509af7aa",
            "customer_id": "247052d0-1c49-42b1-aa31-f7212092675c",
            "droneid": "P000010024003B3131510137383337",
            "customer_name": "chetan shinde",
            "project_name": "ManualProject",
            "plan_name": "SprayingPlan",
            "crop_type": "rice",
            "area_percentage": "0",
            "amount": "100",
            "spray_spacing": "3.0",
            "spray_area": "0.2494",
            "flight_time": "00:03:48",
            "created_datetime": "2024-04-05T09:28:20.000Z",
            "pesticide": "water",
            "spray_volume": "600 ml"
        },
        {
            "id": "35f74126-9eb7-4c22-826f-47324508053c",
            "userid": "d5dc6351-d96b-49e2-afa8-ff7d509af7aa",
            "customer_id": "3396b947-6e87-4fa5-a709-0382931b266e",
            "droneid": "P000010024003B3131510137383337",
            "customer_name": "chetan shinde",
            "project_name": "sandip05042024",
            "plan_name": "plan1",
            "crop_type": "rice",
            "area_percentage": "67",
            "amount": "100",
            "spray_spacing": "3.0",
            "spray_area": "0.2559",
            "flight_time": "00:03:46",
            "created_datetime": "2024-04-05T09:16:51.000Z",
            "pesticide": "water",
            "spray_volume": "13790 ml"
        }
    ]
}
```

### API Response Parameter&#x20;

The following parameters are included in the API response:

| Parameter Name        | Description                                                    |
| --------------------- | -------------------------------------------------------------- |
| **id**                | Unique identifier for the report.                              |
| **userid**            | Unique identifier for the user associated with the report.     |
| **customer\_id**      | Unique identifier for the customer associated with the report. |
| **droneid**           | Unique identifier for the drone associated with the report.    |
| **customer\_name**    | Name of the customer associated with the report.               |
| **project\_name**     | Name of the project associated with the report.                |
| **plan\_name**        | Name of the plan associated with the report.                   |
| **crop\_type**        | Type of crop associated with the report.                       |
| **area\_percentage**  | Percentage of area covered by spraying.                        |
| **amount**            | Amount associated with the report.                             |
| **spray\_spacing**    | Spacing used for spraying.                                     |
| **spray\_area**       | Total area covered by spraying.                                |
| **flight\_time**      | Duration of the flight.                                        |
| **created\_datetime** | Date and time when the report was created.                     |
| **pesticide**         | Type of pesticide used.                                        |
| **spray\_volume**     | Volume of spray used.                                          |


# Get All Customers

This API is used to retrieve all registered and unregistered drones.

This API provides programmatic access to retrieve all customer records within a specified timeframe based on search criteria, with secure API key authentication. Authorized users can use it for analysis or reference.

### 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 all customer's**&#x20;

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

{% code overflow="wrap" %}

```url
https://ags.aeromegh.com/Aeromegh/getAllCustomers?searchString={searchString}&fromDateTime={fromDateTime}&toDateTime={toDateTime}&orderBy={orderBy}&orderType={orderType}&pageSize={pageSize}&pageNumber={pageNumber}

```

{% endcode %}

### URL Parameters <a href="#http-response-32" id="http-response-32"></a>

URL parameters are:

| Parameter        | Description                                           | Optional | Example                    |
| ---------------- | ----------------------------------------------------- | -------- | -------------------------- |
| **searchString** | Allows users to search by customer name.              | Yes      | "John Doe"                 |
| **fromDateTime** | Specifies the start date and time in UTC.             | Yes      | "2023-08-19T00:00:20.335Z" |
| **toDateTime**   | Specifies the end date and time in UTC.               | Yes      | "2024-05-07T23:59:20.335Z" |
| **orderBy**      | Specifies the field name to order results by.         | Yes      | "register\_date"           |
| **orderType**    | Specifies the order type; ASC or DESC.                | Yes      | "DESC"                     |
| **pageSize**     | Specifies the number of records per page.             | Yes      | 15                         |
| **pageNumber**   | Specifies the page number; must be greater than zero. | Yes      | 1                          |

### 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" %}

```url
curl --location 'https://ags.aeromegh.com/Aeromegh/getAllCustomers?searchString=&fromDateTime=2023-08-19T00%3A00%3A20.335Z&toDateTime=2024-05-07T23%3A59%3A20.335Z&orderBy=register_date&orderType=DESC&pageSize=15&pageNumber=1' \
--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/getAllCustomers?searchString=&fromDateTime=2023-08-19T00:00:20.335Z&toDateTime=2024-05-07T23:59:20.335Z&orderBy=register_date&orderType=DESC&pageSize=15&pageNumber=1',
  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/getAllCustomers?searchString=&fromDateTime=2023-08-19T00:00:20.335Z&toDateTime=2024-05-07T23:59:20.335Z&orderBy=register_date&orderType=DESC&pageSize=15&pageNumber=1"

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 %}

### &#x20;API Response

Example of API response in JSON format:

```json
{
    "allCustomers": [
        {
            "id": "97c4383c-f477-4cb3-8775-727bd0d375ac",
            "userid": "d5dc6351-d96b-49e2-afa8-ff7d509af7aa",
            "customer_name": "chetan shinde",
            "contact_number": null,
            "address": null,
            "email": null,
            "register_date": "2024-04-24T12:14:03.900Z",
            "government_id": null,
            "pilot_license_id": null,
            "gst_no": null,
            "cust_type": "green",
            "totalAcres": "16.5562",
            "totalRevenue": "15405",
            "reportStatCrop": [
                {
                    "crop_type": "rice"
                },
                {
                    "crop_type": "rice "
                },
                {
                    "crop_type": "rics"
                }
            ]
        },
        {
            "id": "8d5fcb25-8e01-44fc-9cff-8a7701f5b326",
            "userid": "d5dc6351-d96b-49e2-afa8-ff7d509af7aa",
            "customer_name": "chetan shinde",
            "contact_number": null,
            "address": null,
            "email": null,
            "register_date": "2024-04-05T09:32:03.498Z",
            "government_id": null,
            "pilot_license_id": null,
            "gst_no": null,
            "cust_type": "green",
            "totalAcres": "2.47",
            "totalRevenue": "100",
            "reportStatCrop": [
                {
                    "crop_type": "rice"
                }
            ]
        }
    ]
}
```

### API Response Parameter&#x20;

The following parameters are included in API response:

| Parameter Name         | Description                                                                                                                                 |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| **id**                 | Unique identifier for each customer.                                                                                                        |
| **userid**             | Identifier for the user associated with the customer.                                                                                       |
| **customer\_name**     | Name of the customer.                                                                                                                       |
| **contact\_number**    | Contact number of the customer.                                                                                                             |
| **address**            | Address of the customer.                                                                                                                    |
| **email**              | Email address of the customer.                                                                                                              |
| **register\_da**te     | Date and time of customer registration.                                                                                                     |
| **government\_id**     | Government-issued identification number, if available.                                                                                      |
| **pilot\_license\_id** | Pilot license ID, if applicable.                                                                                                            |
| **gst\_no**            | Goods and Services Tax (GST) number, if available.                                                                                          |
| **cust\_type**         | Type of customer (e.g., green, premium, standard).                                                                                          |
| **totalAcres**         | Total acres managed by the customer.                                                                                                        |
| **totalRevenue**       | Total revenue generated by the customer.                                                                                                    |
| **reportStatCrop**     | An array containing objects specifying crop types and their statistics for each customer. Each object includes the following subparameters: |


# Get All Crops

"Dive into the world of crops effortlessly with Aeromegh's crop data API."

This API provides programmatic access to crop data, including types and quantities, with secure API key authentication. Explore the endpoints below for details on parameters and responses.

### 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 a list of all crops.**

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

{% code overflow="wrap" %}

```url
https://ags.aeromegh.com/Aeromegh/getAllCrops?searchString={searchString}&fromDateTime={fromDateTime}&toDateTime={toDateTime}&orderBy={orderBy}&orderType={orderType}&pageSize={pageSize}&pageNumber={pageNumber}

```

{% endcode %}

### URL Parameters <a href="#http-response-32" id="http-response-32"></a>

URL parameters are:

| Parameter        | Description                                          | Optional | Example                  |
| ---------------- | ---------------------------------------------------- | -------- | ------------------------ |
| **searchString** | Users can search by crop type.                       | Yes      |                          |
| **fromDateTime** | Start date and time in UTC.                          | Yes      | 2023-08-19T00:00:20.335Z |
| **toDateTime**   | End date and time in UTC.                            | Yes      | 2024-05-07T23:59:20.335Z |
| **orderBy**      | Field name to order by; default field is crop\_type. | Yes      | crop\_type               |
| **orderType**    | Sorting order, either ASC or DESC; default is DESC.  | Yes      | DESC                     |
| **pageSize**     | Number of records shown on each page.                | Yes      | 15                       |
| **pageNumber**   | Page number; must be greater than zero.              | Yes      | 1                        |

### 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" %}

```url
curl --location 'https://ags.aeromegh.com/Aeromegh/getAllCrops?searchString=&fromDateTime=2023-08-19T00%3A00%3A20.335Z&toDateTime=2024-05-07T23%3A59%3A20.335Z&orderBy=crop_type&orderType=DESC&pageSize=15&pageNumber=1' \
--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/getAllCrops?searchString=&fromDateTime=2023-08-19T00:00:20.335Z&toDateTime=2024-05-07T23:59:20.335Z&orderBy=crop_type&orderType=DESC&pageSize=15&pageNumber=1',
  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/getAllCrops?searchString=&fromDateTime=2023-08-19T00:00:20.335Z&toDateTime=2024-05-07T23:59:20.335Z&orderBy=crop_type&orderType=DESC&pageSize=15&pageNumber=1"

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 %}

### &#x20;API Response

Example of API response in JSON format:

```json
{
    "allCrops": [
        {
            "crop_type": "rice"
        },
        {
            "crop_type": "jawar"
        }
    ]
}
```

### API Response Parameter&#x20;

The following parameter is included in API response

| Parameter      | Description                               | Example |
| -------------- | ----------------------------------------- | ------- |
| **crop\_type** | The type of crop returned in the response | rice    |


# Get All Pesticides

"Unlock the power of pesticide data seamlessly with Aeromegh's pesticide API endpoint."

This API  provides programmatic access to a list of all pesticides, including names, quantities, and other attributes, with secure API key authentication. Use it to seamlessly integrate pesticide data into 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 a list of all pesticides.**

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

{% code overflow="wrap" %}

```url
https://ags.aeromegh.com/Aeromegh/getAllPesticides?searchString={searchString}&fromDateTime={fromDateTime}&toDateTime={toDateTime}&orderBy={orderBy}&orderType={orderType}&pageSize={pageSize}&pageNumber={pageNumber}

```

{% endcode %}

### URL Parameters <a href="#http-response-32" id="http-response-32"></a>

URL parameters are:

| Parameter        | Description                                 | Optional | Example                  |
| ---------------- | ------------------------------------------- | -------- | ------------------------ |
| **searchString** | User can search by pesticide name.          | Yes      |                          |
| **fromDateTime** | FromDateTime in UTC.                        | Yes      | 2023-08-19T00:00:20.335Z |
| **toDateTime**   | ToDateTime in UTC.                          | Yes      | 2024-05-07T23:59:20.335Z |
| **orderBy**      | Order by field name (default is pesticide). | Yes      | pesticide                |
| **orderType**    | OrderType is in ASC or DESC (default DESC). | Yes      | DESC                     |
| **pageSize**     | Number of records shown on each page.       | Yes      | 15                       |
| **pageNumber**   | Number of pages greater than zero.          | Yes      | 1                        |

### 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" %}

```url
curl --location 'https://ags.aeromegh.com/Aeromegh/getAllPesticides?searchString=&fromDateTime=2023-08-19T00%3A00%3A20.335Z&toDateTime=2024-05-07T23%3A59%3A20.335Z&orderBy=pesticide&orderType=DESC&pageSize=15&pageNumber=1' \
--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/getAllPesticides?searchString=&fromDateTime=2023-08-19T00:00:20.335Z&toDateTime=2024-05-07T23:59:20.335Z&orderBy=pesticide&orderType=DESC&pageSize=15&pageNumber=1',
  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/getAllPesticides?searchString=&fromDateTime=2023-08-19T00:00:20.335Z&toDateTime=2024-05-07T23:59:20.335Z&orderBy=pesticide&orderType=DESC&pageSize=15&pageNumber=1"

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 %}

### &#x20;API Response

Example of API response in JSON format:

```json
{
    "allpesticide": [
        {
            "pesticide": "Amistar Top"
        },
        {
            "pesticide": "Folio Gold"
        }
    ]
}
```

### API Response Parameter&#x20;

The following parameters are included in API response:

| Parameter     | Description                                    | Example     |
| ------------- | ---------------------------------------------- | ----------- |
| **pesticide** | The type of pesticide returned in the response | Amistar Top |


# Add Flight Log

"Effortlessly record and manage drone flight data with Aeromegh's addFlightLog API endpoint."

This API provides programmatic access for adding flight log entries with secure API key authentication. It records essential telemetry data and other relevant information, creating a comprehensive record of drone operations.

### 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

**POST**&#x20;

#### Post Data Parameters

| Parameter       | Description                                                | Optional | Example                              |
| --------------- | ---------------------------------------------------------- | -------- | ------------------------------------ |
| **droneID**     | Unique identifier for the drone.                           | No       | P00001004F002B3131510137383337       |
| **teleData**    | Telemetry data collected during the flight.                | No       | See example JSON object below        |
| **flightID**    | Unique identifier for the flight.                          | No       | ebddac29-c44d-481e-90ff-48a344080fa8 |
| **key**         | Key indicating the type of telemetry data.                 | No       | AS\_TELE\_DATA                       |
| **aerostackID** | Unique identifier for the Aerostack system.                | No       | 999e8416-d5af-4828-8c44-a83f1e556d4e |
| **timestamp**   | Timestamp indicating when the telemetry data was received. | No       | 1715083563                           |

Example of the `teleData` object:

```json
{
    "alt": 1.37,
    "bat": "43.631",
    "dir": "18.00",
    "flowRate": "0.00",
    "lat": 28.9852907,
    "liquidConsumed": "00",
    "liveObstacleDistance": "2.5",
    "lon": 78.0017839,
    "mod": "16",
    "pit": -1.6977644338993196,
    "rol": 0.7457296585355124,
    "sat": 28,
    "sprayPumpRate": "41",
    "sprayedArea": "0.0000",
    "sprayedDistance": "1283.448",
    "vel": 0.05128028988838196,
    "yaw": 18.24909237728412
}
```

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

{% code overflow="wrap" %}

```url
https://ags.aeromegh.com/Aeromegh/addFlightLog
```

{% endcode %}

### 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/addFlightLog' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API_KEY>' \
--data '{
    "droneID": "P00001004F002B3131510137383337",
    "teleData": {"alt":1.37,"bat":"43.631","dir":"18.00","flowRate":"0.00","lat":28.9852907,"liquidConsumed":"00","liveObstacleDistance":"2.5","lon":78.0017839,"mod":"16","pit":-1.6977644338993196,"rol":0.7457296585355124,"sat":28,"sprayPumpRate":"41","sprayedArea":"0.0000","sprayedDistance":"1283.448","vel":0.05128028988838196,"yaw":18.24909237728412},
    "flightID": "ebddac29-c44d-481e-90ff-48a344080fa8",
    "key": "AS_TELE_DATA",
    "aerostackID":"999e8416-d5af-4828-8c44-a83f1e556d4e",
    "timestamp":"1715083563"
}

'
```

{% endtab %}

{% tab title="Node" %}

```javascript
//Please install 'axios' module first
//Set your API key before making the request
const axios = require('axios');
let data = JSON.stringify({
  "droneID": "P00001004F002B3131510137383337",
  "teleData": {
    "alt": 1.37,
    "bat": "43.631",
    "dir": "18.00",
    "flowRate": "0.00",
    "lat": 28.9852907,
    "liquidConsumed": "00",
    "liveObstacleDistance": "2.5",
    "lon": 78.0017839,
    "mod": "16",
    "pit": -1.6977644338993196,
    "rol": 0.7457296585355124,
    "sat": 28,
    "sprayPumpRate": "41",
    "sprayedArea": "0.0000",
    "sprayedDistance": "1283.448",
    "vel": 0.05128028988838196,
    "yaw": 18.24909237728412
  },
  "flightID": "ebddac29-c44d-481e-90ff-48a344080fa8",
  "key": "AS_TELE_DATA",
  "aerostackID": "999e8416-d5af-4828-8c44-a83f1e556d4e",
  "timestamp": "1715083563"
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://ags.aeromegh.com/Aeromegh/addFlightLog',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': 'Bearer <API_KEY>'
  },
  data : data
};

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

```

{% endtab %}

{% tab title="Python" %}

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

url = "https://ags.aeromegh.com/Aeromegh/addFlightLog"

payload = json.dumps({
  "droneID": "P00001004F002B3131510137383337",
  "teleData": {
    "alt": 1.37,
    "bat": "43.631",
    "dir": "18.00",
    "flowRate": "0.00",
    "lat": 28.9852907,
    "liquidConsumed": "00",
    "liveObstacleDistance": "2.5",
    "lon": 78.0017839,
    "mod": "16",
    "pit": -1.6977644338993196,
    "rol": 0.7457296585355124,
    "sat": 28,
    "sprayPumpRate": "41",
    "sprayedArea": "0.0000",
    "sprayedDistance": "1283.448",
    "vel": 0.05128028988838196,
    "yaw": 18.24909237728412
  },
  "flightID": "ebddac29-c44d-481e-90ff-48a344080fa8",
  "key": "AS_TELE_DATA",
  "aerostackID": "999e8416-d5af-4828-8c44-a83f1e556d4e",
  "timestamp": "1715083563"
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <API_KEY>'
}

response = requests.request("POST", 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 %}

### &#x20;API Response

Example of API response in JSON format:

```json
{
    "message": "Flight log added"
}
```

### API Response Parameter&#x20;

The API response contains the following parameters:

| Parameter   | Description                                                                                                                                                                               |
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **message** | A message indicating the result of the operation. In this case, it confirms that the flight log has been successfully added to the Aeromegh system. The value will be "Flight log added". |


# Add Offline Flight Logs

"Easily upload offline flight logs and seamlessly integrate drone flight data with Aeromegh's addOfflineFlightLogs API."

This API provides programmatic access for uploading offline flight logs with secure API key authentication. This endpoint accepts POST requests and requires authentication through a bearer token, facilitating the integration of flight data into the system.

### 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

#### **POST**&#x20;

#### Post Data Parameters

| Parameter       | Description                                | Optional | Example                                |
| --------------- | ------------------------------------------ | -------- | -------------------------------------- |
| **projectname** | Specifies the name of the project          | No       | "test"                                 |
| **planname**    | Indicates the name of the flight plan      | No       | "test"                                 |
| **aerostackid** | Unique identifier for the Aerostack system | No       | "999e8416-d5af-4828-8c44-a83f1e556d4e" |
| **flightid**    | Unique identifier for the flight           | No       | "1c0d5d87-4a1c-4613-a5eb-2bb1c0a13791" |
| **droneid**     | Unique identifier for the drone            | No       | "P00001004F002B3131510137383337"       |
| **teamid**      | Unique identifier for the team             | No       | "a16afc9b-5205-4fa5-8c42-6276ce1e3281" |

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

{% code overflow="wrap" %}

```url
https://ags.aeromegh.com/Aeromegh/addOfflineFlightLogs
```

{% endcode %}

### 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/addOfflineFlightLogs' \
--header 'projectname: test' \
--header 'planname: test' \
--header 'aerostackid: 999e8416-d5af-4828-8c44-a83f1e556d4e' \
--header 'flightid: 1c0d5d87-4a1c-4613-a5eb-2bb1c0a13791' \
--header 'droneid: P00001004F002B3131510137383337' \
--header 'teamid: a16afc9b-5205-4fa5-8c42-6276ce1e3281' \
--header 'Authorization: Bearer <API_KEY>' \
--form 'file=@"postman-cloud:///1ef0c693-4ecd-4390-981e-1feebdb9fdcc"'
```

{% endtab %}

{% tab title="Node" %}

```javascript
//Please install 'axios' , ' form-data' and ' fs ' module first
//Set your API key before making the request
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
let data = new FormData();
data.append('file', fs.createReadStream('postman-cloud:///1ef0c693-4ecd-4390-981e-1feebdb9fdcc'));

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://ags.aeromegh.com/Aeromegh/addOfflineFlightLogs',
  headers: { 
    'projectname': 'test', 
    'planname': 'test', 
    'aerostackid': '999e8416-d5af-4828-8c44-a83f1e556d4e', 
    'flightid': '1c0d5d87-4a1c-4613-a5eb-2bb1c0a13791', 
    'droneid': 'P00001004F002B3131510137383337', 
    'teamid': 'a16afc9b-5205-4fa5-8c42-6276ce1e3281', 
    'Authorization': 'Bearer <API_KEY>', 
    ...data.getHeaders()
  },
  data : data
};

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/addOfflineFlightLogs"

payload = {}
files=[
  ('file',('1ef0c693-4ecd-4390-981e-1feebdb9fdcc',open('postman-cloud:///1ef0c693-4ecd-4390-981e-1feebdb9fdcc','rb'),'application/octet-stream'))
]
headers = {
  'projectname': 'test',
  'planname': 'test',
  'aerostackid': '999e8416-d5af-4828-8c44-a83f1e556d4e',
  'flightid': '1c0d5d87-4a1c-4613-a5eb-2bb1c0a13791',
  'droneid': 'P00001004F002B3131510137383337',
  'teamid': 'a16afc9b-5205-4fa5-8c42-6276ce1e3281',
  'Authorization': 'Bearer <API_KEY>'
}

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

print(response.text)

```

{% endtab %}
{% endtabs %}

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

### &#x20;API Response

Example of API response in JSON format:

```json
{
    "message": "Logs added"
}
```

### API Response Parameter&#x20;

The following parameter is included in API response::

| Parameter   | Description                                                                                                                                                                   |
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **message** | A message indicating the result of the operation. In this case, it confirms that the logs has been successfully added to the Aeromegh system. The value will be "Logs added". |


