edalex
Posts: 79
Joined: Fri Mar 03, 2017 6:45 pm

API v1 Flaws

Sat Mar 11, 2017 12:47 pm

Hi.
Let's discuss what could be fixed/changed in current v1 API.
Empty fields in LiveScores items are not empty strings but empty json objects. Could it be fixed?
All lookups consist of list of items? Why not just one item?
Site has history for players. Is it available in API?
I missed list of sports and its thumbs in API so i have to use my local list in code:
{"Football","http://www.thesportsdb.com/images/sports/football.jpg"},
{"Basketball","http://www.thesportsdb.com/images/sports/basketball.jpg"},
{"Rugby","http://www.thesportsdb.com/images/sports/rugby.jpg"},
{"American Football","http://www.thesportsdb.com/images/sports/american_football.jpg"},
{"Motorsport","http://www.thesportsdb.com/images/sports/motorsport.jpg"},
{"Ice Hockey","http://www.thesportsdb.com/images/sports/ice_hockey.jpg"},
{"Fighting","http://www.thesportsdb.com/images/sports/fighting.jpg"},
{"Baseball","http://www.thesportsdb.com/images/sports/baseball.jpg"},
{"Golf","http://www.thesportsdb.com/images/sports/golf.jpg"},
{"Tennis","http://www.thesportsdb.com/images/sports/tennis.jpg"},
{"Cricket","http://www.thesportsdb.com/images/sports/cricket.jpg"},
{"Cycling","http://www.thesportsdb.com/images/sports/cycling.jpg"}
What about adding such construction in API? Yes, I saw list of leagues but I miss images anyway.
I wrote some thought on old forum and forgot them. :cry:
I hope to give some suggestions later.

User avatar
zag
Site Admin
Posts: 298
Joined: Tue Oct 11, 2016 9:43 am

Re: API v1 Flaws

Fri Mar 31, 2017 1:26 pm

Yep not forgotten about this, its on my list :)

edalex
Posts: 79
Joined: Fri Mar 03, 2017 6:45 pm

Re: API v1 Flaws

Sun Jan 07, 2018 7:23 pm

Some more words from me.
I don't know why API needs root objects since they useless in my opinion and they could mislead devs.
Look at this stat:

Code: Select all

search_all_leagues.php - "countrys" root element
all_leagues.php - "leagues" root element

Code: Select all

lookup_all_players.php - "player" root element
lookupplayer.php - "players" root element

Code: Select all

eventsnext.php, eventsnextleague.php, lookupevent.php, eventspastleague.php - "events" root element
eventslast.php - "results" root element
searchevents.php, searchfilename.php - "event" root element

Also I need Alternate leagues names in allleagues.php or even maybe search by league name including alternate names.
And it will be cool to search events by "Arsenal_vs_Chelsea" where Arsenal both home and away team and the same for Chelsea.

User avatar
zag
Site Admin
Posts: 298
Joined: Tue Oct 11, 2016 9:43 am

Re: API v1 Flaws

Wed Jan 10, 2018 3:00 pm

Must have forgotten this again :)

- I've added alternate league names to all_leagues.php
- New API method http://www.thesportsdb.com/api/v1/json/1/all_sports.php

I agree with the other stuff, but some are breaking changes so will have to wait for v2 of the api.

I will also look into the events home and away, that should be possible without breaking things.

edalex
Posts: 79
Joined: Fri Mar 03, 2017 6:45 pm

Re: API v1 Flaws

Wed Jan 10, 2018 8:31 pm


Awesome :)
zag wrote:- I've added alternate league names to all_leagues.php

Awesome :) I've already added alt name for English Premier League :roll:
I will dream about full-text search by all names (incl. main and alternates) in future but for now I'll think of making search on client side. :?
zag wrote:I will also look into the events home and away, that should be possible without breaking things.

Awesome, thanks :)
zag wrote:I agree with the other stuff, but some are breaking changes so will have to wait for v2 of the api.

Yeah, no problem. Those cosmetic changes will make my code for API implementation cleaner and it will remove some almost duplicate classes.

edalex
Posts: 79
Joined: Fri Mar 03, 2017 6:45 pm

Re: API v1 Flaws

Sun Jan 28, 2018 10:35 am

zag wrote:Must have forgotten this again :)
- New API method http://www.thesportsdb.com/api/v1/json/1/all_sports.php

Hi, zag, little comment after using this method. European football is "Football" here but "Soccer" everywhere else. So if I choose sport "Football" and the trying to search leagues by sport name I'm getting exception/null.
Also, I saw that if search team by name and search didn't return results I'm getting {"teams":null}. I think it will be better to return empty array instead smth like {"teams":[]}

edalex
Posts: 79
Joined: Fri Mar 03, 2017 6:45 pm

Re: API v1 Flaws

Tue Jan 30, 2018 10:16 pm

On the other hand, search methods return list of data with empty params.
Is it expected behaviour? :oops:

edalex
Posts: 79
Joined: Fri Mar 03, 2017 6:45 pm

Re: API v1 Flaws

Wed Jan 31, 2018 8:44 pm

I will be dropping some thought here for time to time ;)
Event.strTime doesn't have single format I suppose

User avatar
zag
Site Admin
Posts: 298
Joined: Tue Oct 11, 2016 9:43 am

Re: API v1 Flaws

Fri Feb 02, 2018 4:29 pm

Nope, sadly the time zones are messed up all over the place. Its hard because many sources use different timing formats.

edalex
Posts: 79
Joined: Fri Mar 03, 2017 6:45 pm

Re: API v1 Flaws

Fri Feb 02, 2018 5:21 pm

edalex wrote:
zag wrote:Must have forgotten this again :)
- New API method http://www.thesportsdb.com/api/v1/json/1/all_sports.php

Hi, zag, little comment after using this method. European football is "Football" here but "Soccer" everywhere else. So if I choose sport "Football" and the trying to search leagues by sport name I'm getting exception/null.
Also, I saw that if search team by name and search didn't return results I'm getting {"teams":null}. I think it will be better to return empty array instead smth like {"teams":[]}

Along with Football - Soccer problem all_sports.php has http:// in urls. So If I add http:// to images I could download all artwork except these. If I don't add http:// I could download only sports thumbs. Should I additional check for url or all urls will be of the same ormat?
thx

Return to “Developers”