Workspaces are the place where users in the same organization collaborate and share maps. A user may form part of several workspaces but, at the very least, always forms part of one.
API tokens are created per-workspace. If you wish to interact with several workspaces via the Felt API, you must create a different API token for each one.
Working with maps
Creating a new map
Creating a new map is as simple as making a POST request to the maps endpoint.
# Your API token should look like this:
# FELT_API_TOKEN="felt_pat_ABCDEFUDQPAGGNBmX40YNhkCRvvLI3f8/BCwD/g8"
FELT_API_TOKEN="<YOUR_API_TOKEN>"
curl -L \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${FELT_API_TOKEN}" \
"https://felt.com/api/v2/maps" \
-d '{"title": "My newly created map"}'
import requests
# Your API token should look like this:
# api_token = "felt_pat_ABCDEFUDQPAGGNBmX40YNhkCRvvLI3f8/BCwD/g8"
api_token = "<YOUR_API_TOKEN>"
r = requests.post(
"http://felt.com/api/v2/maps",
json={"title": "My newly created map"},
headers={"Authorization": f"Bearer {api_token}"}
)
assert r.ok
map_id = r.json()["id"]
print(r.json())
import os
from felt_python import create_map
# Setting your API token as an env variable can save
# you from repeating it in every function call
os.environ["FELT_API_TOKEN"] = "<YOUR_API_TOKEN>"
response = create_map(
title="My newly created map",
lat=40,
lon=-3,
public_access="private",
)
map_id = response["id"]
Notice in the response the "id" property. Every map has a unique ID, which is also a part of the map's URL. Let's take note of it for future API calls.
Also part of the response is a "url" property, which is the URL to your newly-created map.
Getting a map's details
Performing a GET request to a map URL will give you useful information about that map, including title, URL, layers, thumbnail URL, creation and visited timestamps.