import requests def get_vertexdc_users(): api_url = "https://api.sibu.vertexdc.com" login_data = { "email": "admin@sibu.com", "password": "admin", "keep_session": True } print(f"Logging in to {api_url}/api/auth/login...") try: response = requests.post(f"{api_url}/api/auth/login", json=login_data) if response.status_code != 200: print(f"Login failed: {response.status_code} - {response.text}") return token_data = response.json() token = token_data.get("access_token") print("Login successful!") headers = {"Authorization": f"Bearer {token}"} # Try to search for '@' to get all users or use search with empty string if allowed print("Fetching users via /api/users/search?email=...") search_response = requests.get(f"{api_url}/api/users/search", params={"email": ""}, headers=headers) if search_response.status_code == 200: users = search_response.json() print(f"Found {len(users)} users:") for u in users: print(f"- {u['full_name']} ({u['email']}) Role: {u['role']}") else: print(f"Search failed: {search_response.status_code} - {search_response.text}") except Exception as e: print(f"Error: {e}") if __name__ == "__main__": get_vertexdc_users()