@cfygaoyang
2018-03-23T03:39:14.000000Z
字数 12408
阅读 520
接口文档
POST /enduser/getVerCode/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| loginname | string | 是 | 用户名 |
| appid | string | 是 | FogCloud后台注册app时生成的id,如 35b0707e-78dd-11e7-bb3d-00163e085553 |
返回值
{"meta": {"message": "Send message to phone successfully.","code": 0},"data": {}}
错误码
| 错误代码 | 错误说明 |
|---|---|
| 10000 | 参数错误:参考Response中的message字段 |
| 10250 | app id无效,在服务器找不到对应app |
| 10050 | 内部错误 |
| 10750 | 未开通阿里大于短信的组件 |
POST /enduser/checkVerCode/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| appid | string | 是 | FogCloud后台注册app时生成的id,如 35b0707e-78dd-11e7-bb3d-00163e085553 |
| loginname | string | 是 | 注册用的手机号码或者邮箱 |
| vercode | string | 是 | 验证码 |
返回值
{"meta": {"message": "signup ok","code": 0},"data": {"token": "eyJhbGciOiJIUzI1N...","clientid": "b6d21b047bed11e78d170016..."}}
字段说明
| 返回值字段 | 字段类型 | 字段说明 |
|---|---|---|
| token | string | jwt token |
| clientid | string | 用户在服务器的唯一标识,同enduserid |
错误码
| 错误代码 | 错误说明 |
|---|---|
| 10000 | 参数错误:参考Response中的message字段 |
| 10250 | app id无效,在服务器找不到对应app |
| 10252 | 用户被禁用 |
| 10300 | 验证码过期 |
| 10301 | 验证码错误 |
| 10050 | 服务器内部错误:缺少或者有多个MqttClient |
POST /enduser/login/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| loginname | string | 是 | 用户名 |
| password | string | 是 | 密码 |
| appid | string | 是 | 35b0707e-78dd-11e7-bb3d-00163e085553 |
返回值
{"meta": {"message": "ok","code": 0},"data": {"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbmR1c2VyaWQiOiI3ZGQ2NDJiYTc5MDYxMWU3YmIzZDAwMTYzZTA4NTU1MyIsIm9yaWdfaWF0IjoxNTAyNzA0NTMzLCJpZGVudGlmaWNhdGlvbiI6IjEzNTEwMjYwNTkxIiwiZXhwIjoxNTAzMzA5MzMzLCJhcHBpZCI6IjM1YjA3MDdlLTc4ZGQtMTFlNy1iYjNkLTAwMTYzZTA4NTU1MyJ9.5ozcuYuX03SHNSB41OmezZl_DQr9ymT_o6sEnwDXYpU","clientid": "7dd642ba790611e7bb3d00163e085553"}}
字段说明
| 字段 | 类型 | 说明 |
|---|
POST /enduser/refreshToken/
Headers
| 参数 | 必须 | 内容 |
|---|---|---|
| Authorization | 是 | JWT token |
返回值
{"meta": {"message": "ok","code": 0},"data": {"token": "eyJhbGciOiJIUzI1N...","clientid": "b6d21b047bed11e78d170016..."}}
字段说明
| 返回值字段 | 字段类型 | 字段说明 |
|---|---|---|
| token | string | jwt token |
| clientid | string | 终端用户ID,同enduserid |
错误码
| 错误代码 | 错误说明 |
|---|---|
| 10000 | 参数错误:缺少参数或者参数类型错误等 |
| 10101 | token错误 |
| 10102 | token已过刷新有效期,无法刷新 |
| 10250 | token对应的用户没找到 |
| 10252 | 用户被禁用 |
POST /enduser/verifyToken/
Headers
| 参数 | 必须 | 内容 |
|---|---|---|
| Authorization | 是 | JWT token |
返回值
{"meta": {"message": "ok","code": 0},"data": {"token": "eyJhbGciOiJIUzI1N...","clientid": "b6d21b047bed11e78d170016..."}}
字段说明
| 返回值字段 | 字段类型 | 字段说明 |
|---|---|---|
| token | string | jwt token |
| clientid | string | 终端用户ID,同enduserid |
错误码
| 错误代码 | 错误说明 |
|---|---|
| 10000 | 参数错误:缺少参数或者参数类型错误等 |
| 10101 | token错误 |
| 10102 | token已过刷新有效期,无法刷新 |
| 10250 | token对应的用户没找到 |
| 10252 | 用户被禁用 |
POST /enduser/resetPassword/
Headers
| 参数 | 必须 | 内容 |
|---|---|---|
| Authorization | 是 | JWT token |
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| password1 | string | 是 | 密码,至少4个字符,最多20个字符 |
| password2 | string | 是 | 确认密码,至少4个字符,最多20个字符 |
返回值
{"meta": {"message": "Update password successfully.","code": 0},"data": {}}
错误码
| 错误代码 | 错误说明 |
|---|---|
| 10000 | 参数错误:参考Response的message字段 |
POST /upload/img/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| img | FILE | 是 | 图片文件 png jpg gif |
返回值
{"meta": {"code": 0,"message": "upload success"},"data": "jd.fogcloud.io/storage/img/20170727164915.png"}
字段说明
| 返回值字段 | 字段类型 | 字段说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求消息提示 |
| data | string | 上传的可访问图片路径 |
PUT /user/update_avatar/[enduserid]
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| enduserid | string | 是 | 终端用户id |
| avatar | string | 是 | 图片url |
返回值
{"meta":{"message":"update success","code":0},"data":{"avatar":"123.png"}}
字段说明
| 返回值字段 | 字段类型 | 字段说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求消息提示 |
| avatar | string | 编辑的头像url |
POST /get_token/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| username | string | 是 | 用户名 |
| password | string | 是 | 密码 |
返回值
{"meta": {"code": 0,"messsage": "success"},"data": {"token": "23cfbd8480c7c6737f05204a6ddb617c05faf8dd"}}
字段说明
| 返回值字段 | 字段类型 | 字段说明 |
|---|
GET /product/?page=[PAGE]
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| page | int | 否 | 页数 |
返回值
{"meta": {"code": 0,"message": "find success"},"data": {"count": 2,"next": null,"previous": null,"results": [{"id": 1,"product_id": "123456","product_name": "cao","product_type": "1"},{"id": 2,"product_id": "qwert","product_name": "wefgf","product_type": "asdf"}]}}
字段说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求提示 |
| count | int | 数据总条数 |
| next | string | 下一页的链接 |
| previous | string | 上一页的链接 |
| results | array | 数据列表 |
| id | int | 产品主键 |
| product_id | string | SDS 产品 product_id |
| product_name | string | 产品名称 |
| prodcut_type | string | 产品类型 |
备注
数据列表一页显示10条
POST /product/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| product_id | string | 是 | SDS 产品 product_id |
| prodcut_name | string | 是 | 产品名称 |
| prodcut_type | string | 是 | 产品类型 |
返回值
{"meta":{"code" : 0,"message" : "insert success"},"data":{"id": 1,"product_id": "123456","product_name": "cao","product_type": "1"}}
字段说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求提示 |
| data | json | 添加的产品信息 |
GET /product/detail/[ID]
返回值
{"meta": {"code": 0,"message": "find success"},"data": {"id": 1,"product_id": "123456","product_name": "cao","product_type": "1"}}
字段说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | 整型 | 错误码;0代表正确,反之错误 |
| message | 字符串 | 请求提示 |
| id | 整型 | 产品主键 |
| product_id | 字符串 | SDS 产品 product_id |
| product_name | 字符串 | 产品名称 |
| product_type | 字符串 | 产品类型 |
PUT /product/detail/[ID]
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| ID | 整型 | 是 | 产品主键 |
| product_id | 字符串 | 是 | SDS 产品 product_id |
| product_name | 字符串 | 是 | 产品名称 |
| product_type | 字符串 | 是 | 产品类型 |
返回值
{"meta": {"code" : 0,"message" : "update success"},"data": {"id": 4,"product_id": "2345678","product_name": "2345678","product_type": "sdfghj"}}
字段说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求提示 |
| data | json | 编辑后的产品信息 |
DELETE /product/detail/[ID]
返回值
{"meta": {"code" : 0,"message" : "delete success"},"data": {}}
字段说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | 整型 | 错误码;0代表正确,反之错误 |
| message | 字符串 | 请求提示 |
GET /product/api/?page=[PAGE]
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| page | int | 否 | 页数 |
返回值
{"meta": {"code": 0,"message": "find success"},"data": {"count": 2,"next": null,"previous": null,"results": [{"id": 1,"product_id": "123456","product_name": "cao","product_type": "1"},{"id": 2,"product_id": "qwert","product_name": "wefgf","product_type": "asdf"}]}}
参数说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求提示 |
| count | int | 数据总条数 |
| next | string | 下一页的链接 |
| previous | string | 上一页的链接 |
| results | 数组 | 数据列表 |
| id | int | 产品主键 |
| product_id | string | SDS 产品 product_id |
| product_name | string | 产品名称 |
| prodcut_type | string | 产品类型 |
备注
数据列表一页显示10条
GET /product/api/detail/[ID]
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| ID | int | 是 | 产品主键 |
返回值
{"meta": {"code": 0,"message": "find success"},"data": {"id": 1,"product_id": "123456","product_name": "cao","product_type": "1"}}
参数说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求消息提示 |
| id | int | 产品主键 |
| product_id | string | SDS 产品 product_id |
| product_name | string | 产品名称 |
| product_type | string | 产品类型 |
GET /product/template/?page=[PAGE]
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| page | int | 是 | 页数 |
返回值
{"meta": {"code": 0,"message": "find success"},"data": {"count": 1,"next": null,"previous": null,"results": [{"id": 1,"template_name": "dfd","template_json": "{\"name\":\"gaoyang\"}","template_read": 23,"product": 1}]}}
字段说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求提示 |
| count | int | 数据总条数 |
| next | string | 下一页的链接 |
| previous | string | 上一页的链接 |
| results | array | 数据列表 |
| id | int | 模板主键 |
| template_name | string | 模板名称 |
| template_json | json | 下发指令模板 |
| template_read | int | 是否可更改;0代表 template_json 只读,反之可编辑 |
| product | int | 产品主键 |
备注
数据列表一页显示10条
POST /product/template/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| template_name | string | 是 | 模板名称 |
| template_json | json | 是 | 下发指令模板 |
| template_read | int | 是 | 模板是否只读;0代表template_json只读,反之可编辑 |
| product | int | 是 | 产品主键 |
返回值
{"meta": {"code" : 0,"message" : "insert success"},"data": {"id": 1,"template_name": "dfd","template_json": "{\"name\":\"gaoyang\"}","template_read": 23,"product": 1}}
字段说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求消息提示 |
| data | json | 添加的模板信息 |
GET /product/template/detail/[ID]
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| ID | int | 是 | 模板主键 |
返回值
{"meta": {"code": 0,"message": "find success"},"data": {"id": 1,"template_name": "dfd","template_json": "{\"name\":\"gaoyang\"}","template_read": 23,"product": 1}}
字段说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求消息提示 |
| id | int | 模板主键 id |
| template_name | string | 模板名称 |
| template_json | json | 下发指令模板 |
| template_read | int | 是否可更改;0代表 template_json 只读,反之可编辑 |
| product | int | 产品主键 |
PUT /product/template/detail/[ID]
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| ID | int | 是 | 模板主键 |
| template_name | string | 是 | 模板名称 |
| template_json | json | 是 | 下发指令模板 |
| template_read | int | 是 | 模板是否只读;0代表template_json只读,反之可编辑 |
| product | int | 是 | 产品主键 |
返回值
{"meta": {"code" : 0,"message" : "update success"},"data": {"id": 1234,"template_name": "sdfghjk","template_json": "{\"name\":\"gaoyang\"}","template_read": 0,"product": 1}}
字段说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求消息提示 |
| data | json | 编辑后的模板信息 |
DELETE /product/template/detail/[ID]
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| ID | int | 是 | 模板主键 |
返回值
{"meta": {"code" : 0,"message" : "delete success"},"data": {}}
字段说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求消息提示 |
GET /product/template/[ID]
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| ID | int | 是 | 产品主键 |
返回值
{"meta": {"code": 0,"message": "find success"},"data": {"count": 1,"next": null,"previous": null,"results": [{"id": 1,"template_name": "dfd","template_json": "123","template_read": 23,"product": 1}]}}
字段说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求提示 |
| count | int | 数据总条数 |
| next | string | 下一页的链接 |
| previous | strin | 上一页的链接 |
| results | array | 数据列表 |
| id | int | 模板主键 |
| template_name | string | 模板名称 |
| template_json | json | 下发指令模板 |
| template_read | int | 是否可更改;0代表 template_json 只读,反之可编辑 |
| product | int | 产品主键 |
备注
数据列表一页显示10条
GET /product/api/template/detail/[product_id]
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| product_id | string | 是 | SDS model |
返回值
{"meta": {"code": 0,"message": "find success"},"data": {"id": 1,"template_name": "dfd","template_json": "{\"name\":\"gaoyang\"}","template_read": 23,"product": 1}}
参数说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求消息提示 |
| id | int | 模板主键 id |
| template_name | string | 模板名称 |
| template_json | json | 下发指令模板 |
| template_read | int | 是否可更改;0代表 template_json 只读,反之可编辑 |
| product | int | 产品主键 |
GET /product/api/template/[ID]
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| ID | int | 是 | 产品主键 |
返回值
{"meta": {"code": 0,"message": "find success"},"data": {"count": 1,"next": null,"previous": null,"results": [{"id": 1,"template_name": "dfd","template_json": "123","template_read": 23,"product": 1}]}}
参数说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求提示 |
| count | int | 数据总条数 |
| next | string | 下一页的链接 |
| previous | string | 上一页的链接 |
| results | array | 数据列表 |
| id | int | 模板主键 |
| template_name | string | 模板名称 |
| template_json | json | 下发指令模板 |
| template_read | int | 是否可更改;0代表 template_json 只读,反之可编辑 |
| product | int | 产品主键 |
备注
数据列表一页显示10条
POST /device/api/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| end_user | int | 是 | 用户主键 |
| device_id | string | 是 | 设备device_id |
| product_id | string | 是 | SDS产品product_id |
返回值
{"meta": {"code": 0,"message": "insert success"},"data": {"id": 1,"end_user": "sdfghjk","product_id": "23456789ihg","device_id": "tyuiopsdfghj"}}
字段说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求消息提示 |
| data | json | 添加成功的数据 |
DELETE /device/api/{device_id}
Headers
| 参数 | 必须 | 内容 |
|---|---|---|
| Authorization | 是 | JWT token |
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| device_id | string | 是 | 设备device_id (数字和字符组成) |
返回值
{"meta": {"code": 0,"message": "delete success"},"data": {}}
字段说明
| 参数 | 类型 | 说明 |
|---|---|---|
| code | int | 错误码;0代表正确,反之错误 |
| message | string | 请求消息提示 |
GET /feedback/message/
Headers
| 参数 | 必须 | 内容 |
|---|---|---|
| Authorization | 是 | JWT token |
返回值
{"meta": {"message": "查询成功。","code": 0},"data": [{"id": 3,"user": "7dd642ba790611e7bb3d00163e085553","phone": "334444","datetime": "2017-08-10T17:47:01.525958","content": "88444","problem": "44","device": "xxxxxxxxxxxx","respond": false},{"id": 2,"user": "7dd642ba790611e7bb3d00163e085553","phone": "111111111111","datetime": "2017-08-10T17:37:56.707873","content": "8888888","problem": "888","device": "8888888888888888888","respond": false},{"id": 1,"user": "7dd642ba790611e7bb3d00163e085553","phone": "13510260591","datetime": "2017-08-10T17:29:31.527515","content": "xfweaegadf","problem": "sfaefawe","device": "dsfadsgaeaegeaefe","respond": true}]}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| user | string | enduser主键,enduserid |
| content | string | 反馈内容 |
| problem | string | 问题类型 |
| respond | bool | 是否被回复 |
POST /feedback/message/
Headers
| 参数 | 必须 | 内容 |
|---|---|---|
| Authorization | 是 | JWT token |
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| phone | string | 是 | 联系手机号 |
| content | string | 是 | 反馈内容 |
| problem | string | 是 | 问题类型 |
| devcie | string | 是 | 设备ID |
返回值
{"meta": {"message": "添加成功。","code": 0},"data": {"id": 5,"user": "7dd642ba790611e7bb3d00163e085553","phone": "6666","datetime": "2017-08-15T09:54:16.291976","content": "test,test.","problem": "11","device": "xxxxxxxxxxxx","respond": false}}
字段说明
| 字段 | 类型 | 说明 |
|---|
DELETE /feedback/message/
Headers
| 参数 | 必须 | 内容 |
|---|---|---|
| Authorization | 是 | JWT token |
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| record_id | int | 是 | 反馈记录主键 |
返回值
{"meta": {"message": "删除成功。","code": 0},"data": {}}
字段说明
| 字段 | 类型 | 说明 |
|---|
GET /feedback/messages/
返回值
{"meta": {"message": "查询成功。","code": 0},"data": [{"id": 3,"user": "7dd642ba790611e7bb3d00163e085553","phone": "334444","datetime": "2017-08-10T17:47:01.525958","content": "88444","problem": "44","device": "xxxxxxxxxxxx","respond": false},{"id": 2,"user": "7dd642ba790611e7bb3d00163e085553","phone": "111111111111","datetime": "2017-08-10T17:37:56.707873","content": "8888888","problem": "888","device": "8888888888888888888","respond": false},{"id": 1,"user": "7dd642ba790611e7bb3d00163e085553","phone": "13510260591","datetime": "2017-08-10T17:29:31.527515","content": "xfweaegadf","problem": "sfaefawe","device": "dsfadsgaeaegeaefe","respond": true}]}
字段说明
| 字段 | 类型 | 说明 |
|---|
DELETE /feedback/messages/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| record_id | int | 是 | 反馈记录主键 |
返回值
{"meta": {"message": "删除成功。","code": 0},"data": {}}
字段说明
| 字段 | 类型 | 说明 |
|---|
GET /feedback/messageResponse/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| record_id | int | 是 | 反馈记录主键 |
返回值
{"meta": {"message": "查询成功。","code": 0},"data": [{"id": 5,"record": 1,"datetime": "2017-08-14T17:35:48.860838","content": "多次尝试"}]}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| record | int | 反馈记录主键 |
POST /feedback/messageResponse/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| record | int | 是 | 反馈记录主键 |
| content | string | 是 | 回复内容 |
返回值
{"meta": {"message": "添加成功。","code": 0},"data": {"id": 6,"record": 2,"datetime": "2017-08-15T10:09:15.729327","content": "回复演示"}}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| record | int | 反馈记录主键 |
DELETE /feedback/messageResponse/
请求参数
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| record_id | int | 是 | 回复记录主键 |
返回值
{"meta": {"message": "删除成功。","code": 0},"data": {}}
字段说明
| 字段 | 类型 | 说明 |
|---|
GET /feedback/problemTypes/
返回值
{"meta": {"message": "获取问题类型。","code": 0},"data": ["设备使用问题","APP使用出错","设备配网问题","功能与设计建议","其他"]}
字段说明
| 字段 | 类型 | 说明 |
|---|
GET /feedback/FAQ/
返回值
{"meta": {"message": "获取常见问题。","code": 0},"data": [{"content": "确认是否联网,有没有断开设备。","title": "设备为什么连接不成功?"},{"content": "可以换取礼品,只能在积分商城板块类目下可以使用。","title": "怎么添加设备?"},{"content": "也可以接受手机热点的连接。","title": "设备只能连接无线吗?"}]}
字段说明
| 字段 | 类型 | 说明 |
|---|
GET api/device_bsy_today/{enduserid}
GET api/device_bsy_week/{enduserid}
GET api/device_bsy_month/{enduserid}