How to optimize number of API calls in v2? |
| Posted: 16 Aug 2025 21:09 | |||
Posts: 19 Joined: 2025 | Hey there! I was wondering if there was any way to include the full events details in the https://www.thesportsdb.com/api/v2/json/schedule/previous/team/ {id} and other similar APIs? With a single request in v1, I got the previous 5 matches with league data, video highlights etc. In v2 I'm up to 6 requests to achieve the same results (1 to list the events, and 1 more per event). On a semi-related note, are there any benefits to the "small business" license, VS the "single developer one", besides the increased rate limit from 100 to 120 requests per minute? Any help much appreciated! | ||
![]() | |||
| Posted: 16 Aug 2025 21:24 | |||
zag Posts: 3,848 Joined: 2020 | Yeh this is the downside of V2 being very fast and low data. I didn't realize it would need 6 calls though, that doesn't sound right. Can you let me know the API calls you are making? | ||
![]() | |||
| Posted: 17 Aug 2025 07:32 | |||
Posts: 19 Joined: 2025 | Sure, let's say I want to know the recent results of a team. - Request 1: https://www.thesportsdb.com/api/v2/json/schedule/previous/team/133604 => Gives me home and away team, scores, datetime, venue. - Request 2-6: Get event details for idLeague/strLeague + strVideo https://www.thesportsdb.com/api/v2/json/lookup/event/2290379 https://www.thesportsdb.com/api/v2/json/lookup/event/2290369 https://www.thesportsdb.com/api/v2/json/lookup/event/2250034 https://www.thesportsdb.com/api/v2/json/lookup/event/2250031 https://www.thesportsdb.com/api/v2/json/lookup/event/2250029 In my complete use case, I'm interested in upcoming events as well, so I'm calling https://www.thesportsdb.com/api/v2/json/schedule/next/team/133604 + each event as well to get idLeague/strLeague (total 6 requests again) Finally, I'm calling https://www.thesportsdb.com/api/v2/json/lookup/event_tv/2267081 for the closest upcoming event to get TV stations. Worst case scenario (starting cold, no data pre-loaded on my server), we're looking at 13 requests to get all the info I need about a single team. If I were able to get 10 previous/next events instead of 5, as discussed on https://www.thesportsdb.com/forum_topic.php?t=6059, that would be 23 requests. For 1000 teams it represents a bit less than 4 hours, accounting for the 100/minute rate limit. If I had idLeague/strLeague + strVideo in the result of https://www.thesportsdb.com/api/v2/json/schedule/previous/team/133604 and https://www.thesportsdb.com/api/v2/json/schedule/next/team/133604, I wouldn't have to call individual /lookup/event APIs, so I would be back to max 3 requests per team (previous events, next events, event_tv) Thanks for the quick answer | ||
![]() | |||
| Posted: 19 Aug 2025 10:06 | |||
zag Posts: 3,848 Joined: 2020 | idLeague, strLeague and strVideo all added to the schedule data returned in V2 . Great feedback thanks! | ||
![]() | |||
| Posted: 19 Aug 2025 18:55 | |||
Posts: 19 Joined: 2025 | Awesome, thanks a lot! | ||
![]() |