Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support show_many for Users #107

Closed
joelhellman opened this issue Mar 7, 2017 · 8 comments
Closed

Support show_many for Users #107

joelhellman opened this issue Mar 7, 2017 · 8 comments

Comments

@joelhellman
Copy link

Can I use this library to make a request to GET /api/v2/users/show_many.json?ids=1,2,3 and how?

@facetoe
Copy link
Owner

facetoe commented Mar 7, 2017

Can you tell me a bit more about what you are trying to achieve? If you just want to iterate over all users you can just call the users endpoint:

for user in zenpy_client.users():
    print user

Retrieving users by id can be done individually:

user = zenpy_client.users(id=19979184587)

If you only want to retrieve some subset of users by id in a single API call that is not currently implemented, although it is most likely not difficult to do.

@joelhellman
Copy link
Author

In this case, I had around data from an good data csv export around 80'000 user ids, that I wanted to match against user emails, since only user ids are present in data warehouse for PII reasons.

My options as I see it, is either exportering all the users from the Zendesk account using incremental export, then store them somewhere, and match against my list of user ids against this data set, or to make a number of calls to retrieve every single user directly (making it a one step process instead).

Since it was quite a few users, I thought I might use the show_many endpoint since it allows up to 100 users to be retrieved with each call. i.e. I would make 800 API requests instead of 80'000, which seemed like a good thing.

@facetoe facetoe changed the title How do I GET users/show_many? Support show_many for Users Mar 7, 2017
@facetoe
Copy link
Owner

facetoe commented Mar 7, 2017

Makes sense. The incremental endpoints return 1000 items per call which might work out fastest overall depending on how many users you have in your Zendesk.

In any case, I can look to implement this when I get the chance as it does seem like a handy feature.

@joelhellman
Copy link
Author

That would be great. I love this library, and actually got into python over the weekend just for this.
So, thanks :)

@facetoe
Copy link
Owner

facetoe commented Mar 7, 2017

No worries, glad you like it!

@facetoe facetoe added this to the Version 1.2 milestone Mar 20, 2017
@facetoe
Copy link
Owner

facetoe commented Apr 13, 2017

Hi @joelhellman, I just went to implement this and it turns out it is already implemented. You can access this functionality as follows:

for user in zenpy_client.users(ids=[21207616708, 21214060148]):
    print(user)

Sorry I should have done a but more investigation when you first opened the ticket!

@facetoe facetoe closed this as completed Apr 13, 2017
@joelhellman
Copy link
Author

joelhellman commented Apr 18, 2017

Excellent! Thanks for the update.

That's really useful, and I would love to see it added to the docs :)

@facetoe
Copy link
Owner

facetoe commented Apr 18, 2017

No worries, yes I'll add it to the docs.

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

No branches or pull requests

2 participants