import requests
# API configuration
AUTH_ENDPOINT = "https://engage-auth.longenesis.com/auth/realms/longenesis/protocol/openid-connect/token"
API_BASE_URL = "https://engage-api.longenesis.com"
CLIENT_ID = "your-client-id"
CLIENT_SECRET = "your-client-secret"
ORG_SLUG = "your-organization"
# Get access token
auth_data = {
"grant_type": "client_credentials",
"client_id": CLIENT_ID,
"client_secret": CLIENT_SECRET
}
auth_response = requests.post(AUTH_ENDPOINT, data=auth_data)
access_token = auth_response.json()["access_token"]
headers = {"Authorization": f"Bearer {access_token}"}
# Search for participants by name
search_url = f"{API_BASE_URL}/search_org_participants/{ORG_SLUG}"
search_params = {"search_str": "Smith", "limit": 25}
search_response = requests.get(search_url, headers=headers, params=search_params)
search_data = search_response.json()
print(f"Found {search_data['total_count']} participants")
for person in search_data['persons']:
print(f"ID: {person['person_id']}")
if person['profile']:
profile = person['profile']
print(f"Name: {profile.get('given_name', '')} {profile.get('family_name', '')}")