Home

Awesome

FIFA WORLD CUP 2022

and we made it! 2024 WWC or 2026 MWC in US/Canada/Mexico is anyone's game :D Congrats to Argentina!

--

We are super up and running for 2022. Note URL change! Please remember to make a PR with your nice apps, raspberry pi projects, etc. And my favorite part of this whole thing, the students who get super excited about coding something.

Update: Have finally hit 10k RPM for 2022 as well!

PROJECTS USING THIS API IN 2022

(Feel free to submit a PR with your project!)

todo:

fixed:

Setup: usual rails setup then Setup2022.setup_teams Setup2022.setup_groups AllMatchesService.setup

And if you have 64 matches you are good to go! From there on out you can call jobs directly or use the app/jobs/scheduler.rb to update them. If you want to run the scraping tasks automatically, you'll need another tab open and run ENABLE_CRON=true bundle exec good_jobs start

https://worldcupjson.net

Main response endpoint: https://worldcupjson.net/matches/today

DETAILED EXAMPLE RESPONSE

detailed_response

** note if match statistics make it in, they are all ints - but I have to find them!

(note, the full matches endpoint has up to a 5 minutes cache on it and does not return all events - if you want real time updates please use /matches/today, /matches/id, or /matches/current)

ABOUT

This is a simple backend for a scraper that grabs current world cup results and outputs them as JSON. UPDATE 8 Jun 2015 - This is now working for the Women's World Cup. UPDATE 14 June 2018 - Updated for the World Cup in 2018 with 7 hours to spare! Update 13 Oct 2022- Guess we'll do this again!

Special thanks to my former employer Software For Good for encouraging me to make this many years ago...

RATE LIMITING

The current rate limit is 10 requests every 60 seconds. This is open to change at anytime depending on load, but I'll always keep it so a few requests can fire off in parallel. Please keep your polling down to once a minute or so, 30 seconds if you are feeling greedy, you're not going to get updated information any quicker than that.

ENDPOINTS

(some of the teams endpoints were never used may be deprecated for 2022)

[url]/teams/ for a list of teams with group ID and FIFA code

[url]/matches/ for all matches (Example JSON object at the bottom of this README)

Note - if you want all matches with all details,you must now pass ?details=true to this endpoint. All details will be present by default for endpoints like matches/today that return less matches...

[url]/teams/ results for each team (wins, losses, points, goals_for, goals_away, games_played)

[url]/teams/USA see next match info, last match info, current standings, etc

OTHER ENDPOINTS

[url]/matches/today/
[url]/matches/tomorrow/
[url]/matches/current/

You can also retrieve the matches for any team if you know their FIFA code (get fifa code from teams endpoint) by passing it in as a param.

Example: [url]/matches/country?fifa_code=ISL

Other Params

You can also use the by param to get some other sortings of the match list.

JSONP

JSONP old school The API also supports JSONP style output via the callback parameter, e.g. [url]/teams/results?callback=processData

The response includes the same data output as the regular GET call without parameters, but wrapped inside a function. This can be used to get around cross origin issues.

EXAMPLE RESPONSES

Detailed Match View

PROJECTS USING THIS API IN 2018

<details><summary>2018 projects submitted</summary> </details>

PROJECTS USING THIS API IN 2014

<details><summary>Some 2014 projects submitted</summary> * http://alexb.ninja/wc * https://github.com/fatiherikli/worldcup (displays World Cup results in the terminal) * https://github.com/ColtCarder/XMPP-World-Cup-Bot (Ruby/Blather XMPP Bot to private message live World Cup events as well as overall results.) * https://github.com/gberger/hubot-world-cup-live (Hubot plugin that pushes World Cup goals to a chat room) * World Cup SMS updates at http://worldcupsms.herokuapp.com/ by @andyjiang * https://github.com/brenopolanski/chrome-worldcup2014-extension (World Cup 2014 - Chrome Extension) * http://worldcup2014.meteor.com/ - betting pool app for @q42 built by @primigenus using @meteor * https://github.com/Friss/WorldCup - World Cup matches with the arena in the background * https://github.com/sestaton/WorldCupStats - World Cup stats and match information at the command line </details> ## BACKGROUND

You can read a blog post about building the API here: http://softwareforgood.com/soccer-good/

DONATIONS

Some people have asked if they can make donations. I'd love for you to donate some time writing code or docs or tests, but this is shared totally gratis. If you're interested in throwing some cash someone's way, why not help out organizations working wwith refugees or across borders. At this time of coming together as a human community, let's remember that arbitrary lines on a map still have the power to hurt people. Doctors Without Borders Aegean Boat Report

TRY IT OUT

https://worldcupjson.net/matches

https://worldcupjson.net/matches/today

https://worldcupjson.net/matches/current

https://worldcupjson.net/teams

https://worldcupjson.net/teams/USA

UPDATES

Updates June 19, 2018

Updates June 18, 2018

WARNING

Removing self deprecating warning. I wrote the best code I could 4 years ago and got it working for the whole Cup, and I'm making it better now. Don't apologize for code you write in a rush to build a cool thing! A bad habit! Just make it better if/when you can.

https://www.linkedin.com/pulse/world-cup-api-take-2-eric-stiens/