twitchdev / issues

Issue tracker for third party developers.
Apache License 2.0
73 stars 6 forks source link

Get Channel Teams: Null instead of [] if no teams #495

Open BarryCarlyon opened 3 years ago

BarryCarlyon commented 3 years ago

Brief description

https://dev.twitch.tv/docs/api/reference#get-channel-teams

if a channel is not in any teams, the API responds

{"data":null}

Instead of

{"data":[]}

How to reproduce

Call Get Channel teams for a channel that is in no teams

Expected behavior

Empty array instead of null

Emilgardis commented 1 year ago

The docs says that 404 should be returned when "The broadcaster is not a member of a team."

image
BarryCarlyon commented 1 year ago

Then the documentation is wrong. as currently this bug is fixed and the result is

twitch api get 'teams/channel?broadcaster_id=56410307'
{
  "data": []
}
Emilgardis commented 1 year ago

I get null when using a real call and not twitch-cli

Emilgardis commented 1 year ago
❯ twitch api get teams/channel -q broadcaster_id=1234
{
  "data": []
}
image

I think twitch-cli is normalizing it

BarryCarlyon commented 1 year ago

Ok so why did you add a comment suggest the issue was fixed but the docs say 404? Since all it did was add confusion.

You'll need a seperate issue to file a documentation bug

Emilgardis commented 1 year ago

The comment was to the expected behaviour in this issue. The docs says 404, your expected result is an empty array (which is my prefered behaviour aswell) and the actual behaviour is null.

talk2MeGooseman commented 1 year ago

The bug is still active instead of an empty array receiving the following:

curl 'https://api.twitch.tv/helix/teams/channel?broadcaster_id=120750024'

{"data":null}

I believe this bug has been triggered by a person who is part of a team(s) being banned, and their account is reinstated.

Xemdo commented 1 year ago

Tested it with a bunch of recently banned accounts, and again with 120750024. Can't reproduce the null value. However the empty array still happens:

> twitch api get teams/channel -q broadcaster_id=57047445
{
  "data": []
}

And I found another bug where it returns HTTP 500 instead of 404 if the user cannot be found. Will open that up as another ticket.

Xemdo commented 1 year ago

Actually, it seems it showing the empty array is purely from the Twitch CLI. Running it with curl shows a null value, even for accounts that aren't banned (such as mine).

Ticketed internally as ASYNC-3967