[关闭]
@cfygaoyang 2017-08-17T06:06:29.000000Z 字数 4166 阅读 628

后台管理

产品信息接口文档

分页获取产品列表:

GET /product/?page=[PAGE]

参数 类型 必须 说明
PAGE 整型 页数
  1. {
  2. "meta": {
  3. "code": 0,
  4. "message": "find success"
  5. },
  6. "data": {
  7. "count": 2,
  8. "next": null,
  9. "previous": null,
  10. "results": [
  11. {
  12. "id": 1,
  13. "product_id": "123456",
  14. "product_name": "cao",
  15. "product_type": "1"
  16. },
  17. {
  18. "id": 2,
  19. "product_id": "qwert",
  20. "product_name": "wefgf",
  21. "product_type": "asdf"
  22. }
  23. ]
  24. }
  25. }
参数 类型 说明
code 整型 错误码;0代表正确,反之错误
message 字符串 请求提示
count 整型 数据总条数
next 字符串 下一页的链接
previous 字符串 上一页的链接
results 数组 数据列表
id 整型 产品主键
product_id 字符串 SDS 产品 product_id
product_name 字符串 产品名称
prodcut_type 字符串 产品类型

数据列表一页显示10条

添加产品

POST /product/

  1. {
  2. "product_id": "2345678",
  3. "product_name": "2345678",
  4. "product_type": "sdfghj"
  5. }
参数 类型 必须 说明
product_id 字符串 SDS 产品 product_id
prodcut_name 字符串 产品名称
prodcut_type 字符串 产品类型
  1. {
  2. "meta":{
  3. "code" : 0,
  4. "message" : "insert success"
  5. },
  6. "data":{
  7. "id": 1,
  8. "product_id": "123456",
  9. "product_name": "cao",
  10. "product_type": "1"
  11. }
  12. }
参数 类型 说明
code 整型 错误码;0代表正确,反之错误
message 字符串 请求提示
data json 添加的产品信息

根据产品主键(id)获取产品详情

GET /product/detail/[ID]

  1. {
  2. "meta": {
  3. "code": 0,
  4. "message": "find success"
  5. },
  6. "data": {
  7. "id": 1,
  8. "product_id": "123456",
  9. "product_name": "cao",
  10. "product_type": "1"
  11. }
  12. }
参数 类型 说明
code 整型 错误码;0代表正确,反之错误
message 字符串 请求提示
id 整型 产品主键
product_id 字符串 SDS 产品 product_id
product_name 字符串 产品名称
prodcut_type 字符串 产品类型

编辑产品信息

  1. {
  2. "product_id": "2345678",
  3. "product_name": "2345678",
  4. "product_type": "sdfghj"
  5. }
参数 类型 必须 说明
ID 整型 产品主键
product_id 字符串 SDS 产品 product_id
product_name 字符串 产品名称
prodcut_type 字符串 产品类型
  1. {
  2. "meta": {
  3. "code" : 0,
  4. "message" : "update success"
  5. },
  6. "data": {
  7. "id": 4
  8. "product_id": "2345678",
  9. "product_name": "2345678",
  10. "product_type": "sdfghj"
  11. }
  12. }
参数 类型 说明
code 整型 错误码;0代表正确,反之错误
message 字符串 请求提示
data json 编辑后的产品信息

删除产品

DELETE /product/detail/[ID]

  1. {
  2. "meta": {
  3. "code" : 0,
  4. "message" : "delete success"
  5. },
  6. "data": {}
  7. }
参数 类型 说明
code 整型 错误码;0代表正确,反之错误
message 字符串 请求提示

产品模板接口文档

分页查询产品模板列表:

GET /product/template/?page=[PAGE]

参数 类型 必须 说明
PAGE 整型 页数

* 请求回调

  1. {
  2. "meta": {
  3. "code": 0,
  4. "message": "find success"
  5. },
  6. "data": {
  7. "count": 1,
  8. "next": null,
  9. "previous": null,
  10. "results": [
  11. {
  12. "id": 1,
  13. "template_name": "dfd",
  14. "template_json": "{\"name\":\"gaoyang\"}",
  15. "template_read": 23,
  16. "product": 1
  17. }
  18. ]
  19. }
  20. }
参数 类型 说明
code 整型 错误码;0代表正确,反之错误
message 字符串 请求提示
count 整型 数据总条数
next 字符串 下一页的链接
previous 字符串 上一页的链接
results 数组 数据列表
id 整型 模板主键
template_name 字符串 模板名称
template_json 字符串json 下发指令模板
template_read 整型 是否可更改;0代表 template_json 只读,反之可编辑
product 整型 产品主键

数据列表一页显示10条

添加产品模板

POST /product/template/

  1. {
  2. "template_name": "sdfghjk",
  3. "template_json": "{\"name\":\"gaoyang\"}",
  4. "template_read": 0,
  5. "product": 1
  6. }
参数 类型 必须 说明
template_name 字符串 模板名称
template_json json 字符串 下发指令模板
template_read 整型 模板是否只读;0代表template_json只读,反之可编辑
product 整型 产品主键

* 请求回调

  1. {
  2. "meta": {
  3. "code" : 0,
  4. "message" : "insert success"
  5. },
  6. "data": {
  7. "id": 1,
  8. "template_name": "dfd",
  9. "template_json": "{\"name\":\"gaoyang\"}",
  10. "template_read": 23,
  11. "product": 1
  12. }
  13. }
参数 类型 说明
code 整型 错误码;0代表正确,反之错误
message 字符串 请求消息提示
data json 添加的模板信息

根据模板主键(id)查询模板详情

GET /product/template/detail/[ID]

参数 类型 必须 说明
ID 整型 模板主键
  1. {
  2. "meta": {
  3. "code": 0,
  4. "message": "find success"
  5. },
  6. "data": {
  7. "id": 1,
  8. "template_name": "dfd",
  9. "template_json": "{\"name\":\"gaoyang\"}",
  10. "template_read": 23,
  11. "product": 1
  12. }
  13. }
参数 类型 说明
code 整型 错误码;0代表正确,反之错误
message 字符串 请求消息提示
id 整型 模板主键 id
template_name 字符串 模板名称
template_json json 字符串 下发指令模板
template_read 整型 是否可更改;0代表 template_json 只读,反之可编辑
product 整型 产品主键

编辑产品模板

PUT /product/template/detail/[ID]

  1. {
  2. "template_name": "sdfghjk",
  3. "template_json": "{\"name\":\"gaoyang\"}",
  4. "template_read": 0,
  5. "product": 1
  6. }
参数 类型 必须 说明
ID 整型 模板主键
template_name 字符串 模板名称
template_json json 字符串 下发指令模板
template_read 整型 模板是否只读;0代表template_json只读,反之可编辑
product 整型 必须 产品主键
  1. {
  2. "meta": {
  3. "code" : 0,
  4. "message" : "update success"
  5. },
  6. "data": {
  7. "id": 1234,
  8. "template_name": "sdfghjk",
  9. "template_json": "{\"name\":\"gaoyang\"}",
  10. "template_read": 0,
  11. "product": 1
  12. }
  13. }
参数 类型 说明
code 整型 错误码;0代表正确,反之错误
message 字符串 请求消息提示
data json 编辑后的模板信息

删除产品模板

DELETE /product/template/detail/[ID]

参数 类型 必须 说明
ID 整型 模板主键

* 请求回调

  1. {
  2. "meta": {
  3. "code" : 0,
  4. "message" : "delete success"
  5. },
  6. "data": {}
  7. }
参数 类型 说明
code 整型 错误码;0代表正确,反之错误
message 字符串 请求消息提示

根据产品主键(id)查询产品模板列表

GET /product/template/[ID]

参数 类型 必须 说明
ID 整型 产品主键
  1. {
  2. "meta": {
  3. "code": 0,
  4. "message": "find success"
  5. },
  6. "data": {
  7. "count": 1,
  8. "next": null,
  9. "previous": null,
  10. "results": [
  11. {
  12. "id": 1,
  13. "template_name": "dfd",
  14. "template_json": "123",
  15. "template_read": 23,
  16. "product": 1
  17. }
  18. ]
  19. }
  20. }
参数 类型 说明
code 整型 错误码;0代表正确,反之错误
message 字符串 请求提示
count 整型 数据总条数
next 字符串 下一页的链接
previous 字符串 上一页的链接
results 数组 数据列表
id 整型 模板主键
template_name 字符串 模板名称
template_json 字符串json 下发指令模板
template_read 整型 是否可更改;0代表 template_json 只读,反之可编辑
product 整型 产品主键

数据列表一页显示10条

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