Closed mavrick closed 3 years ago
It's still in beta...
Spoilers: not everything is part of Kraken or is beta and is subject to change from Twitch without notice.
Here's what I know from testing:
These will return with a 400 - Bad Request JSON reply if you try to send a user to authenticate with them.
{
"error": "Bad Request",
"status": 400,
"message": "Invalid scope requested: user_friends_read"
}
URL: https://api.twitch.tv/kraken/users/:user/friends
Method: GET
Authenticated: true
Options:
Schema:
{
_total: <int>,
_cursor: <'timestamp in ns'>,
_links: {
self: <'url'>,
next: <'url'>
},
friends: [
{
created_at: <'friendship date'>
user: <User object>
}
]
}
URL: https://api.twitch.tv/kraken/users/:user/friends/:target
Method: GET
Authenticated: true
Schema:
{
friends: <boolean>,
status: <'sent_request' | 'friends' | 'no_relation' | etc>,
user: <User object>
}
404 - No request | "
URL: https://api.twitch.tv/kraken/users/:user/friends/:target
Method: PUT
Authenticated: true
Schema: Success: 204 - No content
URL: https://api.twitch.tv/kraken/users/:user/friends/:target
Method: DELETE
Authenticated: true
Schema: Success: 204 - No content
URL: https://api.twitch.tv/kraken/users/:user/friends/requests
Method: GET
Authenticated: true
Options:
Schema:
{
_total: <int>,
_cursor: <'timestamp in microseconds'>,
_links: {
self: <'url'>,
next: <'url'>
},
requests: [
{
is_recommended: <boolean>
is_stranger: <boolean>
non_stranger_reason: <'mod' | null | etc>
requested_at: <'timestamp'>,
user: <User object>
}
]
}
URL: https://api.twitch.tv/kraken/users/:user/friends/notifications
Method: GET
Authenticated: true
Schema:
{
count: <int>
}
URL: https://api.twitch.tv/kraken/users/:user/friends/notifications
Method: DELETE
Authenticated: true
Schema:
Success: 204 - No content
URL: https://api.twitch.tv/kraken/users/:user/friends/recommended
Method: GET
Authentication: true
Schema:
{
recommended: [
{
user: <User object>
}
]
}
URL: https://api.twitch.tv/kraken/users/:user/friends/recommended/:target
Method: DELETE
Authentication: true
Schema:
204 No Content
Also useful to change an ID into a username instead of the hosts API.
URL: https://api.twitch.tv/api/friendships/users?ids=list,of,user,ids
Method: GET
Authenticated: false
Schema:
{
users: [
{
id: <int>,
display_name: <'Username'>,
login: <'username'>,
logo: <'url'>,
bio: <'user bio'>,
profile_banner: <'url'>,
profile_banner_background_color: <'#hexcolor'>
}
]
}
URL: https://presence.twitch.tv/v1/friends
Method: GET
Authenticated: true
Schema:
{
data: [
{
availability: <'online' | 'offline' | 'idle'>
index: <int>
timestamp: <int in seconds>
user_id: <int>
}
]
}
Ask and you shall receive @Fugiman ;)
Thanks @AlcaDesign
@AlcaDesign - Great info,
Can you describe the behavior required to get a User:Target friend relationship? Do you just need one at least one valid oauth token? (And make the comparison where the user is compared to the token you have?)
Can you also validate that the list of friends is intended to work without an oauth token? That seems like a bug, unless you're intending to have the list of friends comparison be public.
Example: I would expect this url to give 401 if I don't have a token, rather than a generic channel info https://api.twitch.tv/api/friendships/users?ids=29795919,31723226 (Users are for nl_kripp and cobaltstreak)
@TournyMasterBotCurse I only looked at the network tab in the developers tools to get this data. I don't work for Twitch in any capacity, so anything I know comes from basic testing using the token that Twitch made and cached to my session/cookies or whatever.
Get the token:
And then test the token: https://api.twitch.tv/kraken?oauth_token= token
@AlcaDesign My mistake, good info none-the-less!
fyi this seems to not work at all anymore. In fact, if you do an oauth request with those scopes your oauth attemp fails with invalid scope.
Any ETA lads?
Cheers,
Mav