落叶知秋|实战指南:10个有关RESTful API良好设计的最佳实践( 二 )


500 – Internal Server Error – API开发者应该避免这种错误 。
使用详细的错误包装错误:
{
"errors": [
{
"userMessage": "Sorry, the requested resource does not exist",
"internalMessage": "No car found in the database",
"code": 34,
"more info": ""
}
]
}
10.允许覆盖http方法一些代理只支持POST 和 GET方法 ,为了使用这些有限方法支持RESTful API , 需要一种办法覆盖http原来的方法 。
使用订制的HTTP头 X-HTTP-Method-Override 来覆盖POST 方法.