Clips returns no data?

I’m not sure what I’m missing here. My goal is get a random clip by specific user. Data returned is NULL or more specifically:

string(27) "{"data":[],"pagination":{}}"

Here’s my code (with CLIENT_ID and ID replaced):

$ch = curl_init('https://api.twitch.tv/helix/clips?broadcaster_id=ID');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Client-ID: CLIENT_ID',
    'Authorization: Bearer '.$autharr->access_token
));
$r = curl_exec($ch);
$i = curl_getinfo($ch);
curl_close($ch);

if ($i['http_code'] == 200) {
    $data = json_decode($r);
    if (json_last_error() == JSON_ERROR_NONE) {
        var_dump($r);

    } else echo 'Failed with ' . $r;

} else echo 'Failed with ' . $r;

I get the same no data with other examples as well.

Not sure what the problem is here.

Looks like the broadcaster_id you looked up has no clips thus you got no clips

That gave me answer actually. I was assuming “broadcaster_id” was a username rather than another id.

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