Subscriptions returns null

Hi, anyone know why this returns null? I’ve removed all ID’s for security.

$clientID = "<id>";
$url = "https://api.twitch.tv/kraken/channels/<id>/subscriptions";

$headers = [
    "Client-ID: " . $clientID,
    'Accept: ' . 'application/vnd.twitchtv.v5+json',
    'Authorization: ' . 'OAuth <authkey>'
];

$data = Self::file_get_contents_curl($url, $headers);
$json_array = json_decode($data, true);

return json_encode($json_array);

Whats the HTTP code returned? Check the HTTP code for non 200’s and parse the error from the body response.

Is the <authkey> you used actually valid for the channel of <id> you used in the URL?

In your code you have clientID as <id> and the channelID as <id> in the URL, did you try to use the ClientID in the URL?

Thanks, i didn’t realize that i was using different oAuth key… Stupid me.

For clarity for completeness:

For that end point you will need an oAuth for the channel in the URL with the channel_subscriptions scope

What is the equivalent of this in the Helix api ?

There isn’t one yet. Helix is still under development. A subscriptions endpoint is on their roadmap https://blog.twitch.tv/twitch-api-summer-2018-roadmap-update-6036065f0098 so should hopefully be implemented some time this year.

1 Like

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