@soszrg
2017-09-21T06:18:37.000000Z
字数 7845
阅读 406
v3文档 v3前端接口
所有标明token认证的接口,需要在请求header中添加Authorization头域,如下示例:
Authorization: token eyJhbGciOiJ...
| code | 说明 |
|---|---|
| 10100 | token过期 |
| 10101 | token错误 |
POST /v3/accounts/vercode/
请求参数
| 参数名 | 类型 | 必须 | 说明 |
|---|---|---|---|
| identification | string | 是 | 邮箱或手机号 |
| type | int | 否 | 验证码类型 |
返回值
{"meta": {"message": "短信发送成功","code": 0},"data": {}}
或者
{"meta": {"message": "邮件发送成功","code": 0},"data": {}}
错误码
| 错误代码 | 错误说明 |
|---|---|
| 10000 | 参数错误:参考Response中的message字段 |
POST /v3/accounts/signup/
请求参数
| 参数名 | 类型 | 必须 | 说明 |
|---|---|---|---|
| username | string | 是 | 用户名(全站唯一,) |
| identification | string | 是 | 邮箱或手机号码(全站唯一) |
| password | string | 是 | 设置的登录密码 |
| vercode | string | 是 | 验证码 |
返回值
{"meta": {"message": "注册成功","code": 0},"data": {}}
错误码
| 错误代码 | 错误说明 |
|---|---|
| 10000 | 参数错误:参考Response中的message字段 |
| 10300 | 验证码过期 |
| 10301 | 验证码错误 |
| 10050 | 未知错误 |
POST /v3/accounts/signin/
请求参数
| 参数名 | 类型 | 必须 | 说明 |
|---|---|---|---|
| identification | string | 是 | 邮箱或手机号码 |
| password | string | 是 | 登录密码 |
返回值
{"meta": {"message": "登录成功!","code": 0},"data": {"token": "9d39bfef2d555f4863d091e8780b50ad8b8af34a","user": {"user": {"email": "zhangrg@mxchip.com","username": "zrg","last_login": "2017-09-12T10:09:23.897582","date_joined": "2017-05-25T14:11:46.133734"},"mugshot": null,"language": "en","phone": "","gender": null,"website": "ss","name": "aaa","location": "sss","birth_date": null,"about_me": "","companyname": "sss","headimage": "https://mxchip-fog.oss-cn-beijing.aliyuncs.com/profile/jGySNXTsYB.jpg","regtype": 0,"endpointname": "060b6684411111e7b7ac00163e30fc50","mqtthost": "060b6684411111e7b7ac00163e30fc50.mqtt.iot.gz.baidubce.com:1883","mqttssl": "060b6684411111e7b7ac00163e30fc50.mqtt.iot.gz.baidubce.com:1884","mqttwss": "060b6684411111e7b7ac00163e30fc50.mqtt.iot.gz.baidubce.com:8884","kafka": ""}}}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| token | string | 用户token,用于需要token认证的接口 |
| user.user.email | string | 用户注册邮箱 |
| user.user.username | string | 用户名 |
| user.user.last_login | string | 上次登录时间 |
| user.user.date_joined | string | 注册时间 |
| user.phone | string | 注册手机号 |
| user.headimage | string | 用户头像 |
错误码
| 错误代码 | 错误说明 |
|---|---|
| 10000 | 参数错误:参考Response中的message字段 |
| 10602 | 用户被禁用 |
| 10603 | 用户名或密码错误 |
POST /v3/accounts/signout/
请求参数
无
返回值
{"meta": {"message": "注销成功!","code": 0},"data": {}}
错误码
无
PUT /v3/accounts/password/reset/
请求参数
| 参数名 | 类型 | 必须 | 说明 |
|---|---|---|---|
| identification | string | 是 | 邮箱或手机号码 |
| newpasswd | string | 是 | 新密码 |
| vercode | string | 是 | 验证码 |
返回值
{"meta": {"message": "重置密码成功!","code": 0},"data": {}}
错误码
| 错误代码 | 错误说明 |
|---|---|
| 10000 | 参数错误:参考Response中的message字段 |
GET /v3/product/list/
请求参数
| 参数名 | 类型 | 必须 | 说明 |
|---|---|---|---|
| type | int | 是 | 产品类别:0→消费电子类产品,1→工业类产品,2→OTA产品 |
返回值
{"meta":{"message":"产品列表获取成功","code":0},"data":{"count":2,"result":[{"productid":"f61f16a4...","pname":"APP—球泡灯","brand":"庆科","model":"A10"},{"productid":"6da6efb294...","pname":"APP—插座","brand":"庆科","model":"A09"}]}}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| productid | string | 产品ID |
| pname | string | 产品名字 |
| brand | string | 品牌名 |
| model | string | 型号名 |
错误码
| 错误代码 | 错误说明 |
|---|---|
| 10000 | 参数错误:参考Response中的message字段 |
GET /v3/product/productinfo/
请求参数
| 参数名 | 类型 | 必须 | 说明 |
|---|---|---|---|
| productid | string | 是 | 产品ID |
返回值
{"meta":{"message":"产品详情获取成功","code":0},"data":{"productid":"30eb18c687...","attributes":{},"pname":"faf","brand":"faf","model":"afaf","commonflag":0,"abilitytype":0,"description":"","url":"","pic":"https://mxchip-fog.oss-cn-beijing.aliyuncs.com/product/BWsEhisZfT.png","secretKey":"","identifier":0,"pubtime":"2017-08-22T15:41:02.289170","link_mode":"0","gatewaytype":0,"checkvalidity":false,"ipstaticfiles":null,"status":0,"submittime":"2017-08-22T15:41:02.289198","modifytime":null,"auditmark":3,"audittime":null,"wx_flag":false,"wx_product_id":"","access_token_url":"","istransfered":false,"activation_price":0,"message_price":0,"owner":4,"producttype":2,"submitter":4,"modifier":null,"auditor":null}}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| productid | string | 产品ID |
| pname | string | 产品名字 |
| brand | string | 品牌名 |
| abilitytype | string | 产品类别:0→消费电子类产品,1→工业类产品,2→OTA产品 |
| pic | string | 产品图标 |
| pubtime | string | 产品发布时间 |
| status | int | 当前状态:0→开发中,1→已上线,2→审核中 |
| submittime | string | 产品创建时间 |
| modifytime | string | 产品修改时间 |
| istransfered | bool | 是否开启数据转存 |
| owner | int | 拥有者 |
| producttype | int | 产品所属类型 |
| owner | int | 拥有者 |
错误码
| 错误代码 | 错误说明 |
|---|---|
| 10000 | 参数错误:参考Response中的message字段 |
| 10150 | 产品ID错误 |
| 10151 | 当前用户无权限操作该产品 |
GET /v3/product/producttypelist/
请求参数
无
返回值
{"meta":{"message":"产品类型列表获取成功","code":0},"data":[{"id":2,"bigclass":"故事机","smallclass":"故事机","commonflag":0,"visible":false},{"id":4,"bigclass":"生活电器","smallclass":"空气检测仪","commonflag":0,"visible":false},{"id":5,"bigclass":"生活电器","smallclass":"扫地机器人","commonflag":0,"visible":false}]}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| id | int | 产品类型ID |
| bigclass | string | 产品大类名 |
| smallclass | string | 产品子类名(前端显示该名字) |
| commonflag | bool | 公版标识:true→公版,false→订制 |
| visible | bool | 是否对其他用户可见, true→可见,false→不可见 |
错误码
| 错误代码 | 错误说明 |
|---|---|
| 10000 | 参数错误:参考Response中的message字段 |
| 10150 | 产品ID错误 |
| 10151 | 当前用户无权限操作该产品 |
POST /v3/product/productinfo/
请求参数
| 参数名 | 类型 | 必须 | 说明 |
|---|---|---|---|
| abilitytype | int | 是 | 产品类别 |
| brand | string | 是 | 品牌 |
| model | string | 是 | 型号 |
| pname | string | 是 | 产品名 |
| producttype | int | 是 | 产品类型(通过产品类别接口获取类别list) |
返回值
{"meta":{"message":"产品创建成功","code":0},"data":{"productid":"8b34fd32976c11e7b7ac00163e30fc50","attributes":{},"pname":"aaa","brand":"aa","model":"aa","commonflag":0,"abilitytype":0,"description":"","url":"","pic":"https://mxchip-fog.oss-cn-beijing.aliyuncs.com/product/productdefault.jpg","secretKey":"","identifier":0,"pubtime":"2017-09-12T11:43:30.586489","link_mode":"","gatewaytype":0,"checkvalidity":false,"ipstaticfiles":null,"status":0,"submittime":"2017-09-12T11:43:30.586626","modifytime":null,"auditmark":3,"audittime":null,"wx_flag":false,"wx_product_id":"","access_token_url":"","istransfered":false,"activation_price":0,"message_price":0,"owner":4,"producttype":4,"submitter":4,"modifier":null,"auditor":null}}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| productid | string | 产品ID |
| pname | string | 产品名字 |
| brand | string | 品牌名 |
| abilitytype | string | 产品类别:0→消费电子类产品,1→工业类产品,2→OTA产品 |
| pic | string | 产品图标 |
| pubtime | string | 产品发布时间 |
| status | int | 当前状态:0→开发中,1→已上线,2→审核中 |
| submittime | string | 产品创建时间 |
| modifytime | string | 产品修改时间 |
| istransfered | bool | 是否开启数据转存 |
| owner | int | 拥有者 |
| producttype | int | 产品所属类型 |
| owner | int | 拥有者 |
错误码
| 错误代码 | 错误说明 |
|---|---|
| 10000 | 参数错误:参考Response中的message字段 |
| 10150 | 产品ID错误 |
| 10151 | 当前用户无权限操作该产品 |
PUT /v3/product/productinfo/
请求参数
| 参数名 | 类型 | 必须 | 说明 |
|---|---|---|---|
| productid | string | 是 | 产品ID |
| abilitytype | int | 否 | 产品类别 |
| brand | string | 否 | 品牌 |
| model | string | 否 | 型号 |
| pname | string | 否 | 产品名 |
| producttype | int | 否 | 产品类型(通过产品类别接口获取类别list) |
| checkvalidity | bool | 否 | 是否强制校验 |
| description | string | 否 | 产品描述 |
| pic | string | 否 | 产品图标 |
| url | string | 否 | 产品介绍链接 |
返回值
{"meta":{"message":"产品基本信息更新成功","code":0},"data":{"productid":"30eb18c6870d...","attributes":{},"pname":"faf","brand":"faf","model":"afaf","commonflag":0,"abilitytype":0,"description":"","url":"","pic":"https://mxchip-fog.oss-cn-beijing.aliyuncs.com/product/BWsEhisZfT.png","secretKey":"","identifier":0,"pubtime":"2017-09-12T11:56:31.561388","link_mode":"0","gatewaytype":0,"checkvalidity":false,"ipstaticfiles":null,"status":0,"submittime":"2017-09-12T11:56:31.561417","modifytime":null,"auditmark":3,"audittime":null,"wx_flag":false,"wx_product_id":"","access_token_url":"","istransfered":false,"activation_price":0,"message_price":0,"owner":4,"producttype":2,"submitter":4,"modifier":null,"auditor":null}}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| productid | string | 产品ID |
| pname | string | 产品名字 |
| brand | string | 品牌名 |
| abilitytype | string | 产品类别:0→消费电子类产品,1→工业类产品,2→OTA产品 |
| pic | string | 产品图标 |
| pubtime | string | 产品发布时间 |
| status | int | 当前状态:0→开发中,1→已上线,2→审核中 |
| submittime | string | 产品创建时间 |
| modifytime | string | 产品修改时间 |
| istransfered | bool | 是否开启数据转存 |
| owner | int | 拥有者 |
| producttype | int | 产品所属类型 |
错误码
| 错误代码 | 错误说明 |
|---|---|
| 10000 | 参数错误:参考Response中的message字段 |
| 10150 | 产品ID错误 |
| 10151 | 当前用户无权限操作该产品 |
DELETE /v3/product/productinfo/
请求参数
| 参数名 | 类型 | 必须 | 说明 |
|---|---|---|---|
| productid | string | 是 | 产品ID |
返回值
{"meta":{"message":"产品基本信息删除成功","code":0},"data":{"productid":"30eb18c6870d...","attributes":{},"pname":"faf","brand":"faf","model":"afaf","commonflag":0,"abilitytype":0,"description":"","url":"","pic":"https://mxchip-fog.oss-cn-beijing.aliyuncs.com/product/BWsEhisZfT.png","secretKey":"","identifier":0,"pubtime":"2017-09-12T11:56:31.561388","link_mode":"0","gatewaytype":0,"checkvalidity":false,"ipstaticfiles":null,"status":0,"submittime":"2017-09-12T11:56:31.561417","modifytime":null,"auditmark":3,"audittime":null,"wx_flag":false,"wx_product_id":"","access_token_url":"","istransfered":false,"activation_price":0,"message_price":0,"owner":4,"producttype":2,"submitter":4,"modifier":null,"auditor":null}}
错误码
| 错误代码 | 错误说明 |
|---|---|
| 10000 | 参数错误:参考Response中的message字段 |
| 10150 | 产品ID错误 |
| 10151 | 当前用户无权限操作该产品 |
| 10152 | 当前产品已经有设备激活,无法删除 |