Product - 友好速搭 -- 开发文档

友好速搭

开放 API
使用说明 获取授权 全部 API 特殊 API 开放功能

Product

Product

#实体关系 一个 Product 可以拥有 1 到 100 个 ProductVariant 和 0 到 250 个 ProductImage

Product 对象支持 WebhookMetafields

Product 相关API

GET /products获取 Product 列表GET /products/count获取 Product 数量GET /products/#{id}获取单个 ProductPOST /products创建 ProductPUT /products/#{id}修改 ProductDELETE /products/#{id}删除 ProductPOST /products/#{id}/upload_base64_share上传社交分享图片,id为对应商品的idDELETE /products/#{id}/remove_share删除指定 product的社交分享图片。

Product 属性

    • body_html
    •   { "body_html" : "<p>API商品样例</p>" }
      
      String 类型,Product 的商品详情,支持富文本格式。
    • mobile_html
    •   { "mobile_html" : "<p>API商品样例</p>" }
      
      String 类型,Product 的移动端展示商品详情,支持富文本格式。
    • created_at
    •   { "created_at" : "2014-02-15T15:12:21+08:00" }
      
      Datetime 类型,Product 创建时间。
    • handle
    •   { "handle" : "my-first-handle" }
      
      Handle 类型,Product 的唯一字符串标识。
    • id
    •    { "id" : 825121 }
      
      Number 类型,Product 唯一整型标识。
    • images
    •   { "images" : 
           [
              { "src": "https://asset.ibanquan.com/image/550fb78f4812f203b2000058/s_158x158.png?v=1427093391" }, 
              { "src": "https://asset.ibanquan.com/image/550fb79c4812f203b200005b/s_158x158.png?v=1427093404" }
           ] 
       }
      
      Array 类型,ProductImage 列表。
    • image
    •    { "src": "https://asset.ibanquan.com/image/550fb78f4812f203b2000058/s_158x158.png?v=1427093391" }
      
      Object 类型,Product封面图片。
    • name
    •   { "name" : "商品名" }
      
      String 类型,Product 名称。
    • short_desc
    •   { "short_desc" : "商品简介" }
      
      String 类型,Product 简介。
    • share_image
    •   {
          "epoch": "1482239278",
          "height": 1920,
          "id": 1706,
          "image_id": "58592d2bfc165b72a5000002",
          "src": "/image/58592d2bfc165b72a5000002/05_Kerber_Lookbook_0.jpeg?1482239278",
          "width": 1280
        }
      
      Object 类型,Product 分享图片。
    • options
    • { "options" : [{ "name": "颜色" }, { "name": "尺寸" }] }
      
      Array 类型,Product 属性对象列表,一个 Product 允许有 0 到 3 个 option。
    • page_title
    • { "page_title" : "网页/分享标题" }
      
      String 类型,Product 网页/分享标题,用于 SEO 优化。
    • page_description
    • { "page_description" : "网页/分享描述" }
      
      String 类型,Product 网页/分享描述,用于 SEO 优化。
    • page_keywords
    • { "page_keywords" : "网页关键词" }
      
      String 类型,Product 网页关键词,用于 SEO 优化。
    • share_image_id
    •   { "share_image_id":  1024 }
      
      Integer 类型,社交图片id。
    • shipment_template_id
    •   { "shipment_template_id" : 1 }
      
      Integer 类型,运费模板id。
    • types
    •   { "types" : [{ "name": "商品分类样例1" }, { "name": "商品分类样例2" }] }
      
      Array 类型,Product 分类,一个 Product 允许有 0 到 3 个 type。
    • updated_at
    •   { "updated_at" : "2014-02-15T15:12:21+08:00" }
      
      Datetime 类型,Product 最近一次修改时间。
    • variants
    •  "variants": [
                  {
                      "barcode": "PB000001",
                      "compare_price": 20,
                      "created_at": null,
                      "id": 11828,
                      "image_id": null,
                      "option_1": "白色",
                      "option_2": "X",
                      "option_3": "",
                      "price": 10,
                      "product_id": 8689,
                      "stock": 100,
                      "updated_at": null,
                      "volume": 10,
                      "weight": 10
                  }
      ]
      
      Array 类型,Product 的 ProductVariant 列表,每一个 ProductVariant 代表该不同属性值的商品版本(单品),它拥有自己的属性值和价格、库存、编号等。
    • vendor
    •   { "vendor" : { "name": "商品品牌样例" } }
      
      Object 类型,Product 品牌对象,一个 Product 仅允许有一个 vendor。
    • visibility
    •   { "visibility" : true }
      
      Bool 类型,标识 Product 上架或下架,下架后店铺中不可见。
    • display_sale
    •   { "display_sale":  0}
      
      Integer 类型,商品详细页面显示销量。
    • sale
    •   { "sale":  0}
      
      Integer 类型,商品实际销量。

GET /products

获取 Product 列表

    • limit
    • 显示条数(默认10,最大50)
    • page
    • 显示页码(默认1)
    • since_id
    • 筛选id大于since_id的Product
    • fields
    • ,拼接要返回的字段
    • handle
    • 查询指定handle
    • id
    • 查询指定id
    • name
    • 查询指定的商品名,模糊查询
    • ids
    • ,拼接要显示的id范围
    • visibility
    • 缺省筛选包含输入visibility值的Product
    • vendor
    • 缺省筛选包含输入vendor值的Product
    • type
    • 缺省筛选包含输入type值的Product
    • created_at_min
    • 缺省筛选创建时间在指定日期时间之后的Product(格式2014-09-01T01:00:01)
    • created_at_max
    • 缺省筛选创建时间在指定日期时间之前的Product(格式2014-09-01T01:00:01)
    • updated_at_min
    • 缺省筛选更新时间在指定日期时间之后的Product(格式2014-09-01T01:00:01)
    • updated_at_max
    • 缺省筛选更新时间在指定日期时间之前的Product(格式2014-09-01T01:00:01)
    • 获取 Product 列表
    • GET /products
    • {
      "products": [
          {
              "body_html": "<p>友好速搭样例商品</p>\n<p><img src=\"//asset.ibanquan.com/image/553d38628757db3db6000024/s.jpeg?v=1430075490\" alt=\"\" /><img src=\"//asset.ibanquan.com/image/553d385c8757db3db6000021/s.jpeg?v=1430075485\" alt=\"\" /></p>",
              "created_at": "2015-04-27T03:09:25.440+08:00",
              "display_sale": 0,
              "handle": "p000006",
              "id": 8689,
              "image": {
                  "alt": "",
                  "created_at": "2015-04-27T03:10:11.791+08:00",
                  "file_name": "1.jpeg",
                  "id": 16093,
                  "position": 1,
                  "product_id": 8689,
                  "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                  "updated_at": "2015-04-27T03:10:11.791+08:00",
                  "variant_ids": [
                  ]
              },
              "images": [
                  {
                      "alt": "",
                      "created_at": "2015-04-27T03:10:11.791+08:00",
                      "file_name": "1.jpeg",
                      "id": 16093,
                      "position": 1,
                      "product_id": 8689,
                      "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                      "updated_at": "2015-04-27T03:10:11.791+08:00",
                      "variant_ids": [
                      ]
                  }
              ],
              "name": "友好速搭样例商品",
              "options": [
                  {
                      "id": 137,
                      "name": "颜色",
                      "values": [
                          "白色"
                      ],
                      "position": 1
                  },
                  {
                      "id": 136,
                      "name": "尺码",
                      "values": [
                          "X",
                          "L"
                      ],
                      "position": 2
                  }
              ],
              "page_description": "",
              "page_title": "友好速搭样例商品",
              "share_description": "API商品样例",
              "share_title": "API商品样例",
              "sale": 0,
              "types": [
                  {
                      "id": 1982,
                      "name": "友好速搭样例分类",
                      "handle": "t000003",
                      "page_url": "/types/t000003"
                  }
              ],
              "updated_at": "2015-04-27T03:11:42.107+08:00",
              "variants": [
                  {
                      "barcode": "PB000001",
                      "compare_price": 20,
                      "created_at": null,
                      "id": 11828,
                      "image_id": null,
                      "option_1": "白色",
                      "option_2": "X",
                      "option_3": "",
                      "price": 10,
                      "product_id": 8689,
                      "stock": 100,
                      "updated_at": null,
                      "volume": 10,
                      "weight": 10
                  },
                  {
                      "barcode": "PB000002",
                      "compare_price": 25,
                      "created_at": null,
                      "id": 11829,
                      "image_id": null,
                      "option_1": "白色",
                      "option_2": "L",
                      "option_3": "",
                      "price": 11,
                      "product_id": 8689,
                      "stock": 100,
                      "updated_at": null,
                      "volume": 10,
                      "weight": 10
                  }
              ],
              "vendor": {
                  "id": 1186,
                  "name": "友好速搭样例品牌",
                  "handle": "v000005",
                  "page_url": "/vendors/v000005"
              },
              "visibility": true
          },
          {
              "body_html": "<p>友好速搭样例商品</p>\n<p><img src=\"//asset.ibanquan.com/image/553d38628757db3db6000024/s.jpeg?v=1430075490\" alt=\"\" /><img src=\"//asset.ibanquan.com/image/553d385c8757db3db6000021/s.jpeg?v=1430075485\" alt=\"\" /></p>",
              "created_at": "2015-04-27T03:22:16.223+08:00",
              "display_sale": 0,
              "handle": "p001094",
              "id": 8690,
              "image": {
                  "alt": "",
                  "created_at": "2015-04-27T03:22:16.223+08:00",
                  "file_name": "1.jpeg",
                  "id": 16094,
                  "position": 1,
                  "product_id": 8690,
                  "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                  "updated_at": "2015-04-27T03:22:16.223+08:00",
                  "variant_ids": [
                  ]
              },
              "images": [
                  {
                      "alt": "",
                      "created_at": "2015-04-27T03:22:16.223+08:00",
                      "file_name": "1.jpeg",
                      "id": 16094,
                      "position": 1,
                      "product_id": 8690,
                      "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                      "updated_at": "2015-04-27T03:22:16.223+08:00",
                      "variant_ids": [
                      ]
                  }
              ],
              "name": "复制_友好速搭样例商品",
              "options": [
                  {
                      "id": 137,
                      "name": "颜色",
                      "values": [
                          "白色"
                      ],
                      "position": 1
                  },
                  {
                      "id": 136,
                      "name": "尺码",
                      "values": [
                          "X",
                          "L"
                      ],
                      "position": 2
                  }
              ],
              "page_description": "复制_友好速搭样例商品",
              "page_title": "复制_友好速搭样例商品",
              "share_description": "API商品样例",
              "share_title": "API商品样例",
              "sale": 0,
              "types": [
                  {
                      "id": 1982,
                      "name": "友好速搭样例分类",
                      "handle": "t000003",
                      "page_url": "/types/t000003"
                  }
              ],
              "updated_at": "2015-04-27T03:22:16.223+08:00",
              "variants": [
                  {
                      "barcode": "PB000002",
                      "compare_price": 25,
                      "created_at": "2015-04-27T03:22:16.223+08:00",
                      "id": 11830,
                      "image_id": null,
                      "option_1": "白色",
                      "option_2": "L",
                      "option_3": "",
                      "price": 11,
                      "product_id": 8690,
                      "stock": 100,
                      "updated_at": "2015-04-27T03:22:16.223+08:00",
                      "volume": 10,
                      "weight": 10
                  },
                  {
                      "barcode": "PB000001",
                      "compare_price": 20,
                      "created_at": "2015-04-27T03:22:16.223+08:00",
                      "id": 11831,
                      "image_id": null,
                      "option_1": "白色",
                      "option_2": "X",
                      "option_3": "",
                      "price": 10,
                      "product_id": 8690,
                      "stock": 100,
                      "updated_at": "2015-04-27T03:22:16.223+08:00",
                      "volume": 10,
                      "weight": 10
                  }
              ],
              "vendor": {
                  "id": 1186,
                  "name": "友好速搭样例品牌",
                  "handle": "v000005",
                  "page_url": "/vendors/v000005"
              },
              "visibility": false
          }
      ]
      }
      
    • 获取指定 ID 范围的 Product 列表
    • GET /products?ids=8690,8689
    • {
      "products": [
          {
              "body_html": "<p>友好速搭样例商品</p>\n<p><img src=\"//asset.ibanquan.com/image/553d38628757db3db6000024/s.jpeg?v=1430075490\" alt=\"\" /><img src=\"//asset.ibanquan.com/image/553d385c8757db3db6000021/s.jpeg?v=1430075485\" alt=\"\" /></p>",
              "created_at": "2015-04-27T03:09:25.440+08:00",
              "display_sale": 0,
              "handle": "p000006",
              "id": 8689,
              "image": {
                  "alt": "",
                  "created_at": "2015-04-27T03:10:11.791+08:00",
                  "file_name": "1.jpeg",
                  "id": 16093,
                  "position": 1,
                  "product_id": 8689,
                  "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                  "updated_at": "2015-04-27T03:10:11.791+08:00",
                  "variant_ids": [
                  ]
              },
              "images": [
                  {
                      "alt": "",
                      "created_at": "2015-04-27T03:10:11.791+08:00",
                      "file_name": "1.jpeg",
                      "id": 16093,
                      "position": 1,
                      "product_id": 8689,
                      "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                      "updated_at": "2015-04-27T03:10:11.791+08:00",
                      "variant_ids": [
                      ]
                  }
              ],
              "name": "友好速搭样例商品",
              "options": [
                  {
                      "id": 137,
                      "name": "颜色",
                      "values": [
                          "白色"
                      ],
                      "position": 1
                  },
                  {
                      "id": 136,
                      "name": "尺码",
                      "values": [
                          "X",
                          "L"
                      ],
                      "position": 2
                  }
              ],
              "page_description": "",
              "page_title": "友好速搭样例商品",
              "share_description": "API商品样例",
              "share_title": "API商品样例",
              "sale": 0,
              "types": [
                  {
                      "id": 1982,
                      "name": "友好速搭样例分类",
                      "handle": "t000003",
                      "page_url": "/types/t000003"
                  }
              ],
              "updated_at": "2015-04-27T03:11:42.107+08:00",
              "variants": [
                  {
                      "barcode": "PB000001",
                      "compare_price": 20,
                      "created_at": null,
                      "id": 11828,
                      "image_id": null,
                      "option_1": "白色",
                      "option_2": "X",
                      "option_3": "",
                      "price": 10,
                      "product_id": 8689,
                      "stock": 100,
                      "updated_at": null,
                      "volume": 10,
                      "weight": 10
                  },
                  {
                      "barcode": "PB000002",
                      "compare_price": 25,
                      "created_at": null,
                      "id": 11829,
                      "image_id": null,
                      "option_1": "白色",
                      "option_2": "L",
                      "option_3": "",
                      "price": 11,
                      "product_id": 8689,
                      "stock": 100,
                      "updated_at": null,
                      "volume": 10,
                      "weight": 10
                  }
              ],
              "vendor": {
                  "id": 1186,
                  "name": "友好速搭样例品牌",
                  "handle": "v000005",
                  "page_url": "/vendors/v000005"
              },
              "visibility": true
          },
          {
              "body_html": "<p>友好速搭样例商品</p>\n<p><img src=\"//asset.ibanquan.com/image/553d38628757db3db6000024/s.jpeg?v=1430075490\" alt=\"\" /><img src=\"//asset.ibanquan.com/image/553d385c8757db3db6000021/s.jpeg?v=1430075485\" alt=\"\" /></p>",
              "created_at": "2015-04-27T03:22:16.223+08:00",
              "display_sale": 0,
              "handle": "p001094",
              "id": 8690,
              "image": {
                  "alt": "",
                  "created_at": "2015-04-27T03:22:16.223+08:00",
                  "file_name": "1.jpeg",
                  "id": 16094,
                  "position": 1,
                  "product_id": 8690,
                  "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                  "updated_at": "2015-04-27T03:22:16.223+08:00",
                  "variant_ids": [
                  ]
              },
              "images": [
                  {
                      "alt": "",
                      "created_at": "2015-04-27T03:22:16.223+08:00",
                      "file_name": "1.jpeg",
                      "id": 16094,
                      "position": 1,
                      "product_id": 8690,
                      "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                      "updated_at": "2015-04-27T03:22:16.223+08:00",
                      "variant_ids": [
                      ]
                  }
              ],
              "name": "复制_友好速搭样例商品",
              "options": [
                  {
                      "id": 137,
                      "name": "颜色",
                      "values": [
                          "白色"
                      ],
                      "position": 1
                  },
                  {
                      "id": 136,
                      "name": "尺码",
                      "values": [
                          "X",
                          "L"
                      ],
                      "position": 2
                  }
              ],
              "page_description": "复制_友好速搭样例商品",
              "page_title": "复制_友好速搭样例商品",
              "share_description": "API商品样例",
              "share_title": "API商品样例",
              "sale": 0,
              "types": [
                  {
                      "id": 1982,
                      "name": "友好速搭样例分类",
                      "handle": "t000003",
                      "page_url": "/types/t000003"
                  }
              ],
              "updated_at": "2015-04-27T03:22:16.223+08:00",
              "variants": [
                  {
                      "barcode": "PB000002",
                      "compare_price": 25,
                      "created_at": "2015-04-27T03:22:16.223+08:00",
                      "id": 11830,
                      "image_id": null,
                      "option_1": "白色",
                      "option_2": "L",
                      "option_3": "",
                      "price": 11,
                      "product_id": 8690,
                      "stock": 100,
                      "updated_at": "2015-04-27T03:22:16.223+08:00",
                      "volume": 10,
                      "weight": 10
                  },
                  {
                      "barcode": "PB000001",
                      "compare_price": 20,
                      "created_at": "2015-04-27T03:22:16.223+08:00",
                      "id": 11831,
                      "image_id": null,
                      "option_1": "白色",
                      "option_2": "X",
                      "option_3": "",
                      "price": 10,
                      "product_id": 8690,
                      "stock": 100,
                      "updated_at": "2015-04-27T03:22:16.223+08:00",
                      "volume": 10,
                      "weight": 10
                  }
              ],
              "vendor": {
                  "id": 1186,
                  "name": "友好速搭样例品牌",
                  "handle": "v000005",
                  "page_url": "/vendors/v000005"
              },
              "visibility": false
          }
      ]
      }
      
    • 获取 Product 列表,只显示部分字段
    • GET /products?fields=id,handle,images
    • {
      "products": [
          {
              "id": 8689,
              "handle": "p000006",
              "images": [
                  {
                      "alt": "",
                      "created_at": "2015-04-27T03:10:11.791+08:00",
                      "file_name": "1.jpeg",
                      "id": 16093,
                      "position": 1,
                      "product_id": 8689,
                      "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                      "updated_at": "2015-04-27T03:10:11.791+08:00",
                      "variant_ids": [
                      ]
                  }
              ]
          },
          {
              "id": 8690,
              "handle": "p001094",
              "images": [
                  {
                      "alt": "",
                      "created_at": "2015-04-27T03:22:16.223+08:00",
                      "file_name": "1.jpeg",
                      "id": 16094,
                      "position": 1,
                      "product_id": 8690,
                      "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                      "updated_at": "2015-04-27T03:22:16.223+08:00",
                      "variant_ids": [
                      ]
                  }
              ]
          }
      ]
      }
      
    • 获取指定分类的 Product 列表
    • GET /products?type=分类
    • {
      "products": [
          {
              "body_html": "<p>友好速搭样例商品</p>\n<p><img src=\"//asset.ibanquan.com/image/553d38628757db3db6000024/s.jpeg?v=1430075490\" alt=\"\" /><img src=\"//asset.ibanquan.com/image/553d385c8757db3db6000021/s.jpeg?v=1430075485\" alt=\"\" /></p>",
              "created_at": "2015-04-27T03:09:25.440+08:00",
              "display_sale": 0,
              "handle": "p000006",
              "id": 8689,
              "image": {
                  "alt": "",
                  "created_at": "2015-04-27T03:10:11.791+08:00",
                  "file_name": "1.jpeg",
                  "id": 16093,
                  "position": 1,
                  "product_id": 8689,
                  "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                  "updated_at": "2015-04-27T03:10:11.791+08:00",
                  "variant_ids": [
                  ]
              },
              "images": [
                  {
                      "alt": "",
                      "created_at": "2015-04-27T03:10:11.791+08:00",
                      "file_name": "1.jpeg",
                      "id": 16093,
                      "position": 1,
                      "product_id": 8689,
                      "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                      "updated_at": "2015-04-27T03:10:11.791+08:00",
                      "variant_ids": [
                      ]
                  }
              ],
              "name": "友好速搭样例商品",
              "options": [
                  {
                      "id": 137,
                      "name": "颜色",
                      "values": [
                          "白色"
                      ],
                      "position": 1
                  },
                  {
                      "id": 136,
                      "name": "尺码",
                      "values": [
                          "X",
                          "L"
                      ],
                      "position": 2
                  }
              ],
              "page_description": "",
              "page_title": "友好速搭样例商品",
              "share_description": "API商品样例",
              "share_title": "API商品样例",
              "sale": 0,
              "types": [
                  {
                      "id": 1982,
                      "name": "友好速搭样例分类",
                      "handle": "t000003",
                      "page_url": "/types/t000003"
                  }
              ],
              "updated_at": "2015-04-27T03:11:42.107+08:00",
              "variants": [
                  {
                      "barcode": "PB000001",
                      "compare_price": 20,
                      "created_at": null,
                      "id": 11828,
                      "image_id": null,
                      "option_1": "白色",
                      "option_2": "X",
                      "option_3": "",
                      "price": 10,
                      "product_id": 8689,
                      "stock": 100,
                      "updated_at": null,
                      "volume": 10,
                      "weight": 10
                  },
                  {
                      "barcode": "PB000002",
                      "compare_price": 25,
                      "created_at": null,
                      "id": 11829,
                      "image_id": null,
                      "option_1": "白色",
                      "option_2": "L",
                      "option_3": "",
                      "price": 11,
                      "product_id": 8689,
                      "stock": 100,
                      "updated_at": null,
                      "volume": 10,
                      "weight": 10
                  }
              ],
              "vendor": {
                  "id": 1186,
                  "name": "友好速搭样例品牌",
                  "handle": "v000005",
                  "page_url": "/vendors/v000005"
              },
              "visibility": true
          },
          {
              "body_html": "<p>友好速搭样例商品</p>\n<p><img src=\"//asset.ibanquan.com/image/553d38628757db3db6000024/s.jpeg?v=1430075490\" alt=\"\" /><img src=\"//asset.ibanquan.com/image/553d385c8757db3db6000021/s.jpeg?v=1430075485\" alt=\"\" /></p>",
              "created_at": "2015-04-27T03:22:16.223+08:00",
              "display_sale": 0,
              "handle": "p001094",
              "id": 8690,
              "image": {
                  "alt": "",
                  "created_at": "2015-04-27T03:22:16.223+08:00",
                  "file_name": "1.jpeg",
                  "id": 16094,
                  "position": 1,
                  "product_id": 8690,
                  "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                  "updated_at": "2015-04-27T03:22:16.223+08:00",
                  "variant_ids": [
                  ]
              },
              "images": [
                  {
                      "alt": "",
                      "created_at": "2015-04-27T03:22:16.223+08:00",
                      "file_name": "1.jpeg",
                      "id": 16094,
                      "position": 1,
                      "product_id": 8690,
                      "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                      "updated_at": "2015-04-27T03:22:16.223+08:00",
                      "variant_ids": [
                      ]
                  }
              ],
              "name": "复制_友好速搭样例商品",
              "options": [
                  {
                      "id": 137,
                      "name": "颜色",
                      "values": [
                          "白色"
                      ],
                      "position": 1
                  },
                  {
                      "id": 136,
                      "name": "尺码",
                      "values": [
                          "X",
                          "L"
                      ],
                      "position": 2
                  }
              ],
              "page_description": "复制_友好速搭样例商品",
              "page_title": "复制_友好速搭样例商品",
              "share_description": "API商品样例",
              "share_title": "API商品样例",
              "sale": 0,
              "types": [
                  {
                      "id": 1982,
                      "name": "友好速搭样例分类",
                      "handle": "t000003",
                      "page_url": "/types/t000003"
                  }
              ],
              "updated_at": "2015-04-27T03:22:16.223+08:00",
              "variants": [
                  {
                      "barcode": "PB000002",
                      "compare_price": 25,
                      "created_at": "2015-04-27T03:22:16.223+08:00",
                      "id": 11830,
                      "image_id": null,
                      "option_1": "白色",
                      "option_2": "L",
                      "option_3": "",
                      "price": 11,
                      "product_id": 8690,
                      "stock": 100,
                      "updated_at": "2015-04-27T03:22:16.223+08:00",
                      "volume": 10,
                      "weight": 10
                  },
                  {
                      "barcode": "PB000001",
                      "compare_price": 20,
                      "created_at": "2015-04-27T03:22:16.223+08:00",
                      "id": 11831,
                      "image_id": null,
                      "option_1": "白色",
                      "option_2": "X",
                      "option_3": "",
                      "price": 10,
                      "product_id": 8690,
                      "stock": 100,
                      "updated_at": "2015-04-27T03:22:16.223+08:00",
                      "volume": 10,
                      "weight": 10
                  }
              ],
              "vendor": {
                  "id": 1186,
                  "name": "友好速搭样例品牌",
                  "handle": "v000005",
                  "page_url": "/vendors/v000005"
              },
              "visibility": false
          }
      ]
      }
      
    • 获取指定id之后的Product列表
    • GET /products?since_id=8689
    • {
      "products": [
          {
              "body_html": "<p>友好速搭样例商品</p>\n<p><img src=\"//asset.ibanquan.com/image/553d38628757db3db6000024/s.jpeg?v=1430075490\" alt=\"\" /><img src=\"//asset.ibanquan.com/image/553d385c8757db3db6000021/s.jpeg?v=1430075485\" alt=\"\" /></p>",
              "created_at": "2015-04-27T03:22:16.223+08:00",
              "display_sale": 0,
              "handle": "p001094",
              "id": 8690,
              "image": {
                  "alt": "",
                  "created_at": "2015-04-27T03:22:16.223+08:00",
                  "file_name": "1.jpeg",
                  "id": 16094,
                  "position": 1,
                  "product_id": 8690,
                  "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                  "updated_at": "2015-04-27T03:22:16.223+08:00",
                  "variant_ids": [
                  ]
              },
              "images": [
                  {
                      "alt": "",
                      "created_at": "2015-04-27T03:22:16.223+08:00",
                      "file_name": "1.jpeg",
                      "id": 16094,
                      "position": 1,
                      "product_id": 8690,
                      "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                      "updated_at": "2015-04-27T03:22:16.223+08:00",
                      "variant_ids": [
                      ]
                  }
              ],
              "name": "复制_友好速搭样例商品",
              "options": [
                  {
                      "id": 137,
                      "name": "颜色",
                      "values": [
                          "白色"
                      ],
                      "position": 1
                  },
                  {
                      "id": 136,
                      "name": "尺码",
                      "values": [
                          "X",
                          "L"
                      ],
                      "position": 2
                  }
              ],
              "page_description": "复制_友好速搭样例商品",
              "page_title": "复制_友好速搭样例商品",
              "share_description": "API商品样例",
              "share_title": "API商品样例",
              "sale": 0,
              "types": [
                  {
                      "id": 1982,
                      "name": "友好速搭样例分类",
                      "handle": "t000003",
                      "page_url": "/types/t000003"
                  }
              ],
              "updated_at": "2015-04-27T03:22:16.223+08:00",
              "variants": [
                  {
                      "barcode": "PB000002",
                      "compare_price": 25,
                      "created_at": "2015-04-27T03:22:16.223+08:00",
                      "id": 11830,
                      "image_id": null,
                      "option_1": "白色",
                      "option_2": "L",
                      "option_3": "",
                      "price": 11,
                      "product_id": 8690,
                      "stock": 100,
                      "updated_at": "2015-04-27T03:22:16.223+08:00",
                      "volume": 10,
                      "weight": 10
                  },
                  {
                      "barcode": "PB000001",
                      "compare_price": 20,
                      "created_at": "2015-04-27T03:22:16.223+08:00",
                      "id": 11831,
                      "image_id": null,
                      "option_1": "白色",
                      "option_2": "X",
                      "option_3": "",
                      "price": 10,
                      "product_id": 8690,
                      "stock": 100,
                      "updated_at": "2015-04-27T03:22:16.223+08:00",
                      "volume": 10,
                      "weight": 10
                  }
              ],
              "vendor": {
                  "id": 1186,
                  "name": "友好速搭样例品牌",
                  "handle": "v000005",
                  "page_url": "/vendors/v000005"
              },
              "visibility": false
          }
      ]
      }
      

GET /products/count

获取 Product 数量

    • visibility
    • 缺省筛选包含输入visibility值的Product
    • vendor
    • 缺省筛选包含输入vendor值的Product
    • type
    • 缺省筛选包含输入type值的Product
    • created_at_min
    • 缺省筛选创建时间在指定日期时间之后的Product(格式2014-09-01T01:00:01)
    • created_at_max
    • 缺省筛选创建时间在指定日期时间之前的Product(格式2014-09-01T01:00:01)
    • updated_at_min
    • 缺省筛选更新时间在指定日期时间之后的Product(格式2014-09-01T01:00:01)
    • updated_at_max
    • 缺省筛选更新时间在指定日期时间之前的Product(格式2014-09-01T01:00:01)
    • 获取Product数量
    • GET /products/count
    • {
      "count": 2
      }
      
    • 获取指定分类的Product数量
    • GET /products/count?type=分类
    • {
      "count": 2
      }
      

GET /products/#{id}

获取单个 Product

    • fields
    • ,拼接Response显示的字段
    • 获取单个 Product
    • GET /products/#{id}
    • {
      "product": {
          "body_html": "<p>友好速搭样例商品</p>\n<p><img src=\"//asset.ibanquan.com/image/553d38628757db3db6000024/s.jpeg?v=1430075490\" alt=\"\" /><img src=\"//asset.ibanquan.com/image/553d385c8757db3db6000021/s.jpeg?v=1430075485\" alt=\"\" /></p>",
          "created_at": "2015-04-27T03:09:25.440+08:00",
          "display_sale": 0,
          "handle": "p000006",
          "id": 8689,
          "image": {
              "alt": "",
              "created_at": "2015-04-27T03:10:11.791+08:00",
              "file_name": "1.jpeg",
              "id": 16093,
              "position": 1,
              "product_id": 8689,
              "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
              "updated_at": "2015-04-27T03:10:11.791+08:00",
              "variant_ids": [
              ]
          },
          "images": [
              {
                  "alt": "",
                  "created_at": "2015-04-27T03:10:11.791+08:00",
                  "file_name": "1.jpeg",
                  "id": 16093,
                  "position": 1,
                  "product_id": 8689,
                  "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                  "updated_at": "2015-04-27T03:10:11.791+08:00",
                  "variant_ids": [
                  ]
              }
          ],
          "name": "友好速搭样例商品",
          "options": [
              {
                  "id": 137,
                  "name": "颜色",
                  "values": [
                      "白色"
                  ],
                  "position": 1
              },
              {
                  "id": 136,
                  "name": "尺码",
                  "values": [
                      "X",
                      "L"
                  ],
                  "position": 2
              }
          ],
          "page_description": "",
          "page_title": "友好速搭样例商品",
          "share_description": "API商品样例",
          "share_title": "API商品样例",
          "sale": 0,
          "types": [
              {
                  "id": 1982,
                  "name": "友好速搭样例分类",
                  "handle": "t000003",
                  "page_url": "/types/t000003"
              }
          ],
          "updated_at": "2015-04-27T03:11:42.107+08:00",
          "variants": [
              {
                  "barcode": "PB000001",
                  "compare_price": 20,
                  "created_at": null,
                  "id": 11828,
                  "image_id": null,
                  "option_1": "白色",
                  "option_2": "X",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8689,
                  "stock": 100,
                  "updated_at": null,
                  "volume": 10,
                  "weight": 10
              },
              {
                  "barcode": "PB000002",
                  "compare_price": 25,
                  "created_at": null,
                  "id": 11829,
                  "image_id": null,
                  "option_1": "白色",
                  "option_2": "L",
                  "option_3": "",
                  "price": 11,
                  "product_id": 8689,
                  "stock": 100,
                  "updated_at": null,
                  "volume": 10,
                  "weight": 10
              }
          ],
          "vendor": {
              "id": 1186,
              "name": "友好速搭样例品牌",
              "handle": "v000005",
              "page_url": "/vendors/v000005"
          },
          "visibility": true
      }
      }
      
    • 获取单个 Product,只显示部分字段
    • GET /products/#{id}?fields=id,handle,images
    • {
      "product": {
          "id": 8689,
          "handle": "p000006",
          "images": [
              {
                  "alt": "",
                  "created_at": "2015-04-27T03:10:11.791+08:00",
                  "file_name": "1.jpeg",
                  "id": 16093,
                  "position": 1,
                  "product_id": 8689,
                  "src": "https://asset.ibanquan.com/image/553d38138757db3db600001e/s.jpeg?v=1430075411",
                  "updated_at": "2015-04-27T03:10:11.791+08:00",
                  "variant_ids": [
                  ]
              }
          ]
      }
      }
      

POST /products

创建 Product

    • 创建 Product,必须要有一个商品名称和一个价格
    • POST /products
        {
          "product": {
            "name": "API商品样例",
            "variants": [
              {
                "price": 10
              }
            ]
          }
        }
      
    • {
      "product": {
          "body_html": "",
          "created_at": "2015-04-27T19:43:25.804+08:00",
          "display_sale": 0,
          "handle": "p001097",
          "id": 8803,
          "image": null,
          "images": [
          ],
          "name": "API商品样例",
          "options": [
          ],
          "page_description": "",
          "page_title": "",
          "share_description": "",
          "share_title": "",
          "sale": 0,
          "types": [
          ],
          "updated_at": "2015-04-27T19:43:25.804+08:00",
          "variants": [
              {
                  "barcode": "",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11937,
                  "image_id": null,
                  "option_1": "",
                  "option_2": "",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8803,
                  "stock": 0,
                  "updated_at": null,
                  "volume": 0,
                  "weight": 0
              }
          ],
          "vendor": null,
          "visibility": true
      }
      }
      
    • 创建带有多个 ProductVariant 的 Product
    • POST /products
        {
          "product": {
            "name": "API商品样例",
            "page_title": "API商品样例",
            "page_description": "API商品样例",
            "share_description": "API商品样例",
            "share_title": "API商品样例",
            "body_html": "<p>API商品样例</p>",
            "vendor": {
              "name": "商品品牌样例"
            },
            "types": [
              {
                "name": "商品分类1"
              },
              {
                "name": "商品分类2"
              }
            ],
            "options": [
              {
                "name": "颜色"
              },
              {
                "name": "尺寸"
              }
            ],
            "variants": [
              {
                "option_1": "白",
                "option_2": "XL",
                "option_3": null,
                "price": 10,
                "compare_price": 0,
                "stock": 9,
                "sale": 0,
                "weight": 40,
                "volume": 0,
                "barcode": "I2008X03",
                "image_id": null
              },
              {
                "option_1": "白",
                "option_2": "X",
                "option_3": null,
                "price": 10,
                "compare_price": 1000,
                "stock": 9,
                "sale": 0,
                "weight": 40,
                "volume": 0,
                "barcode": "I2008X01",
                "image_id": null
              },
              {
                "option_1": "黑",
                "option_2": "XL",
                "option_3": null,
                "price": 10.01,
                "compare_price": 0,
                "stock": 9,
                "sale": 0,
                "weight": 40,
                "volume": 0,
                "barcode": "I2008X02",
                "image_id": null
              }
            ]
          }
        }
      
    • {
      "product": {
          "body_html": "<p>API商品样例</p>",
          "created_at": "2015-04-27T19:47:00.648+08:00",
          "display_sale": 0,
          "handle": "p001098",
          "id": 8804,
          "image": null,
          "images": [
          ],
          "name": "API商品样例",
          "options": [
              {
                  "id": 137,
                  "name": "颜色",
                  "values": [
                      ""
                  ],
                  "position": 1
              },
              {
                  "id": 22784,
                  "name": "尺寸",
                  "values": [
                      "白",
                      "黑"
                  ],
                  "position": 2
              }
          ],
          "page_description": "API商品样例",
          "page_title": "API商品样例",
          "share_description": "API商品样例",
          "share_title": "API商品样例",
          "sale": 0,
          "types": [
              {
                  "id": 1985,
                  "name": "商品分类1",
                  "handle": "t000004",
                  "page_url": "/types/t000004"
              },
              {
                  "id": 1986,
                  "name": "商品分类2",
                  "handle": "t000005",
                  "page_url": "/types/t000005"
              }
          ],
          "updated_at": "2015-04-27T19:47:00.648+08:00",
          "variants": [
              {
                  "barcode": "I2008X03",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11938,
                  "image_id": null,
                  "option_1": "白",
                  "option_2": "XL",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": null,
                  "volume": 0,
                  "weight": 40
              },
              {
                  "barcode": "I2008X01",
                  "compare_price": 1000,
                  "created_at": null,
                  "id": 11939,
                  "image_id": null,
                  "option_1": "白",
                  "option_2": "X",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": null,
                  "volume": 0,
                  "weight": 40
              },
              {
                  "barcode": "I2008X02",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11940,
                  "image_id": null,
                  "option_1": "黑",
                  "option_2": "XL",
                  "option_3": "",
                  "price": 10.01,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": null,
                  "volume": 0,
                  "weight": 40
              }
          ],
          "vendor": {
              "id": 1194,
              "name": "商品品牌样例",
              "handle": "v000006",
              "page_url": "/vendors/v000006"
          },
          "visibility": true
      }
      }
      
    • 创建 Product 并传入 Base64 编码的图片作为 ProductImage
    • POST /products
        {
          "product": {
            "name": "API商品样例",
            "image": {
              "attachment": "data:image/png;base64',R0lGODlhAQABAID/AP///wAAACwAAAAAAQABAAACAkQBADs=",
              "file_name": "cover.jpg"
            },
            "variants": [
              {
                "price": 10
              }
            ]
          }
        }
      
    • {
      "product": {
          "body_html": "",
          "created_at": "2015-04-27T19:50:19.557+08:00",
          "display_sale": 0,
          "handle": "p001099",
          "id": 8807,
          "image": {
              "alt": "",
              "created_at": "2015-04-27T19:50:19.571+08:00",
              "file_name": "cover.jpg",
              "id": 16207,
              "position": 1,
              "product_id": 8807,
              "src": "https://asset.ibanquan.com/image/553e227bac78e3539b000009/cover.jpg?1430135419",
              "updated_at": "2015-04-27T19:50:19.571+08:00",
              "variant_ids": [
              ]
          },
          "images": [
              {
                  "alt": "",
                  "created_at": "2015-04-27T19:50:19.571+08:00",
                  "file_name": "cover.jpg",
                  "id": 16207,
                  "position": 1,
                  "product_id": 8807,
                  "src": "https://asset.ibanquan.com/image/553e227bac78e3539b000009/cover.jpg?1430135419",
                  "updated_at": "2015-04-27T19:50:19.571+08:00",
                  "variant_ids": [
                  ]
              }
          ],
          "name": "API商品样例",
          "options": [
          ],
          "page_description": "",
          "page_title": "",
          "sale": 0,
          "types": [
          ],
          "updated_at": "2015-04-27T19:50:19.557+08:00",
          "variants": [
              {
                  "barcode": "",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11941,
                  "image_id": null,
                  "option_1": "",
                  "option_2": "",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8807,
                  "stock": 0,
                  "updated_at": null,
                  "volume": 0,
                  "weight": 0
              }
          ],
          "vendor": null,
          "visibility": true
      }
      }
      
    • 创建 Product,没有传入商品名称时会返回错误提示
    • POST /products
        {
          "product": {}
        }
      
    • {
      "code": 422,
      "errors": {
          "name": [
              "不可为空"
          ],
          "variants": [
              "variants不可为空"
          ]
      }
      }
      
    • 创建 Product,传入的 ProductVariant 的选项值不唯一时会返回错误提示
    • POST /products
        {
          "product": {
            "name": "API商品样例",
            "options": [
              {
                "name": "颜色"
              },
              {
                "name": "尺寸"
              }
            ],
            "variants": [
              {
                "option_1": "白",
                "option_2": "XL",
                "option_3": null,
                "price": 10,
                "compare_price": 0,
                "stock": 9,
                "sale": 0,
                "weight": 40,
                "volume": 0,
                "barcode": "I2008X03",
                "image_id": null
              },
              {
                "option_1": "白",
                "option_2": "XL",
                "option_3": null,
                "price": 10,
                "compare_price": 1000,
                "stock": 9,
                "sale": 0,
                "weight": 40,
                "volume": 0,
                "barcode": "I2008X01",
                "image_id": null
              },
              {
                "option_1": "黑",
                "option_2": "XL",
                "option_3": null,
                "price": 10.01,
                "compare_price": 0,
                "stock": 9,
                "sale": 0,
                "weight": 40,
                "volume": 0,
                "barcode": "I2008X02",
                "image_id": null
              }
            ]
          }
        }
      
    • {
      "code": 422,
      "errors": {
          "variants": [
              "存在两条option值一致的variant"
          ]
      }
      }
      

PUT /products/#{id}

修改 Product

    • 修改 Product 的商品名称
    • PUT /products/#{id}
        {
          "product": {
            "id": 8804,
            "name": "API商品样例-1"
          }
        }
      
    • {
      "product": {
          "body_html": "<p>API商品样例</p>",
          "created_at": "2015-04-27T19:36:36.257+08:00",
          "display_sale": 0,
          "handle": "p001096",
          "image": {
              "alt": "",
              "created_at": "2015-04-27T19:36:36.354+08:00",
              "file_name": "cover.jpg",
              "id": 16206,
              "position": 1,
              "product_id": 8802,
              "src": "https://asset.ibanquan.com/image/553e1f44ac78e3539b000003/cover.jpg?1430134596",
              "updated_at": "2015-04-27T19:36:36.354+08:00",
              "variant_ids": [
              ]
          },
          "images": [
              {
                  "alt": "",
                  "created_at": "2015-04-27T19:36:36.354+08:00",
                  "file_name": "cover.jpg",
                  "id": 16206,
                  "position": 1,
                  "product_id": 8802,
                  "src": "https://asset.ibanquan.com/image/553e1f44ac78e3539b000003/cover.jpg?1430134596",
                  "updated_at": "2015-04-27T19:36:36.354+08:00",
                  "variant_ids": [
                  ]
              }
          ],
          "name": "API商品样例-1",
          "options": [
              {
                  "id": 137,
                  "name": "颜色",
                  "values": [
                      "",
                      "白",
                      "黑"
                  ],
                  "position": 1
              },
              {
                  "id": 22784,
                  "name": "尺寸",
                  "values": [
                      "白",
                      "黑",
                      "X",
                      "XL"
                  ],
                  "position": 2
              }
          ],
          "page_description": "API商品样例",
          "page_title": "API商品样例",
          "share_description": "API商品样例",
          "share_title": "API商品样例",
          "sale": 0,
          "types": [
              {
                  "id": 1985,
                  "name": "商品分类1",
                  "handle": "t000004",
                  "page_url": "/types/t000004"
              },
              {
                  "id": 1986,
                  "name": "商品分类2",
                  "handle": "t000005",
                  "page_url": "/types/t000005"
              }
          ],
          "updated_at": "2015-04-27T20:04:05.451+08:00",
          "variants": [
              {
                  "barcode": "I2008X03",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11934,
                  "image_id": null,
                  "option_1": "白",
                  "option_2": "XL",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8802,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:04:05.473+08:00",
                  "volume": 0,
                  "weight": 40
              },
              {
                  "barcode": "I2008X01",
                  "compare_price": 1000,
                  "created_at": null,
                  "id": 11935,
                  "image_id": null,
                  "option_1": "白",
                  "option_2": "X",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8802,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:04:05.469+08:00",
                  "volume": 0,
                  "weight": 40
              },
              {
                  "barcode": "I2008X02",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11936,
                  "image_id": null,
                  "option_1": "黑",
                  "option_2": "XL",
                  "option_3": "",
                  "price": 10.01,
                  "product_id": 8802,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:04:05.464+08:00",
                  "volume": 0,
                  "weight": 40
              }
          ],
          "vendor": {
              "id": 1194,
              "name": "商品品牌样例",
              "handle": "v000006",
              "page_url": "/vendors/v000006"
          },
          "visibility": true
      }
      }
      
    • 修改 Product 的商品分类
    • PUT /products/#{id}
        {
          "product": {
            "types": [
              {
                "name": "商品分类3"
              }
            ]
          }
        }
      
    • {
      "product": {
          "body_html": "<p>API商品样例</p>",
          "created_at": "2015-04-27T19:36:36.257+08:00",
          "display_sale": 0,
          "handle": "p001096",
          "id": 8802,
          "image": {
              "alt": "",
              "created_at": "2015-04-27T19:36:36.354+08:00",
              "file_name": "cover.jpg",
              "id": 16206,
              "position": 1,
              "product_id": 8802,
              "src": "https://asset.ibanquan.com/image/553e1f44ac78e3539b000003/cover.jpg?1430134596",
              "updated_at": "2015-04-27T19:36:36.354+08:00",
              "variant_ids": [
              ]
          },
          "images": [
              {
                  "alt": "",
                  "created_at": "2015-04-27T19:36:36.354+08:00",
                  "file_name": "cover.jpg",
                  "id": 16206,
                  "position": 1,
                  "product_id": 8802,
                  "src": "https://asset.ibanquan.com/image/553e1f44ac78e3539b000003/cover.jpg?1430134596",
                  "updated_at": "2015-04-27T19:36:36.354+08:00",
                  "variant_ids": [
                  ]
              }
          ],
          "name": "API商品样例-1",
          "options": [
              {
                  "id": 137,
                  "name": "颜色",
                  "values": [
                      "",
                      "白",
                      "黑"
                  ],
                  "position": 1
              },
              {
                  "id": 22784,
                  "name": "尺寸",
                  "values": [
                      "白",
                      "黑",
                      "X",
                      "XL"
                  ],
                  "position": 2
              }
          ],
          "page_description": "API商品样例",
          "page_title": "API商品样例",
          "share_description": "API商品样例",
          "share_title": "API商品样例",
          "sale": 0,
          "types": [
              {
                  "id": 1988,
                  "name": "商品分类3",
                  "handle": "t000006",
                  "page_url": "/types/t000006"
              }
          ],
          "updated_at": "2015-04-27T20:04:05.451+08:00",
          "variants": [
              {
                  "barcode": "I2008X03",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11934,
                  "image_id": null,
                  "option_1": "白",
                  "option_2": "XL",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8802,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:06:12.743+08:00",
                  "volume": 0,
                  "weight": 40
              },
              {
                  "barcode": "I2008X01",
                  "compare_price": 1000,
                  "created_at": null,
                  "id": 11935,
                  "image_id": null,
                  "option_1": "白",
                  "option_2": "X",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8802,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:06:12.735+08:00",
                  "volume": 0,
                  "weight": 40
              },
              {
                  "barcode": "I2008X02",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11936,
                  "image_id": null,
                  "option_1": "黑",
                  "option_2": "XL",
                  "option_3": "",
                  "price": 10.01,
                  "product_id": 8802,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:06:12.727+08:00",
                  "volume": 0,
                  "weight": 40
              }
          ],
          "vendor": {
              "id": 1194,
              "name": "商品品牌样例",
              "handle": "v000006",
              "page_url": "/vendors/v000006"
          },
          "visibility": true
      }
      }
      
    • 修改 Product 的图片顺序,如果不传其中已有的图片 id 则会删除该图片
    • PUT /products/#{id}
        {
          "product": {
            "images": [
              {
                "id": 16212
              },
              {
                "id": 16213
              },
              {
                "id": 16211
              }
            ]
          }
        }
      
    • {
      "product": {
          "body_html": "<p>API商品样例</p>",
          "created_at": "2015-04-27T19:47:00.648+08:00",
          "display_sale": 0,
          "handle": "p001098",
          "id": 8804,
          "image": {
              "alt": "",
              "created_at": "2015-04-27T20:09:14.802+08:00",
              "file_name": "1.jpeg",
              "id": 16211,
              "position": 3,
              "product_id": 8804,
              "src": "https://asset.ibanquan.com/image/553e26ea8757db22d900002e/s.jpeg?v=1430136554",
              "updated_at": "2015-04-27T20:09:14.802+08:00",
              "variant_ids": [
              ]
          },
          "images": [
              {
                  "alt": "",
                  "created_at": "2015-04-27T20:09:15.650+08:00",
                  "file_name": "80.jpeg",
                  "id": 16212,
                  "position": 1,
                  "product_id": 8804,
                  "src": "https://asset.ibanquan.com/image/553e26ebaaba8c339e00003f/s.jpeg?v=1430136555",
                  "updated_at": "2015-04-27T20:09:15.650+08:00",
                  "variant_ids": [
                  ]
              },
              {
                  "alt": "",
                  "created_at": "2015-04-27T20:09:16.441+08:00",
                  "file_name": "maillogo1.png",
                  "id": 16213,
                  "position": 2,
                  "product_id": 8804,
                  "src": "https://asset.ibanquan.com/image/553e26ec4812f234b5000049/s.png?v=1430136556",
                  "updated_at": "2015-04-27T20:09:16.441+08:00",
                  "variant_ids": [
                  ]
              },
              {
                  "alt": "",
                  "created_at": "2015-04-27T20:09:14.802+08:00",
                  "file_name": "1.jpeg",
                  "id": 16211,
                  "position": 3,
                  "product_id": 8804,
                  "src": "https://asset.ibanquan.com/image/553e26ea8757db22d900002e/s.jpeg?v=1430136554",
                  "updated_at": "2015-04-27T20:09:14.802+08:00",
                  "variant_ids": [
                  ]
              }
          ],
          "name": "API商品样例",
          "options": [
              {
                  "id": 137,
                  "name": "颜色",
                  "values": [
                      "白",
                      "黑"
                  ],
                  "position": 1
              },
              {
                  "id": 22784,
                  "name": "尺寸",
                  "values": [
                      "X",
                      "XL"
                  ],
                  "position": 2
              }
          ],
          "page_description": "API商品样例",
          "page_title": "API商品样例",
          "share_description": "API商品样例",
          "share_title": "API商品样例",
          "sale": 0,
          "types": [
              {
                  "id": 1985,
                  "name": "商品分类1",
                  "handle": "t000004",
                  "page_url": "/types/t000004"
              },
              {
                  "id": 1986,
                  "name": "商品分类2",
                  "handle": "t000005",
                  "page_url": "/types/t000005"
              }
          ],
          "updated_at": "2015-04-27T20:09:18.350+08:00",
          "variants": [
              {
                  "barcode": "I2008X03",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11938,
                  "image_id": null,
                  "option_1": "白",
                  "option_2": "XL",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:11:44.140+08:00",
                  "volume": 0,
                  "weight": 40
              },
              {
                  "barcode": "I2008X01",
                  "compare_price": 1000,
                  "created_at": null,
                  "id": 11939,
                  "image_id": null,
                  "option_1": "白",
                  "option_2": "X",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:11:44.137+08:00",
                  "volume": 0,
                  "weight": 40
              },
              {
                  "barcode": "I2008X02",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11940,
                  "image_id": null,
                  "option_1": "黑",
                  "option_2": "XL",
                  "option_3": "",
                  "price": 10.01,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:11:44.132+08:00",
                  "volume": 0,
                  "weight": 40
              }
          ],
          "vendor": {
              "id": 1194,
              "name": "商品品牌样例",
              "handle": "v000006",
              "page_url": "/vendors/v000006"
          },
          "visibility": true
      }
      }
      
    • 修改 Product,清空所有图片
    • PUT /products/#{id}
        {
          "product": {
            "images": [
            ]
          }
        }
      
    • {
      "product": {
          "body_html": "<p>API商品样例</p>",
          "created_at": "2015-04-27T19:47:00.648+08:00",
          "display_sale": 0,
          "handle": "p001098",
          "id": 8804,
          "image": null,
          "images": [
          ],
          "name": "API商品样例",
          "options": [
              {
                  "id": 137,
                  "name": "颜色",
                  "values": [
                      "白",
                      "黑"
                  ],
                  "position": 1
              },
              {
                  "id": 22784,
                  "name": "尺寸",
                  "values": [
                      "X",
                      "XL"
                  ],
                  "position": 2
              }
          ],
          "page_description": "API商品样例",
          "page_title": "API商品样例",
          "share_description": "API商品样例",
          "share_title": "API商品样例",
          "sale": 0,
          "types": [
              {
                  "id": 1985,
                  "name": "商品分类1",
                  "handle": "t000004",
                  "page_url": "/types/t000004"
              },
              {
                  "id": 1986,
                  "name": "商品分类2",
                  "handle": "t000005",
                  "page_url": "/types/t000005"
              }
          ],
          "updated_at": "2015-04-27T20:09:18.350+08:00",
          "variants": [
              {
                  "barcode": "I2008X03",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11938,
                  "image_id": null,
                  "option_1": "白",
                  "option_2": "XL",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:12:55.631+08:00",
                  "volume": 0,
                  "weight": 40
              },
              {
                  "barcode": "I2008X01",
                  "compare_price": 1000,
                  "created_at": null,
                  "id": 11939,
                  "image_id": null,
                  "option_1": "白",
                  "option_2": "X",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:12:55.627+08:00",
                  "volume": 0,
                  "weight": 40
              },
              {
                  "barcode": "I2008X02",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11940,
                  "image_id": null,
                  "option_1": "黑",
                  "option_2": "XL",
                  "option_3": "",
                  "price": 10.01,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:12:55.620+08:00",
                  "volume": 0,
                  "weight": 40
              }
          ],
          "vendor": {
              "id": 1194,
              "name": "商品品牌样例",
              "handle": "v000006",
              "page_url": "/vendors/v000006"
          },
          "visibility": true
      }
      }
      
    • 修改 Product 的封面图片
    • PUT /products/#{id}
        {
          "product": {
            "image": {
              "id": 16215
            }
          }
        }
      
    • {
      "product": {
          "body_html": "<p>API商品样例</p>",
          "created_at": "2015-04-27T19:47:00.648+08:00",
          "display_sale": 0,
          "handle": "p001098",
          "id": 8804,
          "image": {
              "alt": "",
              "created_at": "2015-04-27T20:14:36.999+08:00",
              "file_name": "1.jpeg",
              "id": 16214,
              "position": 1,
              "product_id": 8804,
              "src": "https://asset.ibanquan.com/image/553e282c4812f234b500004c/s.jpeg?v=1430136876",
              "updated_at": "2015-04-27T20:14:36.999+08:00",
              "variant_ids": [
              ]
          },
          "images": [
              {
                  "alt": "",
                  "created_at": "2015-04-27T20:14:36.999+08:00",
                  "file_name": "1.jpeg",
                  "id": 16214,
                  "position": 1,
                  "product_id": 8804,
                  "src": "https://asset.ibanquan.com/image/553e282c4812f234b500004c/s.jpeg?v=1430136876",
                  "updated_at": "2015-04-27T20:14:36.999+08:00",
                  "variant_ids": [
                  ]
              },
              {
                  "alt": "",
                  "created_at": "2015-04-27T20:14:37.840+08:00",
                  "file_name": "80.jpeg",
                  "id": 16215,
                  "position": 2,
                  "product_id": 8804,
                  "src": "https://asset.ibanquan.com/image/553e282daaba8c339e000042/s.jpeg?v=1430136877",
                  "updated_at": "2015-04-27T20:14:37.840+08:00",
                  "variant_ids": [
                  ]
              },
              {
                  "alt": "",
                  "created_at": "2015-04-27T20:14:38.701+08:00",
                  "file_name": "maillogo1.png",
                  "id": 16216,
                  "position": 3,
                  "product_id": 8804,
                  "src": "https://asset.ibanquan.com/image/553e282e4812f234b500004f/s.png?v=1430136878",
                  "updated_at": "2015-04-27T20:14:38.701+08:00",
                  "variant_ids": [
                  ]
              }
          ],
          "name": "API商品样例",
          "options": [
              {
                  "id": 137,
                  "name": "颜色",
                  "values": [
                      "白",
                      "黑"
                  ],
                  "position": 1
              },
              {
                  "id": 22784,
                  "name": "尺寸",
                  "values": [
                      "X",
                      "XL"
                  ],
                  "position": 2
              }
          ],
          "page_description": "API商品样例",
          "page_title": "API商品样例",
           "share_description": "API商品样例",
          "share_title": "API商品样例",
          "sale": 0,
          "types": [
              {
                  "id": 1985,
                  "name": "商品分类1",
                  "handle": "t000004",
                  "page_url": "/types/t000004"
              },
              {
                  "id": 1986,
                  "name": "商品分类2",
                  "handle": "t000005",
                  "page_url": "/types/t000005"
              }
          ],
          "updated_at": "2015-04-27T20:14:40.036+08:00",
          "variants": [
              {
                  "barcode": "I2008X03",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11938,
                  "image_id": null,
                  "option_1": "白",
                  "option_2": "XL",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:16:08.634+08:00",
                  "volume": 0,
                  "weight": 40
              },
              {
                  "barcode": "I2008X01",
                  "compare_price": 1000,
                  "created_at": null,
                  "id": 11939,
                  "image_id": null,
                  "option_1": "白",
                  "option_2": "X",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:16:08.628+08:00",
                  "volume": 0,
                  "weight": 40
              },
              {
                  "barcode": "I2008X02",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11940,
                  "image_id": null,
                  "option_1": "黑",
                  "option_2": "XL",
                  "option_3": "",
                  "price": 10.01,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:16:08.622+08:00",
                  "volume": 0,
                  "weight": 40
              }
          ],
          "vendor": {
              "id": 1194,
              "name": "商品品牌样例",
              "handle": "v000006",
              "page_url": "/vendors/v000006"
          },
          "visibility": true
      }
      }
      
    • 修改 Product,下架该商品
    • PUT /products/#{id}
        {
          "product": {
            "visibility": false
          }
        }
      
    • {
      "product": {
          "body_html": "<p>API商品样例</p>",
          "created_at": "2015-04-27T19:47:00.648+08:00",
          "display_sale": 0,
          "handle": "p001098",
          "id": 8804,
          "image": {
              "alt": "",
              "created_at": "2015-04-27T20:14:36.999+08:00",
              "file_name": "1.jpeg",
              "id": 16214,
              "position": 1,
              "product_id": 8804,
              "src": "https://asset.ibanquan.com/image/553e282c4812f234b500004c/s.jpeg?v=1430136876",
              "updated_at": "2015-04-27T20:14:36.999+08:00",
              "variant_ids": [
              ]
          },
          "images": [
              {
                  "alt": "",
                  "created_at": "2015-04-27T20:14:36.999+08:00",
                  "file_name": "1.jpeg",
                  "id": 16214,
                  "position": 1,
                  "product_id": 8804,
                  "src": "https://asset.ibanquan.com/image/553e282c4812f234b500004c/s.jpeg?v=1430136876",
                  "updated_at": "2015-04-27T20:14:36.999+08:00",
                  "variant_ids": [
                  ]
              },
              {
                  "alt": "",
                  "created_at": "2015-04-27T20:14:37.840+08:00",
                  "file_name": "80.jpeg",
                  "id": 16215,
                  "position": 2,
                  "product_id": 8804,
                  "src": "https://asset.ibanquan.com/image/553e282daaba8c339e000042/s.jpeg?v=1430136877",
                  "updated_at": "2015-04-27T20:14:37.840+08:00",
                  "variant_ids": [
                  ]
              },
              {
                  "alt": "",
                  "created_at": "2015-04-27T20:14:38.701+08:00",
                  "file_name": "maillogo1.png",
                  "id": 16216,
                  "position": 3,
                  "product_id": 8804,
                  "src": "https://asset.ibanquan.com/image/553e282e4812f234b500004f/s.png?v=1430136878",
                  "updated_at": "2015-04-27T20:14:38.701+08:00",
                  "variant_ids": [
                  ]
              }
          ],
          "name": "API商品样例",
          "options": [
              {
                  "id": 137,
                  "name": "颜色",
                  "values": [
                      "白",
                      "黑"
                  ],
                  "position": 1
              },
              {
                  "id": 22784,
                  "name": "尺寸",
                  "values": [
                      "X",
                      "XL"
                  ],
                  "position": 2
              }
          ],
          "page_description": "API商品样例",
          "page_title": "API商品样例",
          "share_description": "API商品样例",
          "share_title": "API商品样例",
          "sale": 0,
          "types": [
              {
                  "id": 1985,
                  "name": "商品分类1",
                  "handle": "t000004",
                  "page_url": "/types/t000004"
              },
              {
                  "id": 1986,
                  "name": "商品分类2",
                  "handle": "t000005",
                  "page_url": "/types/t000005"
              }
          ],
          "updated_at": "2015-04-27T20:14:40.036+08:00",
          "variants": [
              {
                  "barcode": "I2008X03",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11938,
                  "image_id": null,
                  "option_1": "白",
                  "option_2": "XL",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:16:08.634+08:00",
                  "volume": 0,
                  "weight": 40
              },
              {
                  "barcode": "I2008X01",
                  "compare_price": 1000,
                  "created_at": null,
                  "id": 11939,
                  "image_id": null,
                  "option_1": "白",
                  "option_2": "X",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:16:08.628+08:00",
                  "volume": 0,
                  "weight": 40
              },
              {
                  "barcode": "I2008X02",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11940,
                  "image_id": null,
                  "option_1": "黑",
                  "option_2": "XL",
                  "option_3": "",
                  "price": 10.01,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:16:08.622+08:00",
                  "volume": 0,
                  "weight": 40
              }
          ],
          "vendor": {
              "id": 1194,
              "name": "商品品牌样例",
              "handle": "v000006",
              "page_url": "/vendors/v000006"
          },
          "visibility": false
      }
      }
      
    • 修改 Product,更新所有 ProductVariant 的编码并删除未传入的 ProductVariant
    • PUT /products/#{id}
        {
          "product": {
            "variants": [
              {
                "barcode": "I2008X031",
                "id": 11938
              },
              {
                "barcode": "I2008X012",
                "id": 11939
              }
            ]
          }
        }
      
    • {
      "product": {
          "body_html": "<p>API商品样例</p>",
          "created_at": "2015-04-27T19:47:00.648+08:00",
          "display_sale": 0,
          "handle": "p001098",
          "id": 8804,
          "image": {
              "alt": "",
              "created_at": "2015-04-27T20:14:37.840+08:00",
              "file_name": "80.jpeg",
              "id": 16215,
              "position": 2,
              "product_id": 8804,
              "src": "https://asset.ibanquan.com/image/553e282daaba8c339e000042/s.jpeg?v=1430136877",
              "updated_at": "2015-04-27T20:14:37.840+08:00",
              "variant_ids": [
              ]
          },
          "images": [
              {
                  "alt": "",
                  "created_at": "2015-04-27T20:14:36.999+08:00",
                  "file_name": "1.jpeg",
                  "id": 16214,
                  "position": 1,
                  "product_id": 8804,
                  "src": "https://asset.ibanquan.com/image/553e282c4812f234b500004c/s.jpeg?v=1430136876",
                  "updated_at": "2015-04-27T20:14:36.999+08:00",
                  "variant_ids": [
                  ]
              },
              {
                  "alt": "",
                  "created_at": "2015-04-27T20:14:37.840+08:00",
                  "file_name": "80.jpeg",
                  "id": 16215,
                  "position": 2,
                  "product_id": 8804,
                  "src": "https://asset.ibanquan.com/image/553e282daaba8c339e000042/s.jpeg?v=1430136877",
                  "updated_at": "2015-04-27T20:14:37.840+08:00",
                  "variant_ids": [
                  ]
              },
              {
                  "alt": "",
                  "created_at": "2015-04-27T20:14:38.701+08:00",
                  "file_name": "maillogo1.png",
                  "id": 16216,
                  "position": 3,
                  "product_id": 8804,
                  "src": "https://asset.ibanquan.com/image/553e282e4812f234b500004f/s.png?v=1430136878",
                  "updated_at": "2015-04-27T20:14:38.701+08:00",
                  "variant_ids": [
                  ]
              }
          ],
          "name": "API商品样例",
          "options": [
              {
                  "id": 137,
                  "name": "颜色",
                  "values": [
                      "黑",
                      "白"
                  ],
                  "position": 1
              },
              {
                  "id": 22784,
                  "name": "尺寸",
                  "values": [
                      "X",
                      "XL"
                  ],
                  "position": 2
              }
          ],
          "page_description": "API商品样例",
          "page_title": "API商品样例",
          "share_description": "API商品样例",
          "share_title": "API商品样例",
          "sale": 0,
          "types": [
              {
                  "id": 1985,
                  "name": "商品分类1",
                  "handle": "t000004",
                  "page_url": "/types/t000004"
              },
              {
                  "id": 1986,
                  "name": "商品分类2",
                  "handle": "t000005",
                  "page_url": "/types/t000005"
              }
          ],
          "updated_at": "2015-04-27T20:14:40.036+08:00",
          "variants": [
              {
                  "barcode": "I2008X031",
                  "compare_price": 0,
                  "created_at": null,
                  "id": 11938,
                  "image_id": null,
                  "option_1": "白",
                  "option_2": "XL",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:20:05.943+08:00",
                  "volume": 0,
                  "weight": 40
              },
              {
                  "barcode": "I2008X012",
                  "compare_price": 1000,
                  "created_at": null,
                  "id": 11939,
                  "image_id": null,
                  "option_1": "白",
                  "option_2": "X",
                  "option_3": "",
                  "price": 10,
                  "product_id": 8804,
                  "stock": 9,
                  "updated_at": "2015-04-27T20:20:05.950+08:00",
                  "volume": 0,
                  "weight": 40
              }
          ],
          "vendor": {
              "id": 1194,
              "name": "商品品牌样例",
              "handle": "v000006",
              "page_url": "/vendors/v000006"
          },
          "visibility": true
      }
      }
      

DELETE /products/#{id}

删除 Product

    • 删除 Product
    • DELETE /products/#{id}
    • {}
      

POST /products/#{id}/upload_base64_share

上传社交分享图片,id为对应商品的id

    • file_name
    • 上传图片的名称
    • attachment
    • 经过base64编码的图片。
    • 创建 share image
    • POST /products/4008/upload_base64_share
        {
          "share_image": {
            "file_name":"s.jpg",
            "attachment": "data:image/gif;base64,R0lGODlhAQABAID/AP///wAAACwAAAAAAQABAAACAkQBADs="
          }
        }
      
    • {
      "share_image": {
         "epoch": "1463994523", 
         "height": 150, 
         "id":788, 
         "image_id":"57406f4080ea3e74b8000002", 
         "src":"/image/57406f4080ea3e74b8000002/s.jpg?1463994523", 
         "width": 228
      }
      }
      

DELETE /products/#{id}/remove_share

删除指定 product的社交分享图片。

    • 删除ID为4008的 product的社交分享图片。
    • DELETE /products/4008/remove_share
    • {}
      
免费领取15天试用
立即注册
联系客服
微信咨询
微信二维码

领取免费试用资格

姓名 *

电话 *

公司名称

所在地区

意向产品

提交

提交成功

你好, XXX女士/先生 ,你的需求已提交成功,后续会有专门的客户经理与你电话联系。谢谢!