iErws
Posts: 2
Joined: Mon Oct 01, 2018 1:35 pm

API JSON attribute

Tue Oct 02, 2018 12:22 pm

Hello there,

how easy and quick would it be to add one more attribute on the league list, that has the value of the country.
For example, with PHP, i have these attributes:

Code: Select all

 
       [idLeague] => 4328
       [strLeague] => English Premier League
       [strSport] => Soccer
       [strLeagueAlternate] => Premier League
 


What i would like to have is

Code: Select all

       [idLeague] => 4328
       [strLeague] => English Premier League
       [strSport] => Soccer
       [strLeagueAlternate] => Premier League
       [strCountry] => 1 or England
 


Best regards

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

Re: API JSON attribute

Wed Oct 03, 2018 4:56 pm

As far as I know, looking up leagues by ID should return the country. We certainly store it in the DB.

What exact method are you using?

iErws
Posts: 2
Joined: Mon Oct 01, 2018 1:35 pm

Re: API JSON attribute

Thu Oct 04, 2018 9:08 am

Just some PHP with file_get_contents and i am using the function

Code: Select all

all_leagues

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

Re: API JSON attribute

Thu Oct 04, 2018 8:10 pm

Ahh OK, well that APi method is meant to be used to find the names and ID's only really.

You will need to do a 2nd lookup on each one to find the country and other info:

Example
https://www.thesportsdb.com/api/v1/json ... hp?id=4346

Mitico
Posts: 4
Joined: Tue Jan 22, 2019 7:54 pm

Re: API JSON attribute

Tue Jan 22, 2019 7:58 pm

What about returning team short name in event's calls? It would be possible?

Thanks in advance!

Pololalo
Posts: 21
Joined: Mon Nov 26, 2018 10:31 am

Re: API JSON attribute

Fri Jan 25, 2019 7:00 pm

Hi,
I noticed that there is a slight difference between the attributes in the response on TvEvent By Date and TvEvent by IdEvent,
there is an "S" missing in the tvevent attribute when invoking TvEvent by IdEvent.

TvEvent by IdEvent:

Code: Select all

"tvevent": [
{
"id": "6531",
"idEvent": "594051",
"strSport": "Soccer",
"strEvent": "Arsenal vs Man United",
"idChannel": "6335",
"strCountry": "United Kingdom",
"strLogo": "https://www.thesportsdb.com/images/media/logo/yurvrq1433963684.png",
"strChannel": "BBC One HD",
"strSeason": "1819",
"strTime": "19:55:00",
"dateEvent": "2019-01-25"
}


TvEvent By Date

Code: Select all

"tvevents": [
{
"id": "6531",
"idEvent": "594051",
"strSport": "Soccer",
"strEvent": "Arsenal vs Man United",
"idChannel": "6335",
"strCountry": "United Kingdom",
"strLogo": "https://www.thesportsdb.com/images/media/logo/yurvrq1433963684.png",
"strChannel": "BBC One HD",
"strSeason": "1819",
"strTime": "19:55:00",
"dateEvent": "2019-01-25"
}

Return to “Developers”