Retrieving multiple users in one request

Hey,

I know you can check multiple stream statuses by doing this request:

https://api.twitch.tv/kraken/streams?channel=first_channel,second_channel,...

I was just wondering if there was a similar request format for the users endpoint? I am not looking for stream status, but I would like the Twitch ID and display name for multiple users in one request - perhaps something like this?

https://api.twitch.tv/kraken/users?user=first_user,second_user,...

I’m aware a previous topic was done about this issue however I would like to know if this could be implemented, which was not discussed in the previous topic.

What’s the use case for multiple users on a single call? Interested to hear the application.

Hey @DallasNChains, Thanks for answering!

I’m developing a bot for a channel which awards points to users for watching streams (essentially a channel currency if you like). The bot updates a database which is also connected to a website where users can check their currency and buy items in a store.

For most users, they’ve already talked in the channel so I have been able to pick up their Twitch ID and display name from the IRC messages and save that into the DB.

However there are some users who have not yet talked / don’t want to talk and so I have to retrieve their ID and display name from the Kraken API. For busy streams with around 3k viewers, there could be anywhere around 10 - 50 users which I have to make individual calls for, to then save that in the DB.

I would only have to make this call once for those users as the details are then stored in the DB but I was just wondering if there was a grouped call for it. Could alleviate load on your end and also reduce the number of requests on my end.

Thanks.

There isn’t a grouped call for this. We all 1 request/second at this juncture, so you should be OK. If not, you’ll get an email from me. :wink:

I do have a question about general design of your point bot. What is the reasoning behind storing if they haven’t interacted? How do they get to your points site? It may not be worth it to store their info. Also, please make sure you read our developer agreement about data storage. There are restrictions.

That’s no problem about the call. I’ve decided in the end to not award points to users who haven’t yet interacted as it would be unfair on users who do interact, so I won’t be needing this anymore.

The reasoning was to store points for users who have joined the chat for the first time and have not yet interacted - would be convenient for them when they first interact to see that their points have added up. The points site will be one where they can Log in via Twitch connect and then shows them their points.

The bot only stores their Twitch ID, username and Display Name. If there is a restrictions problem then please do let me know.

Thanks anyway!

Quick question on that 1 request per second thing. Say we have 500 users using the site at once. Now let’s say 50 of them login at once. That is going to pull their username, info and such. Isn’t just authing them going to go over the limit?

(They are logging into the site and holding the session using Twitch. On each page call it checks using an encrypted version of their key stored in the cookie to make sure the Twitch account is still good and matches some user information to make sure the session is valid. The only way to ensure that the userid in the cookie is the actual user, is to un-encrypt the access key in the cookie with a public key, and a private key + salt connected to that user by pushing it through the Twitch API. This means each page call will be a ping at Twtich.)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.