I'm trying to build a Rest based service that has broad data coverage of sports data (results/fixtures/teams/players/leagues etc.) and associated statistics.
Coming up with a suitable URI hierarchy has me going around in circles at the moment. For example I could implement...
1) i) version/sports/league/season/entity
1) ii) version/entity/sports/league/season
1) iii) version/sports/entity/league/season
An example makes things slightly clearer (hopefully)...
Take a query that is to return all football players that are playing in the premier league in the 2010/2011 season...
2) i) 1.1/football/premier_league/2010_2011/players
2) ii) a) 1.1/players/football//premier_league/2010_2011
But not all sports (e.g. horse racing - horse and jockey, F1 etc.) really have players, so should players come after the sport?
2) ii) b) 1.1/horses/horse_racing/gold_cup/2010
2) iii) a) 1.1/football/players/premier_league/2010_2011
2) iii) b) 1.1/horse_racing/horses/gold_cup/2010
More example URIs below...
1.1/players/football/premier_league/2010_2011/teams/{id}
returns players in team for season?
1.1/players/football/premier_league returns players in the premier league?
1.1/results/football/premier_league/2010_2011/teams/{id} returns results for team season ?
also I envisage queries like...
1.1/football/premier_league/2010_2011/November/teams/{id}/results
with the month acting as a parameter to narrow the result set.
If the service had to include non-sporting entities, say political elections...there would be no players...
1.1/election/2012/parties/{id}/results
returns results for the political party
1.1/election/2012/parties/{id}/candidates returns the candidates associated with the party
or 1.1/results/election/2012/parties/{id} returns results for the political party
1.1/candidates/election/2012/parties/{id} returns the candidates associated with the party
Any advice on which hierarchy is better? I've tried searching this site and google, but the examples I've found have only covered trivial cases. I think I favour example 2-iii.
Thanks in advance.