Skip to content

Profiles

Create a profile

Interacting with the API

The endpoint below is used to create a single profile for project with ID project_id.

POST /p-{project_id}/profiles/

Tip: setting the coordinate type of points

This endpoint supports the extra path parameter coordinate_type that allows you to work with local and global coordinates for the profile points. Please see API - Setting the Coordinate Type of Points for more information.

The payload of this endpoint includes the following elements:

Element Type Unit Description Observations
name string - Name commonly used to identify the profile. It can be set to any string Any name accepted, but must be unique amongst all profiles of a project
flight_type string - Either arrival or departure Only accepts a for arrivals and d for departures
stage_length int - Stage length linked to this profile -
aircrfat_type string - ANP identifier of the aircraft linked to this profile -
points list See observations List of points representing the profile Each point expected as [s, z, v, p], where s [meter] is distance, z [meter] is altitude, v [meter/sec] is speed and p is power setting

Below is an example of how you can create a profile for your project.

import requests

def create_profile(base_url: str, project_id: int, headers: dict, aircraft_type: str):

    # Define payload
    profile_payload = {
      "name": "My New Profile",
      "flight_type": "a",
      "stage_length": 1, 
      "aircraft_type": aircraft_type,
      "points": [
          [0, 0, 0, 0],
          [1000, 100, 30, 80],
          [3000, 250, 90, 90],
          [5000, 600, 150, 90],
      ]
    }


    # Create profile
    profile_response = requests.post(
      f"{base_url}/p-{project_id}/profiles/",
      json=profile_payload,
      headers=headers
    )

    # Extract response after creating profile
    profile = profile_response.json()

Using the Website

DOCUMENTATION TO BE ADDED SOON

The documentation for this section has not been completed yet.

Upload a profile file

The action described in Create a profile allows you to add one profile at a time to the project. However, for larger projects, you may want to add several profiles at the same time. This is possible by using the endpoint below, which allows you to upload a .csv file that is converted into new profiles. Each row in the file corresponds to a single point.

POST /p-{project_id}/profiles/upload/

Tip: grouping file rows

This endpoint supports an extra path paramter called group_by. In the cases when your file has more than one profile, this paramter allows you to choose which column you want to use to group the rows into a single profile. For instance, if your profile_name column uniquely identifies a profile, you can use it as the group_by column, and Echo will group the rows from the .csv file that share the same profile_name into a new profile.

Expected columns in file

The columns below should be included in the .csv file you upload to create your profiles. If at least one column is missing, Echo will return a validation error and will let you know which columns are missing.

Column Type Unit Description Observations
profile_name string - Name of each profile Any name accepted, but must be unique amongst all profiles of a project
flight_type string - Either arrival or departure Only accepts a for arrivals and d for departures
stage_length int - Stage length linked to each profile -
aircraft_type string - ANP identifier of the aircraft linked to each profile -
s float meter Distance flown, at each point -
z float meter Altitude at each point -
v float meter/sec Speed at each point -
p float - Power setting at each point -

Below is an example of how you can upload a file to create several profiles.

from typing import Union
import requests
from pathlib import Path

def upload_profiles_file(base_url: str, project_id: int, headers: dict, file_path: Union[str, Path]):

    # Prepare file
    file = {"file": open(file_path, "rb")}

    # Choose the column used to group the rows into individual profiles
    group_by = "profile_name"

    # Upload file
    profiles_response = requests.post(
      f"{base_url}/p-{project_id}/profiles/upload/"  + f"?group_by={group_by}",
      files=file,
      headers=headers
    )

    # Extract response after uploading all profiles
    profiles = profiles_response.json()

Using the Website

DOCUMENTATION TO BE ADDED SOON

The documentation for this section has not been completed yet.

Read a profile

Interacting with the API

You can read a single profile with name profile_name from a project with ID project_id by using the endpoint below.

GET /p-{project_id}/profiles/{profile_name}/

Besides returning general information about the profile, this endpoint also returns its points. Below is an example of how you can read a single profile.

import requests

def read_profile(base_url: str, project_id: int, headers: dict, profile_name: str):

    # Read profile
    profile_response = requests.get(
      f"{base_url}/p-{project_id}/profiles/{profile_name}/",
      headers=headers
    )

    # Extract response after fetching profile
    profile = profile_response.json()

Using the Website

DOCUMENTATION TO BE ADDED SOON

The documentation for this section has not been completed yet.

Read all project profiles

Interacting with the API

You can also retrieve information from all profiles that are part of a project with ID project_id. To get this information, the endpoint below can be used.

GET /p-{project_id}/profiles/

Note that, unlike the endpoint that returns a single profile, this endpoint will only return the general information of all profiles that are part of this project and will not include each profiles's points. Below is an example of how you can get a list with information about all profiles from a certain project.

import requests

def read_all_profiles(base_url: str, project_id: int, headers: dict):

    # Read all profiles
    profiles_response = requests.get(
      f"{base_url}/p-{project_id}/profiles/",
      headers=headers
    )

    # Extract response as a list after fetching all profiles
    profiles = profiles_response.json()

Using the Website

DOCUMENTATION TO BE ADDED SOON

The documentation for this section has not been completed yet.

Update a profile

Interacting with the API

Once a profile is created, only its name can be updated. To make sure the finished calculations that use a certain profile remain valid, Echo does not allow to change its points.

To update a profile named profile_name in a project with ID project_id, the endpoint below is used.

PATCH /p-{project_id}/profiles/{profile_name}/

The payload of this endpoint only includes the name field. To get more information about this field, check how to create a profile.

Below is an example of how you can update a profile's name.

import requests

def update_profile(base_url: str, project_id: int, headers: dict, profile_name: str):

    # Define payload
    update_payload = {
      "name": "My New Other Profile",
    }

    # Update profile
    profile_response = requests.patch(
      f"{base_url}/p-{project_id}/profiles/{profile_name}/",
      json=update_payload,
      headers=headers
    )

    # Extract response after updating profile
    profile = profile_response.json()

Using the Website

DOCUMENTATION TO BE ADDED SOON

The documentation for this section has not been completed yet.

Delete a profile

Interacting with the API

To delete a single profile with name profile_name belonging to a project with ID project_id, the endpoint below can be used.

DELETE /p-{project_id}/profiles/{profile_name}/

Deleting a profile is an irreversible action

After deleting a profile, it is not possible to recover it. Furthermore, all the data linked to that profile will also be deleted. You will have to create a new profile to replace it.

Below is an example of how you can delete a profile.

import requests

def delete_profile(base_url: str, project_id: int, headers: dict, profile_name: str):

    # Delete profile
    profile_response = requests.delete(
      f"{base_url}/p-{project_id}/profiles/{profile_name}/",
      headers=headers
    )

    # Extract information about deleted profile
    profile = profile_response.json()

Using the Website

DOCUMENTATION TO BE ADDED SOON

The documentation for this section has not been completed yet.