API Tutorial |
Posted: 23 Jan 2017 15:02 | |||
zag Posts: 3,515 Joined: 2020 | Below find complete instructions for using our JSON API. All example links use the test key which should only be used during development or for personal apps. You can request a production API key by clicking this link and Add-on section for a bit of publicity. API v1 status = Please see this link: https://www.thesportsdb.com/api.php | ||
Posted: 03 Feb 2017 12:28 | |||
zag Posts: 3,515 Joined: 2020 | [color=#008000:2obp302i][size=150:2obp302i]Lookups Moved to: https://www.thesportsdb.com/api.php | ||
Posted: 03 Feb 2017 12:29 | |||
zag Posts: 3,515 Joined: 2020 | [color=#008000:74c8kr4s][size=150:74c8kr4s]Schedules Moved to: https://www.thesportsdb.com/api.php | ||
Posted: 03 Feb 2017 12:29 | |||
zag Posts: 3,515 Joined: 2020 | [color=#008000:f07jspa9][size=150:f07jspa9]Preview Images Most of the time you won't want to download the original large image, just get a small preview. This is possible simple by adding "/preview" onto the end URL. This will give you a small 200px version. This will work with JPG images only. Original Image - https://www.thesportsdb.com/images/medi ... 853005.jpg Small Image - https://www.thesportsdb.com/images/medi ... pg/preview | ||
Posted: 03 Feb 2017 12:29 | |||
zag Posts: 3,515 Joined: 2020 | [color=#008000:uwkfa5ql][size=150:uwkfa5ql]Soccer Livescores https://www.thesportsdb.com/api/v1/json ... soccer.php NOTE: Updated every 2mins (Don't abuse please) | ||
Posted: 04 Mar 2019 15:18 | |||
zag Posts: 3,515 Joined: 2020 | [quote="zag":71f8gnnx][color=#008000:71f8gnnx][size=150:71f8gnnx]Soccer Livescores Hello, thanks for everything. I want to say, actually live score not updated 2 mins interval. Mostly take 15-25 minutes. | ||
Posted: 04 Mar 2019 22:00 | |||
zag Posts: 3,515 Joined: 2020 | Hmm that's not right, i will check. Maybe our source has issues. EDIT: Looks like we have huge demand on that API method which isn't surprising as its one of the only free ones on the internet. I think I will make it faster for Patreon subscribers as we cant sustain such huge traffic for a free site. i will have a look for some ideas. | ||
Posted: 13 Apr 2019 12:08 | |||
zag Posts: 3,515 Joined: 2020 | Can you give me what data cast type used for livescores items?. I use String but many got error when i tried parse it with GSON Many error like : com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 3218 path $.teams.Match[2].HomeGoalDetails I look at the result from postman only give HomeGoalDetails {} | ||
Posted: 13 Apr 2019 16:56 | |||
zag Posts: 3,515 Joined: 2020 | I'm guessing you just need to check for NULL data. | ||
Posted: 14 Apr 2019 11:48 | |||
zag Posts: 3,515 Joined: 2020 | I dont think so.... I dont understand with API response for fields in Object "Match" not consistent..... Example for field "AwayGoalDetails".. Sometime response tile String sometime Object .. This produce error for my script My Postman Example:
| ||
Posted: 15 Apr 2019 13:31 | |||
zag Posts: 3,515 Joined: 2020 | Do you have some idea what it should return? | ||
Posted: 15 Apr 2019 14:42 | |||
zag Posts: 3,515 Joined: 2020 | At least When empty or not have an same data type like string.... | ||
Posted: 28 Apr 2019 12:09 | |||
zag Posts: 3,515 Joined: 2020 | Hello!! Please help I use this type of cast API data from server to get livescore: @Parcelize data class LiveMatchItem ( val Date : String? = null, val League : String? = null, val Round : String? = null, val HomeTeam : String? = null, val HomeTeam_Id : Int? = null, val AwayTeam : String? = null, val AwayTeam_Id: Int? = null, val Time : String? = null, val HomeGoals : Int? = null, val AwayGoals : Int? = null, val HomeGoalDetails : String? = null, val AwayGoalDetails : String? = null, val HomeLineupGoalkeeper : String = null, val AwayLineupGoalkeeper : String = null, val HomeLineupDefense : String = null, val AwayLineupDefense : String = null, val HomeLineupMidfield : String = null, val AwayLineupMidfield : String = null, val HomeLineupForward : String = null, val AwayLineupForward : String = null, val HomeLineupSubstitutes : String = null, val AwayLineupSubstitutes : String = null, val HomeSubDetails : String = null, val AwaySubDetails : String = null, val Location : String? = null, val Stadium : String? = null, val HomeTeamYellowCardDetails : String = null, val AwayTeamYellowCardDetails : String = null, val HomeTeamRedCardDetails : HomeTeamRedCardDetails, val AwayTeamRedCardDetails : AwayTeamRedCardDetails, val HasBeenRescheduled : Boolean? = null ): Parcelable If the data not NULL/Empty this is no problem but when data is empty/null generate error in my program because the type of null field/data in array is an OBJECT ( {} ) not a STRING anymore!!! Why you not use NULL in value ???? This sample from postman: { "teams": { "Match": [ { "Date": "2019-04-28T07:30:00+00:00", "League": "Chinese Super League", "Round": "7", "HomeTeam": "Tianjin Teda", "HomeTeam_Id": "134646", "AwayTeam": "Shanghai East Asia FC", "AwayTeam_Id": "134640", "Time": "Finished", "HomeGoals": "0", "AwayGoals": "2", "HomeGoalDetails": "22':Andres Vombergar;52':Ondrej Vanek;79':Sylvester Igboun;90':Sylvester Igboun;", "AwayGoalDetails": "16':Eric Cosmin Bicfalvi;", "HomeLineupGoalkeeper": "Aleksandr Belenov; ", "AwayLineupGoalkeeper": "Yaroslav Godzur; ", "HomeLineupDefense": "Ionut Nedelcearu; Alexey Nikitin; Danil Krugovoy; ", "AwayLineupDefense": "Denys Kulakov; Varazdat Haroyan; Sergei Bryzgalov; Mikhail Merkulov; ", "HomeLineupMidfield": "Dmitry Zhivoglyadov; Catalin Carp; Dmitri Sysuev; Bojan Jokic; Ondrej Vanek; Sylvester Igboun; ", "AwayLineupMidfield": "Andrey Egorychev; Roman Yemelyanov; Marco Aratore; Eric Cosmin Bicfalvi; Othman El Kabir; ", "HomeLineupForward": "Andres Vombergar; ", "AwayLineupForward": "Andrey Panyukov; ", "HomeLineupSubstitutes": "Yuriyi Shafinskyi; Timur Akmurzin; Aleksandr Sukhov; Pavel Alikin; Aleksandr Putsko; Azamat Zaseev; Vyacheslav Krotov; Azer Aliev; Igor Bezdenezhnykh; Veroljub Salatic; Olivier Thill; Lovro Bizjak; ", "AwayLineupSubstitutes": "Oleg Baklov; Aleksandr Dantsev; Shamsiddin Shanbiev; Dominik Dinga; Denis Polyakov; Artyom Fidler; Nikolay Dimitrov; Yuri Bavin; Anatoliy Katrich; Pavel Pogrebnyak; ", "HomeSubDetails": "54': out Ondrej Vanek;54': in Olivier Thill;77': out Dmitri Sysuev;77': in Vyacheslav Krotov;88': out Dmitry Zhivoglyadov;88': in Aleksandr Sukhov;", "AwaySubDetails": "55': out Andrey Egorychev;55': in Artyom Fidler;61': out Andrey Panyukov;61': in Denis Polyakov;77': out Marco Aratore;77': in Nikolay Dimitrov;", "Location": "Dynamo Stadium", "Stadium": "Dynamo Stadium", "HomeTeamYellowCardDetails": {}, "AwayTeamYellowCardDetails": {}, "HomeTeamRedCardDetails": {}, "AwayTeamRedCardDetails": "59':Sergei Bryzgalov;" }, PLEASE HELP, THIS MAKE ME CRAZY Sorry about my bad english!!!! | ||
Posted: 29 Apr 2019 12:59 | |||
zag Posts: 3,515 Joined: 2020 | Thanks for the detailed explanation, I understand the issue but we get our livescores from a 3rd party source that are used by many developers so there must be a way round it on the client side. There is also the danger that I break it for our current users... I will look into modifying the {} to convert to NULL, but I can make no promises, it seems like a little hack to me. | ||
Posted: 11 May 2019 20:57 | |||
zag Posts: 3,515 Joined: 2020 | Hello everyone, I have a question concerning the seasons result. Executing the following request: https://www.thesportsdb.com/api/v1/json/1/search_all_seasons.php?id=4431 Is there any way, i can get the name of the season like 2018–19 Eastern Counties Football League. | ||
Posted: 12 May 2019 07:10 | |||
zag Posts: 3,515 Joined: 2020 | Hi, Sorry no way to do this from that call. But a simple 2nd call to the League lookup API method will give you all the details from the League Id including the strLeague name. | ||
Posted: 12 May 2019 13:01 | |||
zag Posts: 3,515 Joined: 2020 | Great, thanks. | ||
Posted: 29 May 2019 08:23 | |||
zag Posts: 3,515 Joined: 2020 | I can't seem to find many of the cup competitions in your feed. For instance the English FA Cup, the English League Cup (Carabao Cup) and the Danish Cup (Pokalen), For the FA Cup I tried having a look at Wolverhamptons latest 5 matches, since the last one was the FA Cup final, but it didn't show the match at all | ||
Posted: 29 May 2019 08:50 | |||
zag Posts: 3,515 Joined: 2020 | Yep thats because it only shows the main competition (in this case the premier league). Are you accessing the data from the API? If so what method? If its the front end website then you would just need to browse to the FA cup "league" to see the results. https://www.thesportsdb.com/season.php?l=4482&s=1819 | ||
Posted: 29 May 2019 17:17 | |||
zag Posts: 3,515 Joined: 2020 | EFL & Pokalen are not on our db | ||
Posted: 25 Sep 2019 22:17 | |||
zag Posts: 3,515 Joined: 2020 | It seems like the max return from a GET on the 'event seasons' endpoint is 1500. When I run this https://www.thesportsdb.com/api/v1/json ... 424&s=2019 in Postman I can only get to August 2019. Is there some way around this? | ||
Posted: 26 Sep 2019 08:23 | |||
zag Posts: 3,515 Joined: 2020 | Oh wow! Looks like there are a lot of events in an MLB season If you are a Patreon subscriber I can up the limit on that API method. It should return up to 2500 events now which I hope is enough. Make sure you use the production key. For info there are 2,007 events in total. Crazy hehe. | ||
Posted: 18 Oct 2019 12:45 | |||
zag Posts: 3,515 Joined: 2020 | Is it possible to add hometeam and awayteam logos to the event details? | ||
Posted: 18 Oct 2019 12:59 | |||
zag Posts: 3,515 Joined: 2020 | Sorry no as this would have a large performance impact on this call. You can of course make a second call to lookup the team details though which has all the artwork. | ||
Posted: 18 Oct 2019 14:04 | |||
zag Posts: 3,515 Joined: 2020 | Sorry no as this would have a large performance impact on this call. You can of course make a second call to lookup the team details though which has all the artwork. I was trying to avoid doing that because if I wanted to display a full list of events I would need two extra calls for each one of them. Thanks anyways | ||
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 |