Why type of channel_id is different? (sometimes has quotation mark)

Hello~
I used twitch api v5.
Why “_id” sometimes is string type (has quotation marks), sometimes is number type.

Would it be unified?


Example:

Get Live Streams by Channel ID
https://api.twitch.tv/kraken/streams/?channel=123456
{
“_total”: 1,
“streams”: [{
“_id”: 987654321,
“game”: “League of Legends”,
“community_id”: “”,
“viewers”: 6932,
“video_height”: 720,
“average_fps”: 30.0123762376,
“delay”: 0,
“created_at”: “2017-03-12T06:49:31Z”,
“is_playlist”: false,
“preview”: {…},
“channel”: {
“mature”: false,
“status”: “”,
“broadcaster_language”: “zh”,
“display_name”: “AAA”,
“game”: “League of Legends”,
“language”: “zh-tw”,
“_id”: 123456,
“name”: “aaa”,
“created_at”: “2012-04-12T06:14:31Z”,
“updated_at”: “2017-03-12T07:34:11Z”,
“partner”: true,
“logo”: “”,
“video_banner”: “”,
“profile_banner”: null,
“profile_banner_background_color”: null,
“url”: “”,
“views”: 6012093,
“followers”: 88559
}
}
]
}
streams.channel._id is number.


Get Channel by ID
https://api.twitch.tv/kraken/channels/123456

{
“mature”: false,
“status”: “”,
“broadcaster_language”: “zh”,
“display_name”: “AAA”,
“game”: “League of Legends”,
“language”: “zh-tw”,
“name”: “aaa”,
“created_at”: “2012-04-12T06:14:31Z”,
“updated_at”: “2017-03-12T07:34:11Z”,
“_id”: “123456”,
“logo”: “”,
“video_banner”: “”,
“profile_banner”: null,
“profile_banner_background_color”: null,
“partner”: true,
“url”: “”,
“views”: 6012093,
“followers”: 88559
}
_id is string (has quotation mark)


thank you.

_id should always be considered as a string. It used to be an int, so you can see a few old APIs still using integers.

1 Like

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