鼎鼎知识库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2020.12.1后端接口格式.md 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. > 正常响应
  2. ```
  3. {
  4. "version": "1.0.0.0",
  5. "code": 200,
  6. "message": "this is message",
  7. "isError": false,
  8. "data": {
  9. "id": 1,
  10. "name": "name",
  11. "age": 21
  12. }
  13. }
  14. ```
  15. > 异常响应
  16. ```
  17. {
  18. "version": "1.0.0.0",
  19. "code": 500,
  20. "isError": true,
  21. "responseException": {
  22. "exceptionMessage": "Unhandled Exception occurred. Unable to process the request."
  23. }
  24. }
  25. ```
  26. > 入参字段不符合要求响应
  27. ```
  28. {
  29. "version": "1.0.0.0",
  30. "code": 400,
  31. "isError": true,
  32. "responseException": {
  33. "exceptionMessage": "Request responded with one or more validation errors occurred.",
  34. "validationErrors": [
  35. {
  36. "name": "Name",
  37. "reason": "最大长度5"
  38. },
  39. {
  40. "name": "Location",
  41. "reason": "最大长度5"
  42. }
  43. ]
  44. }
  45. }
  46. ```
  47. # code状态码一栏表
  48. 状态码类型:
  49. - 1**:服务器收到,客户端继续操作
  50. - 2**:服务端处理成功
  51. - 3**:服务端重定向
  52. - 4**:客户端错误
  53. - 5**:服务端错误
  54. 状态码:
  55. - 200:服务端确认客户端请求成功,一般用于GET和POST请求
  56. - 201:服务端创建资源成功
  57. - 204:服务端没有内容返回
  58. - 404:客户端要找的资源不存在
  59. - 412:客户端先决条件错误
  60. - 413:客户端请求实体过大
  61. - 414:客户端请求URL过长
  62. - 415:客户端媒体格式不对
  63. - 419:客户端身份验证超时
  64. - 422:客户端实体验证失败
  65. - 429:客户端请求过多
  66. - 431:客户端请求头过大
  67. - 500:服务端内部错误
  68. - 501:服务端不支持的请求
  69. - 502:服务端收到来自远端的无效响应
  70. - 503:服务端无法处理客户端请求
  71. - 505:服务端不支持请求的HTTP协议版本