Embedding Stream

Hi all.

Any recommendations for how to retrieve channel names (or usernames) by user_id?
I’ve got user_ids returning just fine from the API (by way of a jQuery ajax function) but that’s not useful for dynamically embedding a twitch stream. It looks like I’ll need the channel name, collection id or video id–none of which are returned in the JSON.

My ajax call looks like this:

$.ajax({
type: ‘GET’,
url: ‘https://api.twitch.tv/helix/streams?game=fortnite&limit=100’,
headers: {‘Client-ID’: ‘XXXXXXX’},
success: function(data) {
console.log(data);
}});

Thanks for any feedback.

User ID to Name: https://api.twitch.tv/helix/users?id=39383020 (Reference)

{
"data": [
{
"id": "39383020",
"login": "ironx011979",
"display_name": "ironx011979",
"type": "",
"broadcaster_type": "",
"description": "",
"profile_image_url": "https://static-cdn.jtvnw.net/user-default-pictures/4cbf10f1-bb9f-4f57-90e1-15bf06cfe6f5-profile_image-300x300.jpg",
"offline_image_url": "",
"view_count": 0
}
]
}

Game ID to Name: https://api.twitch.tv/helix/games?id=493057 (Reference)

{
"data": [
{
"id": "493057",
"name": "PLAYERUNKNOWN'S BATTLEGROUNDS",
"box_art_url": "https://static-cdn.jtvnw.net/ttv-boxart/PLAYERUNKNOWN%27S%20BATTLEGROUNDS-{width}x{height}.jpg"
}
]
}

Thanks George.
We actually just figured that out.
We were making a silly syntax error but we’ve got it sorted out now.
I was worried it wasn’t really do-able but I was clearly mistaken.

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