Multi api request

Hello, How are you?
I am very happy to use twitch api.
I have some questions.
I am trying to get videos from multi game id
I have 5 game IDs
I am sending request with loop
but I can get only videos about 2 IDs
How to get videos about 5 IDs?

Assuming you are making 5 calls of the format

http://api.twitch.tv/helix/videos?game_id=GAMEID

And only 2 of those 5 calls returns videos then only those two game ID’s have videos available.

if so Can not I get all videos about 5 IDs?

The videos API will only return vidoes if there are vidoes for that game ID

The videos API only supports one game_id at a time as documented

It’s a tad unclear what you mean by “about 5 IDs”

when I get videos with each ID, it return videos
but when I send request with loop about 5 IDs, I can get videos about only 2 IDs.
rest IDs is canceled

Can you provide the call(s) you are making or the code you are using

$emptyArray = array();

    $curl = curl_init();

    foreach ($gameIds as $gameId) {

        curl_setopt_array($curl, array(

        CURLOPT_URL => "https://api.twitch.tv/helix/videos?first=5&game_id=".$gameId,

        CURLOPT_RETURNTRANSFER => true,

        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

        CURLOPT_HTTPGET => TRUE,

        CURLOPT_HTTPHEADER => array(

            'Content-Type: application/json',

            "Authorization: Bearer ".$auth,

            'Client-Id: '.$client_ID

        ),

        ));

        $response = curl_exec($curl);

        $emptyArray = array_merge($emptyArray, json_decode($response, true)['data']);

    }

    curl_close($curl);

This is curl command I am using now

If it doesn’t return 5 videos then there are not 5 vidoes available for that gameID

$gameIds has 5 Ids

I have checked about each Id on postman
it return correctly videos

Then if postman returns different results to your code, that would suggest postman is doing something else in comparison to your code

thanks. I will check again.
how much can I send api request with loop?

Rate limits are documented here

If you are using “postman web” it is probably “sending cookies” which will interfere with loading/data returns

Okay. thanks for your help

Hello
I have found one issue with “get videos” from game id
https://api.twitch.tv/helix/videos?game_id=33214&sort=time
I get “published_at”: null, about all video
is it sort by time?

I don’t see any publushed_at nulls in the link your provided. Whats the video ID with a null published at?

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