Skip to content

Instantly share code, notes, and snippets.

@svenkapudija-close
Created Mar 25, 2022
Embed
What would you like to do?
List organization active members
import json
import requests
API_ROOT_URL = "https://api.close.com/api/v1"
api_key = input_data.get("api_key")
if not api_key:
raise Exception("Please enter an API Key into the required field")
organization_id = requests.get(f"{API_ROOT_URL}/me", auth=(api_key, "")).json()["organizations"][0]["id"]
response = requests.get(
f"{API_ROOT_URL}/organization/{organization_id}",
auth=(api_key, ""),
params={"_fields": "memberships"},
headers={"Content-Type": "application/json"},
).json()
output = [{"id": x["user_id"], "name": x["user_full_name"]} for x in response["memberships"]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment