Discovering Identity Attribute Types
import os
import requests
API_URL = "https://api.apono.io/api/admin/v1/attributes"
def get_auth_headers() -> dict:
token = os.getenv("APONO_TOKEN")
if not token:
raise RuntimeError("Missing APONO_TOKEN environment variable")
return {
"Authorization": f"Bearer {token}",
"Accept": "*/*"
}
def fetch_unique_attribute_types() -> set:
headers = get_auth_headers()
attribute_types = set()
next_page_token = None
while True:
params = {}
if next_page_token:
params["page_token"] = next_page_token
response = requests.get(API_URL, headers=headers, params=params)
response.raise_for_status()
data = response.json()
for attribute_item in data.get("items", []):
attr_type = attribute_item.get("type")
if attr_type:
attribute_types.add(attr_type)
next_page_token = data.get("pagination", {}).get("next_page_token")
if not next_page_token:
break
return attribute_types
if __name__ == "__main__":
print(sorted(fetch_unique_attribute_types()))Last updated
Was this helpful?
