# Get Plan Data

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


---

# Agent Instructions: Querying This Documentation

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

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

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

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

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