Site
Home / Forum / Developers / V2 API Development

V2 API Development


Posted: 02 Mar 2020 08:36

zag
Posts: 1,558
Joined: Oct 2016

I'm currently working on V2 of the API, it will be totally new and much better than V1. Current plans




- Reduce API methods
- Livescore directly linking to events and teams
- Simplified naming
- More filter parameters for each method
- api-football stats
- better tables
- Event Status


Let me know if you have any comments or feature requests

Status: Alpha - everything may change!

Posted: 08 Mar 2020 09:19

zag
Posts: 1,558
Joined: Oct 2016

Any more ideas before I start on this?

New livescore API is going to be awesome

Posted: 09 Mar 2020 20:30

zag
Posts: 1,558
Joined: Oct 2016

Test Livescore should include Soccer, NBA, NHL, Golf and a few others at some point.

Livescore by Sport type
https://www.thesportsdb.com/api/v2/json/APIKEY/livescore.php?s=Soccer
https://www.thesportsdb.com/api/v2/json/APIKEY/livescore.php?s=Basketball
https://www.thesportsdb.com/api/v2/json/APIKEY/livescore.php?s=Ice_Hockey


Livescore by League ID
https://www.thesportsdb.com/api/v2/json/APIKEY/livescore.php?l=4328


Example returned as an event array:

"idLiveScore": "1893903",
"idEvent": "602410",
"strSport": "Soccer",
"idLeague": "4328",
"strLeague": "English Premier League",
"idHomeTeam": "133626",
"idAwayTeam": "133601",
"strHomeTeam": "Leicester",
"strAwayTeam": "Aston Villa",
"strHomeTeamBadge": "https://www.thesportsdb.com/images/media/team/badge/xtxwtu1448813356.png",
"strAwayTeamBadge": "https://www.thesportsdb.com/images/media/team/badge/aofmzk1565427581.png",
"intHomeScore": "0",
"intAwayScore": "0",
"strProgress": "22",
"strEventTime": "20:00:00",
"dateEvent": "2020-03-09",
"updated": "2020-03-09 20:26:22"


Posted: 06 Apr 2020 10:02

cydalby
Posts: 188
Joined: Mar 2019

Hi Zag,

Giving this a whirl now to explore, getting a 404, has it been rolled back?

Posted: 06 Apr 2020 13:34

zag
Posts: 1,558
Joined: Oct 2016

No you just need to use your API key I think, and the V2 URL above.

I don't think its much use without livescores though at the moment. Happy to accept feature requests though

Posted: 06 Apr 2020 13:50

cydalby
Posts: 188
Joined: Mar 2019

Was trying that but might just be the fact theres nothing on

Would be great to see api-football stats api being represented, some really interesting info on there

Posted: 16 Apr 2020 15:26

cydalby
Posts: 188
Joined: Mar 2019

Still 404ing

Should be Belarusian League Live now

https://thesportsdb.com/api/v2/json/my-a ... p?s=Soccer

Posted: 18 Apr 2020 19:25

cydalby
Posts: 188
Joined: Mar 2019

Just some musings from working with the new livescores api today.

Events immediately disappear when they go full time, it would be nice if these could be persisted for another 10 minutes or so, so that data can be captured. Not sure if this is in your control but just a thought.

Posted: 22 Apr 2020 23:16

cydalby
Posts: 188
Joined: Mar 2019

Again a minor one,

Event (679226) kicked off at midnight UK time on Wednesday night/Thursday morning but the live scores api stated kick off was at 11pm of the day before and kept overwriting my changes on this event

Posted: 26 Apr 2020 13:57

cydalby
Posts: 188
Joined: Mar 2019

Another update.

There seems to be no support for HT messages, events just go to 45 mins and stay there until the second half kicks off.

Not sure if it’s just the data from the Belarusian league or if that’s the way the data always is

Posted: 27 Apr 2020 15:35

sefi
Posts: 1
Joined: Apr 2020

Hey,

Let me know when V2 is ready, and I can update the GraphQL wrapper accordingly.

Posted: 16 May 2020 17:56

cydalby
Posts: 188
Joined: Mar 2019

Be great to have lineups from the v2 endpoint, hopefully including a formation (e.g 4-4-2)

Posted: 22 May 2020 10:58

chromeq
Posts: 8
Joined: May 2020

Do you have an ETA of other endpoints than livescore? And a list of endpoints for V2 ready for testing?
I'd be happy to try it out as there is quite a lot of things I can think of to improve the data and as I'm building my app I'm sure I'll find some gaps worth catering for

Posted: 22 May 2020 11:01

zag
Posts: 1,558
Joined: Oct 2016

Do you have an ETA of other endpoints than livescore? And a list of endpoints for V2 ready for testing?
I'd be happy to try it out as there is quite a lot of things I can think of to improve the data and as I'm building my app I'm sure I'll find some gaps worth catering for


No ETA but keep posting ideas and I will incorporate them. General rule is to make things simpler and more powerful.

Posted: 22 May 2020 11:19

chromeq
Posts: 8
Joined: May 2020

Simpler and more powerful is definitely sounding good.
I certainly have a few ideas, here are a few below:
1) The main thing I would suggest is to use a more RESTful API rather than using query strings, not sure if that works for the data and tech you have or even for all sports, but I'm mostly (read only!) interested in soccer.
2) The other thing is using more JavaScript-y properties on responses, since it is JSON then prepending stuff with `str`, `int`, `date` or even `id` seems very backend-y!
3) Can all dates be in a standard ISO format? Probably best in full UTC ISO, that will work for anyone using it anywhere in the world, at the moment I need to append strTime to dateEvent (which is a string).
4) Might be nice and make the data a bit more user friendly if "repeated data" can be shoved into an array. When I say repeated data, I mean an example like https://www.thesportsdb.com/api/v1/json ... r=1&s=1819 shows up to 3 strTweets, which is limiting to 3, and making end users check if any have any data rather than check the length. The same could be said for lineups, they should be an array rather than needing to do string manipulation to split on the semi colon and display them as necessary.

Again, sorry if this makes me sound very opinionated! I realise it might not be possible with your data sources or tech stack but I would love to contribute ideas or even dev time to make v2 amazing, it's a great opportunity to make really huge improvements

Posted: 22 May 2020 13:30

chromeq
Posts: 8
Joined: May 2020

Here are a couple more suggestions for v2:
Will there be better documentation and guaranteed schemas?
For example, I'm looking at https://www.thesportsdb.com/api/v1/json ... 328&s=1819 and I have no idea what strLocked means.
The schema seems to be a big issue, here are two Premier League games played on the same date at the same time: idEvent 602190 & 602191
https://www.diffchecker.com/r3J1XROG
As you can see there are the differences you'd expect, but also inconsistencies for `null` values and `""` empty string values:
strDescriptionEN
dateEventLocal
strResult
strTweet1
strTweet2
strTweet3


Also I see that every (the 200 under free API key) event there has `strPostponed: "no"`, which is hard to believe. Is that field and many of the others actually populated?
What does currently happen to postponed games? Do their dateEvent value get changed? I know it hard to tell at the moment cos of the lockdowns of leagues but a schema would help answer these questions and provide some self documentation.

Posted: 22 May 2020 21:23

zag
Posts: 1,558
Joined: Oct 2016

Thanks! A lot of this stuff is in my mind already and its great to have you point out these things and some new stuff.

Some is backend database work, others is fixing our editors and sport result importers but its all possible.

This is great feedback.

I will add a new category to Trello for the specific API V2 requests.

Posted: 24 May 2020 11:49

cydalby
Posts: 188
Joined: Mar 2019

Has the V2 endpoint gone down? Should be some live games currently but showing null

Posted: 24 May 2020 14:01

zag
Posts: 1,558
Joined: Oct 2016

Has the V2 endpoint gone down? Should be some live games currently but showing null

Thanks for the headsup, bug has been fixed with date format.

Posted: 24 May 2020 14:16

cydalby
Posts: 188
Joined: Mar 2019

Nice one, cheers

Posted: 27 May 2020 07:56

edenbarel
Posts: 5
Joined: Nov 2019

Hi,

it's great that now we can identify a game with it's idEvent, but V2 include fewer information then V1 (to be more specific - red and yellow cards given during the match and players that scored).
is there any chance to add that information to V2?

zag
Posted: 31 Jul 2020 14:58
cydalby
Posts: 335
Joined: 2020-06-16

Afternoon mate, with the ever exciting final rounds of the Champions/Europa league coming up, is there any chance we could expedite some of the new features on the V2 api? Really wanting to get them new shiny features from api-football!

Posted: 04 Aug 2020 20:39
cydalby
Posts: 335
Joined: 2020-06-16

Just noticed that the V2 live scores api returns strProgress: 0’ when the game went into extra time.

Is this expected?

-{
"idLiveScore": "3255486",
"idEvent": "1011911",
"strSport": "Soccer",
"idLeague": "4329",
"strLeague": "English League Championship",
"idHomeTeam": "134355",
"idAwayTeam": "133600",
"strHomeTeam": "Brentford",
"strAwayTeam": "Fulham",
"strHomeTeamBadge": "https://www.thesportsdb.com/images/media/team/badge/grv1aw1546453779.png",
"strAwayTeamBadge": "https://www.thesportsdb.com/images/media/team/badge/xwwvyt1448811086.png",
"intHomeScore": "0",
"intAwayScore": "0",
"strPlayer": null,
"idPlayer": null,
"intEventScore": null,
"intEventScoreTotal": null,
"strProgress": "0",
"strEventTime": "18:45:00",
"dateEvent": "2020-08-04",
"updated": "2020-08-04 21:38:21"
},

Posted: 04 Aug 2020 21:03

zag
Posts: 3,329
Joined: 2020-03-23

Yeh looks like I didnt account for ET, I will try to fix, just difficult unless a live match goes into extra time and I'm testing at the same time!!

I'll be doing some more work on V2 this summer. Lots needs improving.

Posted: 10 Aug 2020 19:20

zag
Posts: 3,329
Joined: 2020-03-23

I'll be looking at this again in the next few days, Keep the requests and feedback coming.

Latest todo is to add a "Event Status" field to show "In Progress", "Finished", "Extra Time" etc


Who is Online?

In total there are 68 users online :: 3 registered, 0 hidden and 65 guests (based on users active over the past 5 minutes) Most users ever online was 424 on Fri Nov 10, 2017 9:02 pm

About Us

Discussion forum for TheSportsDB.com site and related topics

Rules

- Be Polite
- Respect other users
- Always post log files with issues
- Try to be helpful
- No Piracy discussion

Showing 0 to 25 (Total: 45)