How to access to this response helix api

Hello,
Im trying to process the response of the helix api.
But Im so confuse at this moment so I want some help.

This is the respone I get: (removed personal information for privacy)

{"data":[{"id":"user-id","login":"u-login","display_name":"ds-name","type":"","broadcaster_type":"partner","description":"User-Descripton ","profile_image_url":"profile-url","offline_image_url":"offline-url","view_count":502504},{"id":"user-id","login":"u-login","display_name":"ds-name","type":"","broadcaster_type":"partner","description":"Eat. Sleep. Stream. Repeat. #KeepWinning","profile_image_url":"url-profile","offline_image_url":"off-url","view_count":106110}]}

Using a json online decode for good reading:

array (
  'data' => 
  array (
    0 => 
    array (
      'id' => 'user-id',
      'login' => 'u-login',
      'display_name' => 'ds-name',
      'type' => '',
      'broadcaster_type' => 'partner',
      'description' => 'User-Descripton ',
      'profile_image_url' => 'profile-url',
      'offline_image_url' => 'offline-url',
      'view_count' => 502504,
    ),
    1 => 
    array (
      'id' => 'user-id',
      'login' => 'u-login',
      'display_name' => 'ds-name',
      'type' => '',
      'broadcaster_type' => 'partner',
      'description' => 'Eat. Sleep. Stream. Repeat. #KeepWinning',
      'profile_image_url' => 'url-profile',
      'offline_image_url' => 'off-url',
      'view_count' => 106110,
    ),
  ),
)

I think I need to use some of $.each or for loop or while to get multiple data in one way of this response.

Thanks, Im new developing with the API and Im from Argentina, sorry if miss some words.

Your question is

How do I iterate the response in $language I am using

No idea, you didn’t say which language you are using.

But yes helix does return an array of response in the data so you could either iterate over each response, of if you have done a single user lookup, just look at the first response only

Hi, so sorry for not explain what language I use.

Im using PHP for the call and JS for the client side.

But Im confuse and 1 problem is if the streams is offline, no data send. So?
How can check values of that data to display if online or offline?

Helix doesn’t return data for offline streams you would have to use v5

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