[关闭]
@soszrg 2019-12-30T12:50:48.000000Z 字数 3324 阅读 392

OpenApi文档(由客户服务端调用)


anxin


说明

Token错误码

错误码 说明
10100 token过期
10101 token错误
  1. {
  2. "meta":{
  3. "message":"token is error",
  4. "code":10101
  5. },
  6. "data":{
  7. }
  8. }
  1. {
  2. "meta":{
  3. "message":"token is expired",
  4. "code":10100
  5. },
  6. "data":{
  7. }
  8. }

获取访问Token

POST /api/v1/oauth2/token/

请求参数

参数 类型 必须 说明
grant_type string 固定值:client_credentials
client_id string Accesskey ID(联系安心提供)
client_secret string Accesskey Secret(联系安心提供)

返回值

  1. {
  2. "meta":{
  3. "message":"token info",
  4. "code":0
  5. },
  6. "data":{
  7. "access_token":"2cwO2K4FVynCWmG..",
  8. "token_type":"Bearer",
  9. "expires_in":604800,
  10. "scope":"read write groups"
  11. }
  12. }

字段说明

字段 类型 说明
access_token string 访问token
token_type string token类型,固定值Bearer
expires_in int 有效时长
scope string token权限,目前颁发的token拥有所有读写权限

Token使用说明

  1. Authorization: Bearer Ks1B79H7FIlT36uT16zj...

错误码

code 说明
10000 参数错误,详情参考Response中的message字段

获取设备数据(token)

GET /api/v1/third/device/

请求参数

返回值

  1. {
  2. "meta": {
  3. "code": 0,
  4. "message": "ok"
  5. },
  6. "data": [
  7. {
  8. "project_name": "安心e家-测试环境",
  9. "device_data": [
  10. {
  11. "device_id": "00000006",
  12. "residents": [
  13. {
  14. "name": "张三",
  15. "cellphone": "18066309133"
  16. },
  17. {
  18. "name": "张三",
  19. "cellphone": "13336911233"
  20. },
  21. {
  22. "name": "刘-庆科",
  23. "cellphone": "15715604269"
  24. },
  25. {
  26. "name": "程-庆科",
  27. "cellphone": "15921574273"
  28. }
  29. ],
  30. "house_address":[
  31. "保利天地",
  32. "1",
  33. "1",
  34. "1",
  35. "101"
  36. ]
  37. ,
  38. "device_type": 1,
  39. "wm_type": "纯净水表"
  40. "is_online": true,
  41. "last_six_month_meter_data": [
  42. {
  43. "date": "2019-02",
  44. "total": 0
  45. },
  46. {
  47. "date": "2019-03",
  48. "total": 0
  49. },
  50. {
  51. "date": "2019-04",
  52. "total": 0
  53. },
  54. {
  55. "date": "2019-05",
  56. "total": 0.3
  57. },
  58. {
  59. "date": "2019-06",
  60. "total": 0.02
  61. },
  62. {
  63. "date": "2019-07",
  64. "total": 0
  65. }
  66. ],
  67. "meter_data_total": 0.32,
  68. "last_six_month_bill_data": [
  69. {
  70. "charge": 0,
  71. "previous_reading_data": 0,
  72. "reading_data": 0,
  73. "from_time": "2019-05-22T09:23:34",
  74. "to_time": "2019-05-22T11:00:00.035000"
  75. },
  76. {
  77. "charge": 0,
  78. "previous_reading_data": 0,
  79. "reading_data": 0,
  80. "from_time": "2019-05-22T11:00:00.035000",
  81. "to_time": "2019-05-23T14:00:00.041000"
  82. },
  83. {
  84. "charge": 37.6,
  85. "previous_reading_data": 0,
  86. "reading_data": 69.89,
  87. "from_time": "2019-05-25T10:36:21.810000",
  88. "to_time": "2019-06-07T09:00:00.048000"
  89. },
  90. {
  91. "charge": 8.49,
  92. "previous_reading_data": 69.89,
  93. "reading_data": 15.79,
  94. "from_time": "2019-06-07T09:00:00.048000",
  95. "to_time": "2019-06-10T08:30:00.045000"
  96. },
  97. {
  98. "charge": 97.52,
  99. "previous_reading_data": 15.79,
  100. "reading_data": 181.26,
  101. "from_time": "2019-06-10T08:30:00.045000",
  102. "to_time": "2019-07-01T00:00:00.099000"
  103. }
  104. ],
  105. "balance": 10.14
  106. }
  107. ],
  108. "project_id": 28
  109. },
  110. {
  111. "project_name": "中梁五期",
  112. "device_data": [],
  113. "project_id": 34
  114. },
  115. {
  116. "project_name": "QQ",
  117. "device_data": [],
  118. "project_id": 46
  119. }
  120. ]
  121. }

字段说明

字段 类型 说明
project_name string 项目名
project_id int 项目id
device_data array 设备数据
device_id string 设备id/表号
residents array 住户信息
residents.name string 住户名
residents.cellphone string 住户手机号
house_address array 按小区、单元、楼栋、层、室分开的地址数组,如:["保利天地", "1", "1", "1", "101"]则表示保利天地小区1幢1单元1层101室
device_type int 设备类型:1 水表 0 电表
wm_type string 水表子类型:纯净水表和自来水表;电表为空字符串
is_online bool 是否在线:true 在线 false 离线
last_six_month_meter_data array 最近6个月的用量数据[一定为6条数据]
last_six_month_meter_data.date string 日期
last_six_month_meter_data.total float 用量
meter_data_total float 累计用量
last_six_month_bill_data array 最近六个月的账单[可能少于6条]
last_six_month_bill_data.charge float 本期账单费用
last_six_month_bill_data.reading_data float 本次账期用量
last_six_month_bill_data.previous_reading_data float 上个账期用量
last_six_month_bill_data.from_time string 本次账期起始时间
last_six_month_bill_data.to_time string 本次账期截止时间
balance float 设备余额

错误码


添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注