# Your API token and map ID should look like this:# FELT_API_TOKEN="felt_pat_ABCDEFUDQPAGGNBmX40YNhkCRvvLI3f8/BCwD/g8"# MAP_ID="CjU1CMJPTAGofjOK3ICf1D"FELT_API_TOKEN="<YOUR_API_TOKEN>"MAP_ID="<YOUR_MAP_ID>"curl-L \-H"Authorization: Bearer ${FELT_API_TOKEN}" \"https://felt.com/api/v2/maps/${MAP_ID}/elements"
import requests# Your API token and map ID should look like this:# api_token = "felt_pat_ABCDEFUDQPAGGNBmX40YNhkCRvvLI3f8/BCwD/g8"api_token ="<YOUR_API_TOKEN>"map_id ="<YOUR_MAP_ID>"r = requests.get(f"http://felt.com/api/v2/maps/{map_id}/elements", headers={"Authorization": f"Bearer {api_token}"})assert r.okprint(r.json())
import osfrom felt_python import list_elements# Setting your API token as an env variable can save# you from repeating it in every function callos.environ["FELT_API_TOKEN"]="<YOUR_API_TOKEN>"map_id ="<YOUR_MAP_ID>"list_elements(map_id)
Listing all element groups
Returns a list of GeoJSON Feature Collections, one for each element group.
r = requests.get(f"http://felt.com/api/v2/maps/{map_id}/elements", headers={"Authorization": f"Bearer {api_token}"})assert r.okprint(r.json())
from felt_python import list_element_groupslist_element_groups(map_id)
Create or update new elements
Each element is represented by a feature in the POSTed GeoJSON Feature Collection.
For each feature, including an existing element ID (felt:id) will result in the element being updated on the map. If no element ID is provided (or a non-existent one) , a new element will be created.