@soszrg
2019-12-30T12:50:48.000000Z
字数 3324
阅读 392
anxin
| 错误码 | 说明 |
|---|---|
| 10100 | token过期 |
| 10101 | token错误 |
{"meta":{"message":"token is error","code":10101},"data":{}}
{"meta":{"message":"token is expired","code":10100},"data":{}}
POST /api/v1/oauth2/token/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| grant_type | string | 是 | 固定值:client_credentials |
| client_id | string | 是 | Accesskey ID(联系安心提供) |
| client_secret | string | 是 | Accesskey Secret(联系安心提供) |
返回值
{"meta":{"message":"token info","code":0},"data":{"access_token":"2cwO2K4FVynCWmG..","token_type":"Bearer","expires_in":604800,"scope":"read write groups"}}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| access_token | string | 访问token |
| token_type | string | token类型,固定值Bearer |
| expires_in | int | 有效时长 |
| scope | string | token权限,目前颁发的token拥有所有读写权限 |
Token使用说明
Authorization: Bearer Ks1B79H7FIlT36uT16zj...
错误码
| code | 说明 |
|---|---|
| 10000 | 参数错误,详情参考Response中的message字段 |
GET /api/v1/third/device/
请求参数
无
返回值
{"meta": {"code": 0,"message": "ok"},"data": [{"project_name": "安心e家-测试环境","device_data": [{"device_id": "00000006","residents": [{"name": "张三","cellphone": "18066309133"},{"name": "张三","cellphone": "13336911233"},{"name": "刘-庆科","cellphone": "15715604269"},{"name": "程-庆科","cellphone": "15921574273"}],"house_address":["保利天地","1","1","1","101"],"device_type": 1,"wm_type": "纯净水表""is_online": true,"last_six_month_meter_data": [{"date": "2019-02","total": 0},{"date": "2019-03","total": 0},{"date": "2019-04","total": 0},{"date": "2019-05","total": 0.3},{"date": "2019-06","total": 0.02},{"date": "2019-07","total": 0}],"meter_data_total": 0.32,"last_six_month_bill_data": [{"charge": 0,"previous_reading_data": 0,"reading_data": 0,"from_time": "2019-05-22T09:23:34","to_time": "2019-05-22T11:00:00.035000"},{"charge": 0,"previous_reading_data": 0,"reading_data": 0,"from_time": "2019-05-22T11:00:00.035000","to_time": "2019-05-23T14:00:00.041000"},{"charge": 37.6,"previous_reading_data": 0,"reading_data": 69.89,"from_time": "2019-05-25T10:36:21.810000","to_time": "2019-06-07T09:00:00.048000"},{"charge": 8.49,"previous_reading_data": 69.89,"reading_data": 15.79,"from_time": "2019-06-07T09:00:00.048000","to_time": "2019-06-10T08:30:00.045000"},{"charge": 97.52,"previous_reading_data": 15.79,"reading_data": 181.26,"from_time": "2019-06-10T08:30:00.045000","to_time": "2019-07-01T00:00:00.099000"}],"balance": 10.14}],"project_id": 28},{"project_name": "中梁五期","device_data": [],"project_id": 34},{"project_name": "QQ","device_data": [],"project_id": 46}]}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| 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 | 设备余额 |
错误码
无