REST API URI design

Tags
webserver
Created
Mar 7, 2018 5:27 AM

http://blog.restcase.com/7-rules-for-rest-api-uri-design

Rule #1: A trailing forward slash (/) should not be included in URIs

Rule #2: Forward slash separator (/) must be used to indicate a hierarchical relationship

Rule #3: Hyphens (-) should be used to improve the readability of URIs

Rule #4: Underscores (_) should not be used in URIs

Rule #5: Lowercase letters should be preferred in URI paths

Rule #6: File extensions should not be included in URIs

Rule #7: Should the endpoint name be singular or plural? // 简单化总是使用附属

www.ruanyifeng.com/blog/2018/10/restful-api-best-practices.html

URL 动词 + 宾语

使用复数

HTTP 方法动词的覆盖

URL 避免多级,用查询字符串表达

响应提供链接

SuperMade with Super