mocker12345 / shop-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sakura

author Congjie.Ran

image

article

GET /article
参数 类型 参数说明 是否必须(默认)
limit int 每页数量 否(12)
offset int 页码 否(1)
返回示例:
{
  "data": [
    {
      "category": 0,
      "children": [],
      "content": "测试啊~~~~~~~~~~~~~~~~~~~~~~~~~~",
      "cover_url": "http://nd.com.cn!!!",
      "create_time": "2016-09-03T15:38:51+00:00",
      "good": 0,
      "id": 1,
      "price": [],
      "summary": "简介啊~~~~~~~~",
      "title": "test1"
    },
    {
      "category": 0,
      "children": [],
      "content": "测试啊~~~~~~~~~~~~~~~~~~~~~~~~~~",
      "cover_url": "http://nd.com.cn",
      "create_time": "2016-09-03T15:39:36+00:00",
      "good": 0,
      "id": 3,
      "price": [],
      "summary": "简介啊~~~~~~~~",
      "title": "test2"
    },
  ],
  "offset": 1,
  "total_page": 1
}
GET /article/{article_id}
参数 参数类型 参数说明 是否必须(默认)
article_id url参数(int) 文章ID

返回示例

//GET /article/11
{
  "category": 0,
  "children": [
    {
      "category": 0,
      "cover_url": "http://nd.com.cn!!!",
      "id": 1,
      "summary": "简介啊~~~~~~~~",
      "title": "test1"
    }
  ],
  "content": "测试啊~~~~~~~~~~~~~~~~~~~~~~~~~~",
  "cover_url": "http://nd.com.cn!!!",
  "create_time": "2016-09-03T17:25:14+00:00",
  "good": 0,
  "id": 11,
  "price": [
    {
      "id": 5,
      "price": "110.00",
      "site_name": "淘宝",
      "site_url": "http://taobao.com"
    },
    {
      "id": 6,
      "price": "111.00",
      "site_name": "京东",
      "site_url": "http://jd.com"
    }
  ],
  "summary": "简介啊~~~~~~~~",
  "title": "test6"
}
POST /article
参数 参数类型 参数说明 是否必须(默认)
title str 文章标题
cover_url str 封面地址
summary str 简介
good int 是(0)
category int 文章分类
price(*) list 价格列表
children(*) list 关联文章

如果price存在:

参数 参数类型 参数说明 是否必须(默认)
site_name str 网站名称
site_url str 购物地址
price number 价格

如果children存在:

参数 参数类型 参数说明 是否必须(默认)
id int 子文章ID

请求示例

{
  "category": 0,
  "children": [{
      "id":1
  }],
  "content": "测试啊~~~~~~~~~~~~~~~~~~~~~~~~~~",
  "cover_url": "http://nd.com.cn!!!",
  "good":0,
  "price": [{
      "site_name":"淘宝",
      "site_url":"http://taobao.com",
      "price":110

  },{
      "site_name":"京东",
      "site_url":"http://jd.com",
      "price":111
  }],
  "summary": "简介啊~~~~~~~~",
  "title": "test8"
}

成功添加返回:

{
  "code": 201,
  "success": true
}
PUT /article/{article_id}
参数 参数类型 参数说明 是否必须(默认)
article_id url参数(int) 文章ID
id int 文章ID
DELETE /atricle/{article_id}
参数 参数类型 参数说明 是否必须(默认)
article_id url参数(int) 文章ID

category

GET /category

返回示例

{
  "data": [
    {
      "id": 4,
      "name": "nd"
    },
    {
      "id": 5,
      "name": "nd1"
    },
    {
      "id": 6,
      "name": "nd2"
    },
    {
      "id": 1,
      "name": "rancongjie"
    },
    {
      "id": 2,
      "name": "zhongshan"
    }
  ]
}
POST /category
参数 参数类型 参数说明 是否必须(默认)
name str 分类名称
请求示例
{
  "name":"nd2"
}

返回示例

{
  "data": [
    {
      "id": 4,
      "name": "nd"
    },
    {
      "id": 5,
      "name": "nd1"
    },
    {
      "id": 6,
      "name": "nd2"
    },
    {
      "id": 1,
      "name": "rancongjie"
    },
    {
      "id": 2,
      "name": "zhongshan"
    }
  ]
}
PUT /category/{category_id}
参数 参数类型 参数说明 是否必须(默认)
category_id url参数(int) 分类ID
name str 分类名称
DELETE /category/{category_id}
参数 参数类型 参数说明 是否必须(默认)
category_id url参数(int) 分类ID

commodity

GET /commodity
参数 参数类型 参数说明 是否必须(默认)
limit int 每页数量 否(12)
offset int 页码 否(1)
POST /commodity
参数 参数类型 参数说明 是否必须(默认)
title str 商品名称
cover_url str 封面图片
price str 价格
summery str 简介
buy_url str 购买链接

About


Languages

Language:Python 99.3%Language:Shell 0.7%