Get Enterprise ID from SDK
AnsweredIs there a way to get the enterprise ID for/from a user, or at all, within, for example, the Python SDK? Or perhaps via an API call? I've found a couple other questions asking this, but they were not answered, or had cryptic, "Nevermind, figured it out" sort of responses.
I've tried several variations on `enterpriseId` in my fields parameter when getting a user, but no luck yet.
-
So, a little closer reading of the REST API docs was needed here.
A user object has an `enterprise` field, which is a small representation of the enterprise the user is a part of. This object contains an `id` field, which is the enterprise id I was looking for.
Something like
```
user_enterprise = client.user().get(fields=["enterprise"])
enterprise_id = user_enterprise.enterprise.id
```
accomplishes exactly what I needed. Hopefully this is helpful to someone in the future.
-
Hi ,
Thanks for posting the answer you found back to the community! Hopefully this will help other members who run into this challenge in the future.
I'll also show your post to our dev docs team to see if they can find a way to make this easier to find in the documentation.
Thanks again!
-Scott
Please sign in to leave a comment.
Comments
2 comments