When I query the database for, say, Alonso’s all-time results, I use the following URL: http://ergast.com/api/f1/drivers/alonso/driverStandings
I get his 8 first seasons results, however, the 2010 season does not appear.
Is this intended, or is it a bug?
Which solution is best to get *all* results from up to today for a given driver? Should I add something like http://ergast.com/api/current/f1/drivers/alonso/driverStandings and check if there’s 0 or 1 result? At the end of the season, won’t I be counting the last results twice?
I’ve considered this issue in the past and neither of the two possible behaviours is ideal in all circumstances. The deciding factor for me was realizing what would happen if you wanted to list all the seasons where a particular driver had won the championship e.g:
You probably wouldn’t want this list to include the current season (which Jenson is currently leading but hasn’t necessarily won). To solve your problem I would make two queries:
then check whether the last season attribute returned by the first query is the same as the season attribute returned by the second. If so, ignore the second query.
Obviously, if the two season attribute values are different it means that the current season is still in progress and therefore the second query is returning interim standings, rather than final standings. Hope that helps.
Hi,
Python’s simplejson parser is tripping up on the drivers data because there is a trailing comma on the nationalities property, see here:
http://ergast.com/api/f1/2010/drivers.json
This is not happening in the other api’s I’m using, even the ones that contain driver data, like results for example:
http://ergast.com/api/f1/current/last/results.json
Constructors is a similar api which is also working ok:
http://ergast.com/api/f1/2010/constructors.json
As a workaround I’m pulling driver data from the results api, which is a little inefficient for you so I hope you forgive me
Thanks for the api, I’m using it to power our little fantasy formula 1 league in the office.
Darren
Thanks Darren - it’s now fixed.
Hi,
When I query the database for, say, Alonso’s all-time results, I use the following URL: http://ergast.com/api/f1/drivers/alonso/driverStandings
I get his 8 first seasons results, however, the 2010 season does not appear.
Is this intended, or is it a bug?
Which solution is best to get *all* results from up to today for a given driver? Should I add something like http://ergast.com/api/current/f1/drivers/alonso/driverStandings and check if there’s 0 or 1 result? At the end of the season, won’t I be counting the last results twice?
Note: this behavior might not be consistent with getting all *race* results with the URL: http://ergast.com/api/f1/drivers/alonso/results
In that case I do get the 2010 race results too.
Thanks in advance,
Romain
Romain,
I’ve considered this issue in the past and neither of the two possible behaviours is ideal in all circumstances. The deciding factor for me was realizing what would happen if you wanted to list all the seasons where a particular driver had won the championship e.g:
http://ergast.com/api/f1/drivers/button/driverStandings/1
You probably wouldn’t want this list to include the current season (which Jenson is currently leading but hasn’t necessarily won). To solve your problem I would make two queries:
http://ergast.com/api/f1/drivers/alonso/driverStandings
http://ergast.com/api/f1/current/drivers/alonso/driverStandings
then check whether the last season attribute returned by the first query is the same as the season attribute returned by the second. If so, ignore the second query.
Obviously, if the two season attribute values are different it means that the current season is still in progress and therefore the second query is returning interim standings, rather than final standings. Hope that helps.