Teams endpoint is broken

Hi,

The teams endpoint is broken on both v3 and v5 versions. Try the following 2 requests:
https://api.twitch.tv/kraken/teams?offset=8&limit=1&api_version=5
https://api.twitch.tv/kraken/teams?offset=3013&limit=1&api_version=5

This returns the same team twice.

  • How do we know how many teams there are?
  • How can we be sure to get all teams if this endpoint returns duplicates?
  • How can we be sure to get all teams if this endpoint returns them in a random order?

Thanks

It might have to do with the offset. Endpoints are developed by different teams and they behave differently when the offset would either overflow, go above some apparent maximum value, or result in an out of bounds in the response.

As to why you are getting the same team twice, I’m not sure. I tried the same request and I got two different teams:

https://api.twitch.tv/kraken/teams?offset=8&limit=1&api_version=5&client_id=X

{
    "teams": [
        {
            "_id": 14,
            "name": "crosscountertv",
            "info": "Cross Counter TV",
            "display_name": "CrossCounterTV",
            "created_at": "2011-10-31T23:08:52Z",
            "updated_at": "2013-05-24T00:17:10Z",
            "logo": null,
            "banner": null,
            "background": null
        }
    ]
}

https://api.twitch.tv/kraken/teams?offset=3013&limit=1&api_version=5&client_id=X

{
    "teams": [
        {
            "_id": 920,
            "name": "zephyr",
            "info": "\n",
            "display_name": "Zephyr Dota",
            "created_at": "2014-01-04T00:41:19Z",
            "updated_at": "2014-01-04T00:41:19Z",
            "logo": null,
            "banner": null,
            "background": null
        }
    ]
}

Unfortunately, without having a reliable way to page through the teams with a cursor or without a total field and with offset being very finicky, I cannot think of a good way to reliably get all unique teams.

It should be caused by some kind of caching, but at the time it returned the same twice (with id 14).

I guess until they get their shit together we’ll just have to continue hammering the endpoint.

@Ribesg I’d be curious if you can reproduce this. I get the same results as @Six.

For this particular endpoint (and many others across our API), you simply poll the API until you get an empty object back. I hit that at offset 3093 for /teams/.

@DallasNChains yes you get an expected amount of results, but how many distinct teams do you get?

At the time, when I wrote the post, we only got ~2500 teams (around 3100 results with a lot of duplicates).
The links I provided pointed to the first occurence of a team and the last one. As the API seem to return then in an order both random and changing, you obviously can’t reproduce.

Here’s something you can 100% reproduce: get all teams, 100 by 100, then count the amount of distinct teams you have. Right now you should get 3092 objects representing only 2512 teams; and this does not mean there are only 2512 teams, this means we missed 580 teams entirely. Trying this again a few hours later, the order will be different, and the ~2500 teams it will return will be slightly different, but there are teams that we know exists which were never returned by this endpoint (yet).

This problem has already been reported and ignored here.

1 Like

@Ribesg I have had this issue for a while now. The random output order and the duplicates can ultimately be dealt with, but the fact that “many” teams are never returned, as I mentioned in the post you just linked, is indeed a bit more frustrating.

I’m sure @DallasNChains will come up with a solution!

Up @DallasNChains

Up @DallasNChains

Up @DallasNChains

Hey @DallasNChains, will you finally answer this at some point?

@Ribesg Just to set expectations, I changed roles inside the company, so my presence is pretty light around here. We’re hiring my backfill, but it’ll be a bit. I’ve poked a few folks about this endpoint, but the ownership of the endpoint is in flux. I’ll update when I can.

1 Like

Thanks for the explanation, I’ll try to keep this post up (without pinging you). It would be nice to have a public issue tracker instead of having to up a post here to prevent it from autoclosing.

The autoclosing after a month is a problem when people able to answer are not available.

2 Likes

Bump

Bump

Bump

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