Is it possible to find another user’s user ID? I need it to set up a bot for discord to notify everyone when a specific streamer goes live. If not, how would it be possible for me to set that up?
If you have the target user’s login/username, you can request their user id with this endpoint:
GET https://api.twitch.tv/helix/users?login=<username>
Include the Client ID
for your application in the header, no other authorization is needed.
thank you. I’m quite new to messing with this stuff though, where do I input that?
No problem! You need to send an HTTP Request
from your application (the one whose Client ID
you provide in the request header).
For testing, you could use Postman to send the request manually, refer to their docs to learn how.
Otherwise, for sending requests from the application itself, refer to the documentation for any HTTP Client
API which you’ll use in your application. For example, in JavaScript, you might use XHR, Fetch, or a library like Axios. Within those docs, look for info related to “sending requests” and “setting request headers”.
Does the new Helix API have a method to get user information when we don’t have an ID or username? In Kraken we could call getUsers with the OAuth token, but the Helix API doesn’t seem to like when it has no User ID or Name.
No such endpoint is currently documented for Helix: https://dev.twitch.tv/docs/api/reference.
Twitch API v5 is deprecated and will be removed on 12/31/18. The new Twitch API is live and we are actively adding new functionality to it. (source)
Expect that Helix will receive an endpoint to replace getUsers
, but for now it is still appropriate to use Kraken.
edit: see post below
/helix/users
with a valid oauth token will return the user the token belongs to.
If neither a user ID nor a login name is specified, the user is looked up by Bearer token.
I wonder what I have been doing wrong then, I couldn’t get a reply until after I added an ID.
I was using Bearer with the the users accesstoken and my client ID. I guess I will give it another go.
So I downloaded that postman app and tried what you said, I just get an error 401. What might I be doing wrong?
You haven’t set the appropriate Request Header
, in this case, that’s either Client-Id
or an OAuth Token. You obtain a Client Id
when you register an app.
In Postman’s interface, there’s a tab below the url field labeled “Headers”. There you can set key-value pairs for each Header, namely Client-Id
.
thanks! I managed to get the code I needed.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.