Site
Home / Forum / Developers / Include Flag in API for leagues/teams

Include Flag in API for leagues/teams


Posted: 26 Apr 2020 19:17

zag


Posts: 3,511
Joined: 2020

Hi Zag,

I was wondering if it’d be an option to pass through the country flags you use on the front end of thesportsdb through the api.

I’m thinking of adding something similar to mark out the countries that a particular league/player is from but I can’t be bothered to compile all the flags 😂

Posted: 26 Apr 2020 20:01

zag


Posts: 3,511
Joined: 2020

You should be able to work out the flag URL from the country name I think. They should match the country from the API.

EG:
https://www.thesportsdb.com/images/icons/flags/shiny/16/Italy.png
https://www.thesportsdb.com/images/icons/flags/shiny/16/Burkina-Faso.png
https://www.thesportsdb.com/images/icons/flags/shiny/32/Italy.png
https://www.thesportsdb.com/images/icons/flags/shiny/64/Italy.png


Just add a hyphen if the country has a space

Posted: 26 Apr 2020 21:32

zag


Posts: 3,511
Joined: 2020

Ah amazing, just what I needed

Posted: 26 Apr 2020 21:34

zag


Posts: 3,511
Joined: 2020

Oops, sorry to be a pain but it looks like the strCountry is always null from the eventsday api.

Is this an easy fix?

Posted: 27 Apr 2020 07:55

zag


Posts: 3,511
Joined: 2020

Oops, sorry to be a pain but it looks like the strCountry is always null from the eventsday api.

Is this an easy fix?


Can you post an example? If its NULL then maybe the data does not exist?

Posted: 27 Apr 2020 10:46

zag


Posts: 3,511
Joined: 2020

From the https://www.thesportsdb.com/api/v1/json/eventsday.php api

{
"idEvent": "602472",
"idSoccerXML": "402323",
"idAPIfootball": null,
"strEvent": "Aston Villa vs Crystal Palace",
"strEventAlternate": "Crystal Palace @ Aston Villa",
"strFilename": "English Premier League 2020-04-25 Aston Villa vs Crystal Palace",
"strSport": "Soccer",
"idLeague": "4328",
"strLeague": "English Premier League",
"strSeason": "1920",
"strDescriptionEN": null,
"strHomeTeam": "Aston Villa",
"strAwayTeam": "Crystal Palace",
"intHomeScore": null,
"intRound": "35",
"intAwayScore": null,
"intSpectators": null,
"strHomeGoalDetails": "",
"strHomeRedCards": "",
"strHomeYellowCards": "",
"strHomeLineupGoalkeeper": "",
"strHomeLineupDefense": "",
"strHomeLineupMidfield": "",
"strHomeLineupForward": "",
"strHomeLineupSubstitutes": "",
"strHomeFormation": null,
"strAwayRedCards": "",
"strAwayYellowCards": "",
"strAwayGoalDetails": "",
"strAwayLineupGoalkeeper": "",
"strAwayLineupDefense": "",
"strAwayLineupMidfield": "",
"strAwayLineupForward": "",
"strAwayLineupSubstitutes": "",
"strAwayFormation": null,
"intHomeShots": null,
"intAwayShots": null,
"dateEvent": "2020-04-27",
"dateEventLocal": null,
"strDate": "27/04/20",
"strTime": "19:00:00",
"strTimeLocal": "20:00:00",
"strTVStation": null,
"idHomeTeam": "133601",
"idAwayTeam": "133632",
"strResult": null,
"strCircuit": null,
"strCountry": null,
"strCity": null,
"strPoster": null,
"strFanart": null,
"strThumb": null,
"strBanner": null,
"strMap": null,
"strTweet1": null,
"strTweet2": null,
"strTweet3": null,
"strVideo": null,
"strPostponed": "yes",
"strLocked": "unlocked"
}


Note that strCountry is "null" when this should be England. Seems to be the case for every event currently

Posted: 27 Apr 2020 22:55

zag


Posts: 3,511
Joined: 2020

Ahh OK yes this is actually a problem with the soccer importer.

If the event is added manually then a country is usually required, at least for single events.

I will have a look at the importers as this should be an easy fix.

Posted: 28 Apr 2020 07:57

zag


Posts: 3,511
Joined: 2020

Ah I see! Thanks

Posted: 29 Apr 2020 18:41

zag


Posts: 3,511
Joined: 2020

Any update on this?

Posted: 29 Apr 2020 20:54

zag


Posts: 3,511
Joined: 2020

Actually a small update, someone else asked for an all_countries API method so I added that. I'm pretty sure you could work out the flags from that.

https://www.thesportsdb.com/api/v1/json/1/all_countries.php



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 10 (Total: 10)