Skip to content

Instantly share code, notes, and snippets.

@chrismullins
Created June 12, 2018 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismullins/78ffbdbb21f65f733b915aa733ffeaf1 to your computer and use it in GitHub Desktop.
Save chrismullins/78ffbdbb21f65f733b915aa733ffeaf1 to your computer and use it in GitHub Desktop.
Get custom fields from close.io API
from closeio_api import Client
api = Client('your_api_key')
res = api.get('custom_fields/lead')
for field in res['data']:
print(field['name'] + ': '+ field['id'])
@chrismullins
Copy link
Author

res['data'] is a list of dictionaries for each custom field, so get the choices for a field like this:

res['data'][next(index for (index, d) in enumerate(res['data']) if d['name'] == '**Lead Type')]['choices']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment