Each URI path segment, separated by forward slashes (/), represents a design opportunity. Assigning meaningful values to each path segment helps to clearly communicate the hierarchical structure of a REST API’s resource model design.
- Rule: A singular noun should be used for document names
http://api.soccer.restapi.org/leagues/seattle/teams/trebuchet/players/claudio
- Rule: A plural noun should be used for collection names
http://api.soccer.restapi.org/leagues/seattle/teams/trebuchet/players00
- Rule: A plural noun should be used for store names
http://api.music.restapi.org/artists/mikemassedotcom/playlists
- Rule: A verb or verb phrase should be used for controller names
http://api.college.restapi.org/students/morgan/register
http://api.example.restapi.org/lists/4324/dedupe
- Rule: Variable path segments may be substituted with identity-based values. The URI template example below has three variables (leagueId,teamId, and playerId):
http://api.soccer.restapi.org/leagues/{leagueId}/teams/{teamId}/players/{playerId}