api-sports / public-roadmap

82 stars 5 forks source link

Team fixtures without using season #363

Open isfzade opened 4 months ago

isfzade commented 4 months ago

It is common UX practice in football apps to get fixtures of the team when clicking the the team name. When I want to request fixtures of the team v3.football.api-sports.io/fixtures?team=3453&timezone=Asia/Baku I get:

{
    "get": "fixtures",
    "parameters": {
        "team": "3453",
        "timezone": "Asia/Baku"
    },
    "errors": {
        "season": "The Season field is required."
    },
    "results": 0,
    "paging": {
        "current": 1,
        "total": 1
    },
    "response": []
}

It is not logical to require season for the team fixtures because one team may play in multiple seasons. I know that it is possible to get seasons of the team but in order to show the fixtures I need to make 3-4 request and process them. This will slow down the frontend system. Therefore would like to ask to remove mandatory season field when team id presents in fixtures requests.

dahLucky commented 2 months ago

You may want to clarify your feature request. If you suggest retrieving only future fixtures for a given team or league irrespective of the season a future_fixture endpoint - which indeed - would make things easier might be something they'd be willing to implement.

However, if you want to retrieve past and future fixtures, I do think requiring a season field is reasonable and they may not want to change this.

To improve your UX you may want to consider some backend pre-processing /caching (which is anyway a good idea in order to reduce API cost).

If you really only want to do front end processing how about parallelising your async requests e.g. https://rxjs.dev/api/index/function/forkJoin