Restful API Response Definition
Success Message
{
"code":0,
"data":any // any type of result
}
Failed Message
{
"code":1, // 1-9999 >1
"message":"string", // error message
"detail":any // any detail of error message
}
Http Status Code HTTP Status Code
20x success status
Usually only use 200.
I only used 200 for success.
30x Redirect
4xx Client Response, Usually caused by the client side.
- 400 for parameters error message
- 422 for error message in process
评论已关闭