Site
Home / Forum / Developers / API Tutorial

API Tutorial


Posted: 23 Jan 2017 15:02

zag
Posts: 1,558
Joined: Oct 2016

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: 1,558
Joined: Oct 2016

[color=#008000:2obp302i][size=150:2obp302i]Lookups

Moved to: https://www.thesportsdb.com/api.php

Posted: 03 Feb 2017 12:29

zag
Posts: 1,558
Joined: Oct 2016

[color=#008000:74c8kr4s][size=150:74c8kr4s]Schedules

Moved to: https://www.thesportsdb.com/api.php

Posted: 03 Feb 2017 12:29

zag
Posts: 1,558
Joined: Oct 2016

[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: 1,558
Joined: Oct 2016

[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

cturan
Posts: 1
Joined: Mar 2019

[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: 1,558
Joined: Oct 2016

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

hariosdev
Posts: 5
Joined: Mar 2019

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: 1,558
Joined: Oct 2016

I'm guessing you just need to check for NULL data.

Posted: 14 Apr 2019 11:48

hariosdev
Posts: 5
Joined: Mar 2019

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:

{
"teams": {
"Match": [
{
"Date": "2019-04-14T09:00:00+00:00",
"League": "Australian A-League",
"Round": "25",
"HomeTeam": "Perth Glory",
"HomeTeam_Id": "134481",
"AwayTeam": "Newcastle Jets",
"AwayTeam_Id": "134474",
"Time": "Finished",
"HomeGoals": "1",
"AwayGoals": "0",
"HomeGoalDetails": "65':Ivan Franjic;",
"AwayGoalDetails": {}, <-----------------------------------------------Object
"HomeLineupGoalkeeper": "Liam Reddy; ",
"AwayLineupGoalkeeper": "Glen Moss; ",
"HomeLineupDefense": "Dino Djulbic; Matthew Spiranovic; Shane Lowry; ",
"AwayLineupDefense": "Johnny Koutroumbis; Nigel Boogaard; Nikolai Topor-Stanley; Ivan Vujica; ",
"HomeLineupMidfield": "Ivan Franjic; Juande; Neil Kilkenny; Jason Davidson; Diego Castro; Joel Chianese; ",
"AwayLineupMidfield": "Steven Peter Ugarkovic; Ben Kantarovski; Matthew Ridenton; Dimitri Petratos; Joseph Champness; ",
"HomeLineupForward": "Andrew Keogh; ",
"AwayLineupForward": "Roy O'Donovan; ",
"HomeLineupSubstitutes": "Tando Velaphi; Scott Neville; Jake Brimmer; Fabio Ferreira; Brendon Santalab; ",
"AwayLineupSubstitutes": "Lewis Italiano; Lachlan Jackson; Angus Thurgate; Ronald Vargas; Kaine Sheppard; ",
"HomeSubDetails": "31': out Juande;31': in Jake Brimmer;73': out Ivan Franjic;73': in Fabio Ferreira;89': out Jason Davidson;89': in Fabio Ferreira;",
"AwaySubDetails": "57': out Matthew Ridenton;57': in Ronald Vargas;66': out Joseph Champness;66': in Kaine Sheppard;70': out Ivan Vujica;70': in Lachlan Jackson;",
"Location": "nib Stadium",
"Stadium": "nib Stadium",
"HomeTeamYellowCardDetails": "90':Neil Kilkenny;",
"AwayTeamYellowCardDetails": "18':Ivan Vujica;83':Ronald Vargas;",
"HomeTeamRedCardDetails": {},
"AwayTeamRedCardDetails": {},
"HasBeenRescheduled": "true"
},
{
"Date": "2019-04-14T10:00:00+00:00",
"League": "La Liga",
"Round": "32",
"HomeTeam": "Valladolid",
"HomeTeam_Id": "133841",
"AwayTeam": "Getafe",
"AwayTeam_Id": "133731",
"Time": "66'",
"HomeGoals": "1",
"AwayGoals": "1",
"HomeGoalDetails": "30':Sergi Guardiola;",
"AwayGoalDetails": "14':Mauro Arambarri;", <-------------------------------------------------- String
"HomeLineupGoalkeeper": "Jordi Masip; ",
"AwayLineupGoalkeeper": "David Soria; ",
"HomeLineupDefense": "Javi Moyano; Kiko; Fernando Calero; Nacho Martinez; ",
"AwayLineupDefense": "Damian Suarez; Djene; Bruno Gonzalez; Antunes; ",
"HomeLineupMidfield": "Keko; Anuar; Ruben Alcaraz; Michel Herrero; ",
"AwayLineupMidfield": "Dimitri Foulquier; Nemanja Maksimovic; Mauro Arambarri; Francisco Portillo; ",
"HomeLineupForward": "Oscar Plano; Sergi Guardiola; ",
"AwayLineupForward": "Jorge Molina; Jaime Mata; ",
"HomeLineupSubstitutes": "Jordi Masip; Joaquin Fernandez; Waldo Rubio; Borja Fernandez; Daniele Verde; Antonito; Michel Herrero; ",
"AwayLineupSubstitutes": "Leandro Chichizola; Bruno Gonzalez; Gaku Shibasaki; Sebastian Cristoforo; Mathieu Flamini; Jorge Molina; Hugo Duro; ",
"HomeSubDetails": {},
"AwaySubDetails": "38': out Antunes;38': in Hugo Duro;",
"Location": "José Zorrilla",
"Stadium": "José Zorrilla",
"HomeTeamYellowCardDetails": "18':Anuar;",
"AwayTeamYellowCardDetails": "40':Mathias Olivera;",
"HomeTeamRedCardDetails": {},
"AwayTeamRedCardDetails": {},
"HasBeenRescheduled": "true"
},
{
"Date": "2019-04-14T10:15:00+00:00",
"League": "Eredivisie",
"Round": "30",
"HomeTeam": "PSV Eindhoven",
"HomeTeam_Id": "133768",
"AwayTeam": "De Graafschap",
"AwayTeam_Id": "133771",
"Time": "49'",
"HomeGoals": "0",
"AwayGoals": "1",
"HomeGoalDetails": {},
"AwayGoalDetails": "26':Delano Burgzorg;",
"HomeLineupGoalkeeper": "Jeroen Zoet; ",
"AwayLineupGoalkeeper": "Nigel Bertrams; ",
"HomeLineupDefense": "Denzel Dumfries; Daniel Schwaab; Nick Viergever; Angelino; ",
"AwayLineupDefense": "Leeroy Owusu; Lars Nieuwpoort; Bart Straalman; Jordy Tutuarima; ",
"HomeLineupMidfield": "Pablo Rosario; Jorrit Hendrix; Steven Bergwijn; ",
"AwayLineupMidfield": "Frank Olijve; Javier Vet; Youssef El Jebli; ",
"HomeLineupForward": "Hirving Lozano; Luuk de Jong; Donyell Malen; ",
"AwayLineupForward": "Furdjel Narsingh; Charlison Benschop; Delano Burgzorg; ",
"HomeLineupSubstitutes": "Eloy Room; Mike van de Meulenhof; Aziz Behich; Gaston Pereiro; Jorrit Hendrix; Donyell Malen; Dante Rigo; Armando Obispo; Cody Gakpo; Trent Sainsbury; Erick Gutierrez; Jordan Teze; ",
"AwayLineupSubstitutes": "Hidde Jurjus; Jordy Rondeel; Lars Nieuwpoort; Robert Klaasen; Nabil Bahoui; Stefan Nijland; Daryl van Mieghem; Erik Bakker; Ruben Ligeon; Frank Olijve; ",
"HomeSubDetails": "46': out Mohammed Ihattaren;46': in Donyell Malen;",
"AwaySubDetails": {},
"Location": "Philips Stadion",
"Stadium": "Philips Stadion",
"HomeTeamYellowCardDetails": {},
"AwayTeamYellowCardDetails": {},
"HomeTeamRedCardDetails": {},
"AwayTeamRedCardDetails": {}
},
{
"Date": "2019-04-14T10:30:00+00:00",
"League": "Süper Lig",
"Round": "28",
"HomeTeam": "Kayserispor",
"HomeTeam_Id": "133802",
"AwayTeam": "Ankaragucu",
"AwayTeam_Id": "133791",
"Time": "Halftime",
"HomeGoals": "0",
"AwayGoals": "0",
"HomeGoalDetails": {},
"AwayGoalDetails": {},
"HomeLineupGoalkeeper": "Silviu Lung Jr.; ",
"AwayLineupGoalkeeper": "Altay Bayindir; ",
"HomeLineupDefense": {},
"AwayLineupDefense": {},
"HomeLineupMidfield": {},
"AwayLineupMidfield": {},
"HomeLineupForward": {},
"AwayLineupForward": {},
"HomeLineupSubstitutes": "Muammer Zulfikar Yildirim; Bilal Basacikoglu; Artem Kravets; Emre Demir; Nurettin Korkmaz; Hakan Citak; Adem Dogan; Mert Ozyildirim; ",
"AwayLineupSubstitutes": "Korcan Celikay; Alihan Kubalas; Kaan Uykur; Cebrail Karayel; Mahmut Akan; Mehmet Sak; Wilfred Moke; Ezequiel Scarione; Ilhan Parlak; Aydin Karabulut; ",
"HomeSubDetails": {},
"AwaySubDetails": {},
"Location": "Kadir Has Stadium",
"Stadium": "Kadir Has Stadium",
"HomeTeamYellowCardDetails": {},
"AwayTeamYellowCardDetails": {},
"HomeTeamRedCardDetails": {},
"AwayTeamRedCardDetails": {},
"HasBeenRescheduled": "true"
},
{
"Date": "2019-04-14T10:30:00+00:00",
"League": "Serie A",
"Round": "32",
"HomeTeam": "Torino",
"HomeTeam_Id": "133687",
"AwayTeam": "Cagliari",
"AwayTeam_Id": "134783",
"Time": "Halftime",
"HomeGoals": "0",
"AwayGoals": "0",
"HomeGoalDetails": {},
"AwayGoalDetails": {},
"HomeLineupGoalkeeper": "Salvatore Sirigu; ",
"AwayLineupGoalkeeper": "Alessio Cragno; ",
"HomeLineupDefense": "Armando Izzo; Nicolas N'Koulou; Emiliano Moretti; ",
"AwayLineupDefense": "Darijo Srna; Fabio Pisacane; Filippo Romagna; Luca Pellegrini; ",
"HomeLineupMidfield": "Ola Aina; Sasa Lukic; Tomas Rincon; Cristian Daniel Ansaldi; Daniele Baselli; Alex Berenguer; ",
"AwayLineupMidfield": "Paolo Farago; Luca Cigarini; Artur Ionita; Nicolo Barella; ",
"HomeLineupForward": "Simone Zaza; ",
"AwayLineupForward": "Leonardo Pavoletti; Joao Pedro; ",
"HomeLineupSubstitutes": "Salvador Ichazo; Antonio Rosati; Vitalie Damascan; Soualiho Meite; Vittorio Parigini; Lorenzo De Silvestri; Koffi Djidji; Gleison Bremer; Gleison Bremer; ",
"AwayLineupSubstitutes": "Rafael; Simone Aresti; Filip Bradaric; Alberto Cerri; Valter Birsa; Ragnar Klavan; Charalambos Lykogiannis; Alessandro Deiola; Kiril Despodov; Darijo Srna; Cyril Thereau; Filippo Romagna; ",
"HomeSubDetails": "40': out Lorenzo De Silvestri;40': in Ola Aina;",
"AwaySubDetails": {},
"Location": "Stadio Olimpico",
"Stadium": "Stadio Olimpico",
"HomeTeamYellowCardDetails": "3':Tomas Rincon;45':Alex Berenguer;",
"AwayTeamYellowCardDetails": "2':Nicolo Barella;20':Paolo Farago;45':Simone Padoin;",
"HomeTeamRedCardDetails": {},
"AwayTeamRedCardDetails": {},
"HasBeenRescheduled": "true"
},
{
"Date": "2019-04-14T11:00:00+00:00",
"League": "English League Championship",
"Round": "42",
"HomeTeam": "Wigan",
"HomeTeam_Id": "133607",
"AwayTeam": "Norwich",
"AwayTeam_Id": "133608",
"Time": "21'",
"HomeGoals": "0",
"AwayGoals": "0",
"HomeGoalDetails": {},
"AwayGoalDetails": {},
"HomeLineupGoalkeeper": "Christian Walton; ",
"AwayLineupGoalkeeper": "Tim Krul; ",
"HomeLineupDefense": "Nathan Byrne; Cheyenne Dunkley; Daniel Fox; Antonee Robinson; ",
"AwayLineupDefense": "Maximillian James Aarons; Christoph Zimmermann; Ben Godfrey; Jamal Lewis; ",
"HomeLineupMidfield": "Sam Morsy; Gavin Massey; Reece James; Lee Evans; Kal Naismith; ",
"AwayLineupMidfield": "Kenny McLean; Tom Trybull; Onel Hernandez; Marco Stiepermann; Todd Cantwell; ",
"HomeLineupForward": "Leon Clarke; ",
"AwayLineupForward": "Teemu Pukki; ",
"HomeLineupSubstitutes": "Owen Evans; Darron Gibson; Josh Windass; Cedric Kipre; Nick Powell; Jonas Olsson; Joe Garner; ",
"AwayLineupSubstitutes": "Michael McGovern; Mario Vrancic; Moritz Leitner; Jordan Rhodes; Timm Klose; Grant Hanley; Dennis Srbeny; ",
"HomeSubDetails": {},
"AwaySubDetails": {},
"Location": "DW Stadium",
"Stadium": "DW Stadium",
"HomeTeamYellowCardDetails": {},
"AwayTeamYellowCardDetails": {},
"HomeTeamRedCardDetails": {},
"AwayTeamRedCardDetails": {},
"HasBeenRescheduled": "true"
},
{
"Date": "2019-04-14T11:30:00+00:00",
"League": "Bundesliga",
"Round": "29",
"HomeTeam": "Hoffenheim",
"HomeTeam_Id": "133657",
"AwayTeam": "Hertha",
"AwayTeam_Id": "133658",
"Time": "Not started",
"HomeGoals": "0",
"AwayGoals": "0",
"HomeGoalDetails": {},
"AwayGoalDetails": {},
"HomeLineupGoalkeeper": "Oliver Baumann; ",
"AwayLineupGoalkeeper": "Rune Almenning Jarstein; ",
"HomeLineupDefense": "Pavel Kaderabek; Kevin Vogt; Benjamin Huebner; Nico Schulz; ",
"AwayLineupDefense": "Maximilian Mittelstaedt; Lukas Kluenter; Niklas Stark; Karim Rekik; ",
"HomeLineupMidfield": "Nadiem Amiri; Florian Grillitsch; Kerem Demirbay; Andrej Kramaric; ",
"AwayLineupMidfield": "Marvin Plattenhardt; Matthew Leckie; Salomon Kalou; Per Ciljan Skjelbred; Valentino Lazaro; ",
"HomeLineupForward": "Ishak Belfodil; Adam Szalai; ",
"AwayLineupForward": "Davie Selke; ",
"HomeLineupSubstitutes": "Alexander Stolz; Joshua Brenet; Stefan Posch; Ermin Bicakcic; Leonardo Bittencourt; Reiss Nelson; Christoph Baumgartner; ",
"AwayLineupSubstitutes": "Thomas Kraft; Florian Baak; Niklas Stark; Javairo Dilrosun; Palko Dardai; Dennis Jastrzembski; Pascal Koepke; ",
"HomeSubDetails": {},
"AwaySubDetails": {},
"Location": "Rhein-Neckar-Arena",
"Stadium": "Rhein-Neckar-Arena",
"HomeTeamYellowCardDetails": {},
"AwayTeamYellowCardDetails": {},
"HomeTeamRedCardDetails": {},
"AwayTeamRedCardDetails": {},
"HasBeenRescheduled": "true"
},
{
"Date": "2019-04-14T11:30:00+00:00",
"League": "2. Bundesliga",
"Round": "29",
"HomeTeam": "Union Berlin",
"HomeTeam_Id": "134690",
"AwayTeam": "Jahn Regensburg",
"AwayTeam_Id": "136026",
"Location": "Stadion An der Alten Försterei",
"Stadium": "Stadion An der Alten Försterei"
},
{
"Date": "2019-04-14T11:30:00+00:00",
"League": "2. Bundesliga",
"Round": "29",
"HomeTeam": "Ingolstadt",
"HomeTeam_Id": "134694",
"AwayTeam": "Holstein Kiel",
"AwayTeam_Id": "136027",
"Time": "Not started",
"HomeGoals": "0",
"AwayGoals": "0",
"HomeGoalDetails": {},
"AwayGoalDetails": {},
"HomeLineupGoalkeeper": "Philipp Tschauner; ",
"AwayLineupGoalkeeper": "Dominik Reimann; ",
"HomeLineupDefense": "Phil Neumann; Bjoern Paulsen; Jonatan Kotzke; Paulo Silva; ",
"AwayLineupDefense": "Jannik Dehm; Hauke Wahl; Dominik Schmidt; Arne Sicker; ",
"HomeLineupMidfield": "Almog Cohen; Marcel Gaus; Sonny Kittel; ",
"AwayLineupMidfield": "Atakan Karazor; Alexander Muehling; Jonas Meffert; Jae-Sung Lee; ",
"HomeLineupForward": "Stefan Kutschke; Dario Lezcano; Konstantin Kerschbaumer; ",
"AwayLineupForward": "Masaya Okugawa; Mathias Honsak; ",
"HomeLineupSubstitutes": "Philipp Heerwagen; Enver Cenk Sahin; Robin Krausse; Christian Traesch; Thorsten Rocher; Thomas Pledl; Fatih Kaya; ",
"AwayLineupSubstitutes": "Heinz Moerschel; Laszlo Benes; Patrick Kammerbauer; Yann Bisseck; Janni Serra; Frank Evina; Timon Weiner; ",
"HomeSubDetails": {},
"AwaySubDetails": {},
"Location": "Audi Sportpark",
"Stadium": "Audi Sportpark",
"HomeTeamYellowCardDetails": {},
"AwayTeamYellowCardDetails": {},
"HomeTeamRedCardDetails": {},
"AwayTeamRedCardDetails": {}
},
{
"Date": "2019-04-14T11:30:00+00:00",
"League": "2. Bundesliga",
"Round": "29",
"HomeTeam": "Sandhausen",
"HomeTeam_Id": "134691",
"AwayTeam": "Dynamo Dresden",
"AwayTeam_Id": "135655",
"Location": "Hardtwaldstadion",
"Stadium": "Hardtwaldstadion"
},
{
"Date": "2019-04-14T11:30:00+00:00",
"League": "2. Bundesliga",
"Round": "29",
"HomeTeam": "St Pauli",
"HomeTeam_Id": "133813",
"AwayTeam": "Bielefeld",
"AwayTeam_Id": "133852",
"Time": "Not started",
"HomeGoals": "0",
"AwayGoals": "0",
"HomeGoalDetails": {},
"AwayGoalDetails": {},
"HomeLineupGoalkeeper": {},
"AwayLineupGoalkeeper": {},
"HomeLineupDefense": {},
"AwayLineupDefense": {},
"HomeLineupMidfield": {},
"AwayLineupMidfield": {},
"HomeLineupForward": {},
"AwayLineupForward": {},
"HomeLineupSubstitutes": {},
"AwayLineupSubstitutes": {},
"HomeSubDetails": {},
"AwaySubDetails": {},
"Location": "Millerntor-Stadion",
"Stadium": "Millerntor-Stadion",
"HomeTeamYellowCardDetails": {},
"AwayTeamYellowCardDetails": {},
"HomeTeamRedCardDetails": {},
"AwayTeamRedCardDetails": {}
},
{
"Date": "2019-04-14T11:30:00+00:00",
"League": "2. Bundesliga",
"Round": "29",
"HomeTeam": "Aue",
"HomeTeam_Id": "134445",
"AwayTeam": "FC Heidenheim",
"AwayTeam_Id": "134696",
"Location": "Erzgebirgsstadion",
"Stadium": "Erzgebirgsstadion"
},
{
"Date": "2019-04-14T11:30:00+00:00",
"League": "2. Bundesliga",
"Round": "29",
"HomeTeam": "FC Koln",
"HomeTeam_Id": "133654",
"AwayTeam": "Hamburg",
"AwayTeam_Id": "133651",
"Location": "RheinEnergieStadion",
"Stadium": "RheinEnergieStadion"
},
{
"Date": "2019-04-14T11:30:00+00:00",
"League": "2. Bundesliga",
"Round": "29",
"HomeTeam": "Magdeburg",
"HomeTeam_Id": "136194",
"AwayTeam": "Darmstadt",
"AwayTeam_Id": "134693",
"Location": "MDCC-Arena",
"Stadium": "MDCC-Arena"
},
{
"Date": "2019-04-14T11:30:00+00:00",
"League": "2. Bundesliga",
"Round": "29",
"HomeTeam": "Bochum",
"HomeTeam_Id": "133839",
"AwayTeam": "SPVGG Greuther Fürth",
"AwayTeam_Id": "134099",
"Time": "Not started",
"HomeGoals": "0",
"AwayGoals": "0",
"HomeGoalDetails": {},
"AwayGoalDetails": {},
"HomeLineupGoalkeeper": "Manuel Riemann; ",
"AwayLineupGoalkeeper": "Sascha Burchert; ",
"HomeLineupDefense": "Stefano Celozzi; Patrick Fabian; Tim Hoogland; Stelios Kokovas; ",
"AwayLineupDefense": "Maximilian Sauer; Richard Magyar; Marco Caligiuri; Kenny Prince Redondo; ",
"HomeLineupMidfield": "Anthony Losilla; Thomas Eisfeld; Milos Pantovic; Goerkem Saglam; Chung-Yong Lee; ",
"AwayLineupMidfield": "Paul Jaeckel; Paul Seguin; Sebastian Ernst; ",
"HomeLineupForward": "Lukas Hinterseer; ",
"AwayLineupForward": "Fabian Reese; Julian Green; David Atanga; ",
"HomeLineupSubstitutes": "Felix Dornebusch; Tom Baack; Dominik Baumgartner; Robert Tesche; Moritz Roemling; Silvere Ganvoula M'boussy; Baris Ekincier; ",
"AwayLineupSubstitutes": "Marius Funk; Maximilian Bauer; Mario Maloca; Nik Omladic; Yosuke Ideguchi; Hans Nunoo Sarpei; Daniel Steininger; ",
"HomeSubDetails": {},
"AwaySubDetails": {},
"Location": "Ruhrstadion",
"Stadium": "Ruhrstadion",
"HomeTeamYellowCardDetails": {},
"AwayTeamYellowCardDetails": {},
"HomeTeamRedCardDetails": {},
"AwayTeamRedCardDetails": {}
},
{
"Date": "2019-04-14T11:30:00+00:00",
"League": "2. Bundesliga",
"Round": "29",
"HomeTeam": "Paderborn",
"HomeTeam_Id": "134551",
"AwayTeam": "Duisburg",
"AwayTeam_Id": "133877",
"Location": "Benteler Arena",
"Stadium": "Benteler Arena"
},
{
"Date": "2019-04-14T12:00:00+00:00",
"League": "La Liga",
"Round": "32",
"HomeTeam": "Ath Bilbao",
"HomeTeam_Id": "133727",
"AwayTeam": "Vallecano",
"AwayTeam_Id": "133728",
"Time": "Not started",
"HomeGoals": "0",
"AwayGoals": "0",
"HomeGoalDetails": {},
"AwayGoalDetails": {},
"HomeLineupGoalkeeper": "Iago Herrerin; ",
"AwayLineupGoalkeeper": "Alberto Garcia; ",
"HomeLineupDefense": "Oscar de Marcos; Yeray Alvarez; Inigo Martinez; Yuri Berchiche; ",
"AwayLineupDefense": "Luis Advincula; Emiliano Velazquez; Abdoulaye Ba; Tito; ",
"HomeLineupMidfield": "Dani Garcia; Benat Etxebarria; Inigo Cordoba; Raul Garcia; Iker Muniain; ",
"AwayLineupMidfield": "Mario Suarez; Bebe; Adrian Embarba; Pozo; Alex Moreno; ",
"HomeLineupForward": "Inaki Williams; ",
"AwayLineupForward": "Raul de Tomas; ",
"HomeLineupSubstitutes": "Unai Simon; Kenan Kodro; Unai Nunez; Markel Susaeta; Inigo Lekue; Aritz Aduriz; Unai Lopez; ",
"AwayLineupSubstitutes": "Stole Dimitrievski; Uche Henry Agbo; Emiliano Velazquez; Adrian Embarba; Santi Comesana; Alvaro Garcia; Franco Di Santo; ",
"HomeSubDetails": {},
"AwaySubDetails": {},
"Location": "San Mamés",
"Stadium": "San Mamés",
"HomeTeamYellowCardDetails": {},
"AwayTeamYellowCardDetails": {},
"HomeTeamRedCardDetails": {},
"AwayTeamRedCardDetails": {},
"HasBeenRescheduled": "true"
},
{
"Date": "2019-04-14T12:30:00+00:00",
"League": "Eredivisie",
"Round": "30",
"HomeTeam": "Willem II",
"HomeTeam_Id": "133827",
"AwayTeam": "PEC Zwolle",
"AwayTeam_Id": "133936",
"Time": "Not started",
"HomeGoals": "0",
"AwayGoals": "0",
"HomeGoalDetails": {},
"AwayGoalDetails": {},
"HomeLineupGoalkeeper": "Timon Wellenreuther; ",
"AwayLineupGoalkeeper": "Mickey van der Hart; ",
"HomeLineupDefense": "Fernando Lewis; Jordens Peters; Freek Heerkens; Diego Palacios; ",
"AwayLineupDefense": "Kingsley Ehizibue; Darryl Lachman; Thomas Lam; Bram van Polen; ",
"HomeLineupMidfield": "Pol Llonch; Renato Tapia; Daniel Crowley; ",
"AwayLineupMidfield": "Pelle Clement; Kenneth Paal; Younes Namli; ",
"HomeLineupForward": "Damil Dankerlui; Alexander Isak; Marios Vrousai; ",
"AwayLineupForward": "Vito van Crooy; Lennart Thy; Mike van Duinen; ",
"HomeLineupSubstitutes": {},
"AwayLineupSubstitutes": {},
"HomeSubDetails": {},
"AwaySubDetails": {},
"Location": "Koning Willem II Stadion",
"Stadium": "Koning Willem II Stadion",
"HomeTeamYellowCardDetails": {},
"AwayTeamYellowCardDetails": {},
"HomeTeamRedCardDetails": {},
"AwayTeamRedCardDetails": {},
"HasBeenRescheduled": "true"
},
{
"Date": "2019-04-14T12:30:00+00:00",
"League": "Eredivisie",
"Round": "30",
"HomeTeam": "SC Heerenveen",
"HomeTeam_Id": "133759",
"AwayTeam": "FC Groningen",
"AwayTeam_Id": "133762",
"Time": "Not started",
"HomeGoals": "0",
"AwayGoals": "0",
"HomeGoalDetails": {},
"AwayGoalDetails": {},
"HomeLineupGoalkeeper": "Warner Hahn; ",
"AwayLineupGoalkeeper": "Sergio Padt; ",
"HomeLineupDefense": "Jizz Hornkamp; Daniel Hoeegh; Kik Pierie; Lucas Woudenberg; ",
"AwayLineupDefense": "Deyovaisio Zeefuik; Mike te Wierik; Julian Chabot; Tim Handwerker; ",
"HomeLineupMidfield": "Ben Rienstra; Stijn Schaars; Michel Vlap; ",
"AwayLineupMidfield": "Ritsu Doan; Samir Memisevic; Ludovit Reis; Mohamed El Hankouri; ",
"HomeLineupForward": "Mitchel van Bergen; Sam Lammers; Pelle van Amersfoort; ",
"AwayLineupForward": "Kaj Sierhuis; Mimoun Mahi; ",
"HomeLineupSubstitutes": {},
"AwayLineupSubstitutes": {},
"HomeSubDetails": {},
"AwaySubDetails": {},
"Location": "Abe Lenstra Stadion",
"Stadium": "Abe Lenstra Stadion",
"HomeTeamYellowCardDetails": {},
"AwayTeamYellowCardDetails": {},
"HomeTeamRedCardDetails": {},
"AwayTeamRedCardDetails": {}
}
]
}
}


Posted: 15 Apr 2019 13:31

zag
Posts: 1,558
Joined: Oct 2016

Do you have some idea what it should return?

Posted: 15 Apr 2019 14:42

hariosdev
Posts: 5
Joined: Mar 2019

At least When empty or not have an same data type like string....

Posted: 28 Apr 2019 12:09

hariosdev
Posts: 5
Joined: Mar 2019

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: 1,558
Joined: Oct 2016

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

mkosturkov
Posts: 2
Joined: May 2019

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: 1,558
Joined: Oct 2016

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

mkosturkov
Posts: 2
Joined: May 2019

Great, thanks.

Posted: 29 May 2019 08:23

cbjerg
Posts: 1
Joined: May 2019

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: 1,558
Joined: Oct 2016

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

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

ovokx
Posts: 830
Joined: Jan 2017

EFL & Pokalen are not on our db

Posted: 25 Sep 2019 22:17

adamtyoung
Posts: 7
Joined: Sep 2019

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: 1,558
Joined: Oct 2016

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

atirs
Posts: 8
Joined: Oct 2019

Is it possible to add hometeam and awayteam logos to the event details?

Posted: 18 Oct 2019 12:59

zag
Posts: 1,558
Joined: Oct 2016

Is it possible to add hometeam and awayteam logos to the event details?

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

atirs
Posts: 8
Joined: Oct 2019



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

Showing 0 to 25 (Total: 29)