As per RFC 3986, the syntax of the generic URI is scheme "://" authority "/" path [ "?" query ] [ "#" fragment ] and following are the rules for API designs:
- Use forward slash (/) separator: This is used to indicate the hierarchical relationship between resources, for example, http://xx.yy.zz/shapes/polygons/quadrilaterals/squares.
- Don't use a trailing forward slash: A trailing forward slash in the URI doesn't have any meaning and may create confusion, for example, http://xx.yy.zz/shapes/polygons/ and http://api.examples.org/shapes/polygons (note the trailing / at the end of the URI). REST API should neither expect trailing slash nor include them in the links that they provide to clients as responses.
- Use hyphens (-): Hyphens ...