< img height="1" width="1" src="https://www.facebook.com/tr?id=128121387916608&ev=PageView&noscript=1" /> Shoplazza Open API - 店匠shoplazza

Shoplazza Open API

125 views admin 0

Shoplazza Open API

使用店匠提供的开方平台API,App开发者能够为各种场景创建强大的电子商务解决方案,包括将您的服务集成到Shoplazza管理后台,自定义流程等等。

API授权认证

您的APP在和店匠API进行交互的时候,必须在每个HTTP请求中提供必要的身份验证凭据。 Shoplazza开放平台中,​​使用的认证方式是主流的Oauth2授权协议。

开发的APP,只要已经被Shoplazza店家安装,并且获取到了相应的授权权限,就可以透过开放平台API访问店铺的资源。

 

您可以根据平台提供的app_id和app_secret,通过OAuth获取店家授权。

授权流程

获得授权的方式有两种:Oauth方式和Private App方式。通过Oauth方式获取授权的App可以在应用市场中展示,由商家根据需要进行安装授权使用。通过Private App方式获取授权的App不会在应用市场中显示,其他商家不会得知该App的存在。

OAuth方式

如果您的应用没有通过授权认证,将无法获取店匠数据。在您获取任何api资源之前,必须得到店匠店家的认证。本指南将会引导您完成授权认证。(OAuth2.0规范中有更详细的描述)

相关术语

在您详细了解授权过程之前,请熟悉本指南中使用的一些关键术语:

  • 客户端:任何想要访问店铺信息的应用程序。客户端想要访问任何数据都需要先获取店家(通常是店主)的授权。
  • API: 店匠的REST风格API。客户端可以通过这些API查看和修改店家的数据。
  • 店家:店家账号持有人,通常是店主。店家可以通过授权客户端,使客户端通过REST API获取店家数据。

第一步:获取客户端资格

您需要获得API key和API secret key,以便在授权过程中用于表明您的身份。

获取客户端资格:請聯系Shoplazza的開發以獲取API Key & API Secret Key,在这个过程中,你需要提供App的基本信息以及两个接口的地址(Oauth触发接口app_uri, 和Oauth回调接口redirect_uri)

第二步:请求获得许可

流程的第一步是获取店家的授权,已登录店家在应用商店点击安装您的APP时,Shoplazza系统会首先以Get方式调用您提供的触发接口app_uri。

您提供的app_uri接口需要跳转至以下地址进行授权:

https://{store_name}.myshoplaza.com/admin/oauth/authorize?client_id={api_key}&scope={scopes}&redirect_uri={redirect_uri}&response_type={response_type}

通过以下字段替换:

  • store_name:店铺名称,通常是店家域名的slug。
  • api_key用应用程序的API密钥替换它。
  • scopes:用空格分隔的scope列表替换它。 例如,要编写订单和读取顾客信息,请使用scope=write_orders read_customers。详见授权列表
  • redirect_uri: 将此替换为您在授权客户端后重定向用户的URL。 此处指定的完整URL必须与其中一个应用程序重定向URL相同。
  • response_type: 此请求下值为code

第三步:确认授权

当用户单击提示中的“授权”按钮时,它们将被重定向到上面指定的客户端服务器地址。 确认重定向中传递的参数。

http://example.com/some/redirect/uri?code={authorization_code}&shop={store_name}.myshoplaza.com&hmac={hmac}

 

在继续接下来的流程之前,请确保您的应用程序执行了以下安全检查。 如果任何检查失败,您的APP必须拒绝该请求并返回错误,不得继续进行。

  • 校验hmac字段,确认其值正确,hmac生成算法参见Hmac算法

如果所有的安全检查都通过了,接下来你可以使用授权code交换获得一个维持时间两小时的access_token和不过期的refresh_token。使用下面的请求完成交换。

POST https://{store_name}.myshoplaza.com/admin/oauth/token{

  “grant_type”:”authorization_code”,

  “client_id”:”14″,

  “client_secret”:”7afb125cdc3711050d9fca108c64d37f”,

  “redirect_uri”:”https://example.com/some/shoplazza/callback”, 

  “code”:”eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjQ”

}

 

POST请求的body数据需要包含如下所示参数

  • client_id: API key。
  • client_secret: API secret key
  • code: 回调地址中提供的授权code
  • grant_type:授权方式,该请求下为authorization_code
  • redirect_uri:回调地址

请求成功之后将会返回access_token、refresh_token、expires_in等字段

{  “token_type”: “Bearer”,

  “expires_at”: 1550546245,

  “access_token”: “eyJ0eXAiOiJKV1QiLCJh”,

  “refresh_token”: “def502003d28ba08a964e”,

  “store_id”: “2”,

  “store_name”: “xiong1889”

}

 

字段 描述
token_type 返回Bearer
expires_at 访问密钥过期时间
access_token 访问密钥
refresh_token 更新密钥,用于更新密钥
store_id 店铺id
store_name 用户名,通常是店家域名的slug

 

access_token失效之后,请使用下面的请求完成更新access_token的操作(您必须保存更新之后的refresh_token已方便再次进行更新。)

POST https://{store_name}.myshoplaza.com/admin/oauth/token

 

  • client_id: API key。
  • client_secret: API secret key
  • refresh_token: 保存在您应用中的refresh_token数据。
  • grant_type:授权方式,该请求下为refresh_token
  • redirect_uri:回调地址

授权列表

  • read_product, write_product
  • read_order, write_order
  • read_collection, write_collection
  • read_shop
  • read_comments, write_comments
  • read_script_tags, write_script_tags

Hmac算法

 

以下面的回调地址为例:

http://example.com/some/redirect/uri?code=1vtke5ljOOL2jPds6gM0TNCeYZDitYB&shop=simon.myshoplaza.com&hmac=22bad22eee1f92836f7773e87d973479

 

首先把所有参数(除了hmac参数)按照key=value方式以字典顺序排序,并以”&”拼装成如下字符串:

 

code=1vtke5ljOOL2jPds6gM0TNCeYZDitYB&shop=simon.myshoplaza.com

最后以Hmac算法,配合API secret key,来算出hmac值,并比对回调地址返回的hmac值.

具体Ruby示例代码如下:

API_SECRET = ‘my_api_secret’

class ShoplazaAuthController < ApplicationController
  def callback
    hmac = params.delete(‘hmac’)
    data = params.to_query
    verified = verify_webhook(data, hmac)
    puts “Webhook verified: #{verified}”
  end

  protected

  def verify_webhook(data, hmac)
    sha256 = OpenSSL::Digest::SHA256.new
    calculated_hmac = OpenSSL::HMAC.hexdigest(sha256, API_SECRET, data)
    ActiveSupport::SecurityUtils.secure_compare(calculated_hmac, hmac)
  end
end

 

Private App方式

请在店匠管理后台应用市场内创建private app以获取Access-Token

调用OpenApi

    首先根据店铺名称拼接域名,例:abc.myshoplaza.com;然后加上需要请求的API路径及参数,例:abc.myshoplaza.com/openapi/orders?page=1;然后在请求中添加Header:Access-Token、Token-Type,若token过期则需要重新获取token;最后发起请求,得到返回结果。

订单API

订单属性

订单 Order

属性名称 类型 描述
number string 订单编号
note string 订单备注
total_price number 总价
sub_total number
currency string 货币类型
financial_status string 订单支付状态waiting(待支付),paid(已支付),cancelled(已取消),failed(失败)
status string 订单状态 opened(未完成),placed(进行中),finished(已完成),cancelled(已取消)
canceled_at date 订单取消时间
cancel_reason string 订单取消原因
payment_method string 支付方式 (cod, online , none)
fulfillment_status string 物流状态 initialled(空),waiting(待发货),partially_shipped(部分发货),shipped(已发货),partially_finished(部分完成),finished(已完成), cancelled(取消)
customer_deleted_at date 客户删除订单时间
deleted_at date 订单删除时间
placed_at date 订单确认时间
tags string 订单标签
discount_code string 订单优惠码
buyer_accepts_marketing boolean 客户是否订阅订单通知
code_discount_total number 订单优惠码优惠价格
line_item_discount_total number 商品折扣
customer_note string 客户备注
total_discount number 订单折扣
total_tax number 总税费
total_shipping number 运费
created_at date 创建时间
updated_at date 更新时间
customer email string 客户邮件
first_name string
last_name string
orders_count number 客户下单数
total_spent number 顾客消费总额
phone string 客户手机号码
shipping_address first_name string 收货人名
last_name string 收货人姓
address1 string 地址
address2 string 地址
phone string 手机号码
city string 城市
zip string 邮编
province string 省份
country string 国家
company string 公司
latitude string 纬度
longtude string 经度
name string 收货人姓名
country_code string 国家代码
province_code string 省份代码
phone_area_code string 手机区号
email string 邮件
area string 区域
billing_address first_name string
last_name string
address1 string 帐单地址
address2 string 门牌号
city string 城市
zip string 邮编
province string 省份
country string 国家
company string 公司
latitude string 经度
longtude string 纬度
name string 姓名
country_code string 国家代码
province_code string 省份代码
phone_area_code string 手机区号
email string 邮箱
area string 区域
shipping_line
name string 物流方案名称
line_item product_title string 商品标题
variant_title string 子商品标题
quantity number 商品数量
note string 备注
image json 商品图片
price number 商品售价
compare_at_price number 商品原价
total number 总价
sku string sku
weight number 重量(kg, g …)
weight_unit string 重量单位
vendor string 商品供应商
properties json 商品属性
product_url string 商品url
product_handle string 商品handle

 

运单 fulfillment

属性名称 类型 描述
status string 运单状态 waiting(待发货),shipped(已发货),finished(已完成),cancelled(已取消)
tracking_company string 物流公司
tracking_number string 运单号
tracking_company_code string 物流公司编号

 

订单列表API 

GET /openapi/orders

Parameter:

params key type required example values describe
ids string N “id, id” ids, 用英文逗号分隔
limit Integer N 20 每页记录条数,default: 50, maximum: 250
page Integer N 1 第几页,default: 1
created_at_min string N “2016-01-18T23:41:00” 起始创建时间
created_at_max string N “2016-01-18T23:41:00” 结束创建时间
updated_at_min string N “2014-04-25T16:15:47” 起始更新时间
updated_at_max string N “2014-04-25T16:15:47” 结束更新时间
status String N “opened” 订单状态 opened(未完成),placed(进行中),finished(已完成),cancelled(已取消)
financial_status String N “waiting” 订单支付状态 waiting(待支付),paid(已支付),cancelled(已取消),failed(失败)
fulfillment_status String N “initalled” 订单物流状态 initialled(空),waiting(待发货),partially_shipped(部分发货),shipped(已发货),partially_finished(部分完成),finished(已完成), cancelled(取消)

 

Example Response:

1) response 200 status code and following json message:

{
  “orders”: [
      {
            “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
            “created_at”: “2014-04-25T16:15:47-04:00”,
            “updated_at”: “2014-04-25T16:15:47-04:00”,
            “note”: “abc”,
            “number”: “ASD01245”,
            “total_price”: “16.99”,
            “sub_total”: “15.00”,
            “currency”: “USD”,
            “financial_status”: “waiting”,
            “status”: “opened”,
            “canceled_at”: null,
            “cancel_reason”: null,
            “payment_method”: “online”,
            “fulfillment_status”: “waiting”,
            “customer_deleted_at”: “2014-04-25T16:15:47-04:00”,
            “deleted_at”: “2014-04-25T16:15:47-04:00”,
            “placed_at”: “2014-04-25T16:15:47-04:00”,
            “tags”: “a, b”,
            “discount_code”: “”,
            “buyer_accepts_marketing”: false,
            “code_discount_total”: “1.00”,
            “line_item_discount_total”: “1.00”,
            “customer_note”: “note”,
            “total_discount”: “100.00”,
            “total_tax”: “10.00”,            “total_shipping”: “1.00”,
            “line_items”: [
                {
                    “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                    “product_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                    “product_title”: “abc”,
                    “variant_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                    “variant_title”: “XXX”,
                    “quantity”: 10,
                    “note”: “red”,
                    “image”: “http://www.a.com/xxx.jpg”,
                    “price”: 12.34,
                    “compare_at_price”: 12.34,
                    “total”: “12.34 USD”,
                    “fulfillment_status”: “waiting”,
                    “sku”: “xxx”,
                    “weight”: 1.23,
                    “weight_unit”: “g”,
                    “vendor”: “XXX”,

                    “product_handle”: “abc”,

                    “product_url”: “http://www.a.com/abc”,
                    “properties”: [
                        {
                            “name”: “color”,
                            “value”: “red”
                        }
                    ]
                }
            ],
            “shipping_line”: {
                “name”: “free”
            },
            “billing_address”: {
                “first_name”: “Bob”,
                “last_name”: “Norman”,
                “address1”: “Chestnut Street 92”,
                “address2”: “”,
                “city”: “Louisville”,
                “zip”: “40202”,
                “province”: “Kentucky”,
                “country”: “United States”,
                “company”: null,
                “latitude”: 45.41634,
                “longitude”: -75.6868,
                “name”: “Bob Norman”,
                “country_code”: “US”,
                “province_code”: “KY”,

                “email”: “test@gmail.com”, 

                “area”: “sz”
          },
          “shipping_address”: {
              “first_name”: “Bob”,
              “last_name”: “Norman”,
              “address1”: “Chestnut Street 92”,
              “address2”: “”,
              “phone”: “555-625-1199”,
              “city”: “Louisville”,
              “zip”: “40202”,
              “province”: “Kentucky”,
              “country”: “United States”,
              “company”: null,
              “latitude”: 45.41634,
              “longitude”: -75.6868,
              “name”: “Bob Norman”,
              “country_code”: “US”,
              “province_code”: “KY”,

              “phone_area_code”: “80”,
              “area”: “sz”,

              “email”: “test@gmail.com”
          },
          “fulfillments”: [
              {
                  “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                  “order_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                  “status”: “waiting”,
                  “created_at”: “2018-11-02T12:30:10-04:00”,
                  “updated_at”: “2018-11-02T12:30:10-04:00”,
                  “tracking_company”: null,
                  “tracking_number”: “1Z2345”,

                  “tracking_company_code”: “3306”,
                  “line_items”: [
                      {
                          “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                          “product_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                          “product_title”: “abc”,
                          “variant_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                          “variant_title”: “XXX”,
                          “quantity”: 10,
                          “note”: “red”,
                          “image”: “http://www.a.com/xxx.jpg”,
                          “price”: 12.34,
                          “compare_at_price”: 12.34,
                          “total”: “12.34 USD”,
                          “fulfillment_status”: “waiting”,
                          “sku”: “xxx”,
                          “weight”: 1.23,
                          “weight_unit”: “g”,
                          “vendor”: “XXX”,

                          “product_handle”: “abc”,

                          “product_url”: “http://www.a.com/abc”,
                          “properties”: [
                              {
                                  “name”: “color”,
                                  “value”: “red”
                              },
                              {
                                  “name”: “color”,
                                  “value”: “red”
                              }
                          ]
                      }
                  ]
              }
          ],
          “customer”:{
              “email”: “bob.norman@hostmail.com”,
              “created_at”: “2018-11-02T12:30:10-04:00”,
              “updated_at”: “2018-11-02T12:30:10-04:00”,
              “first_name”: “Bob”,
              “last_name”: “Norman”,
              “orders_count”: 1,
              “total_spent”: “41.94”,
              “phone”: “”,
          }
      }
  ]
}

 

订单详情API

GET /openapi/orders/{id}
Example Response:
1)response 200 status code and following json message:

 

{
  “order”:{
      “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
      “created_at”: “2014-04-25T16:15:47-04:00”,
      “updated_at”: “2014-04-25T16:15:47-04:00”,
      “note”: “abc”,
      “number”: “ASD01245”,
      “total_price”: “16.99”,
      “sub_total”: “15.00”,
      “currency”: “USD”,
      “financial_status”: “waiting”,
      “status”: “opened”,
      “canceled_at”: null,
      “cancel_reason”: null,
      “payment_method”: “online”,
      “fulfillment_status”: “waiting”,
      “customer_deleted_at”: “2014-04-25T16:15:47-04:00”,
      “deleted_at”: “2014-04-25T16:15:47-04:00”,
      “placed_at”: “2014-04-25T16:15:47-04:00”,
      “tags”: “a, b”,
      “discount_code”: “”,
      “buyer_accepts_marketing”: false,
      “code_discount_total”: “1.00”,
      “line_item_discount_total”: “1.00”,
      “customer_note”: “note”,
      “total_discount”: “100.00”,
      “total_tax”: “10.00”,      “total_shipping”: “1.00”,
      “line_items”: [
          {
              “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “product_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “product_title”: “abc”,
              “variant_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “variant_title”: “XXX”,
              “quantity”: 10,
              “note”: “red”,
              “image”: “http://www.a.com/xxx.jpg”,
              “price”: 12.34,
              “compare_at_price”: 12.34,
              “total”: “12.34 USD”,
              “fulfillment_status”: “waiting”,
              “sku”: “xxx”,
              “weight”: 1.23,
              “weight_unit”: “g”,
              “vendor”: “XXX”,

              “product_handle”: “abc”,

              “product_url”: “http://www.a.com/abc”,
              “properties”: [
                  {
                      “name”: “color”,
                      “value”: “red”
                  }
              ]
          }
      ],
      “shipping_line”: {
          “name”: “free”
      },
      “billing_address”: {
          “first_name”: “Bob”,
          “last_name”: “Norman”,
          “address1”: “Chestnut Street 92”,
          “address2”: “”,
          “city”: “Louisville”,
          “zip”: “40202”,
          “province”: “Kentucky”,
          “country”: “United States”,
          “company”: null,
          “latitude”: 45.41634,
          “longitude”: -75.6868,
          “name”: “Bob Norman”,
          “country_code”: “US”,
          “province_code”: “KY”,

          “email”: “test@gmail.com”, 

          “area”: “sz”
      },
      “shipping_address”: {
          “first_name”: “Bob”,
          “last_name”: “Norman”,
          “address1”: “Chestnut Street 92”,
          “address2”: “”,
          “phone”: “555-625-1199”,
          “city”: “Louisville”,
          “zip”: “40202”,
          “province”: “Kentucky”,
          “country”: “United States”,
          “company”: null,
          “latitude”: 45.41634,
          “longitude”: -75.6868,
          “name”: “Bob Norman”,
          “country_code”: “US”,
          “province_code”: “KY”,

          “phone_area_code”: “80”,
          “area”: “sz”,

          “email”: “test@gmail.com”
      },
      “fulfillments”: [
          {
              “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “order_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “status”: “waiting”,
              “created_at”: “2018-11-02T12:30:10-04:00”,
              “updated_at”: “2018-11-02T12:30:10-04:00”,
              “tracking_company”: null,
              “tracking_number”: “1Z2345”,

              “tracking_company_code”: “3306”,
              “line_items”: [
                  {
                      “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                      “product_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                      “product_title”: “abc”,
                      “variant_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                      “variant_title”: “XXX”,
                      “quantity”: 10,
                      “note”: “red”,
                      “image”: “http://www.a.com/xxx.jpg”,
                      “price”: 12.34,
                      “compare_at_price”: 12.34,
                      “total”: “12.34 USD”,
                      “fulfillment_status”: “waiting”,
                      “sku”: “xxx”,
                      “weight”: 1.23,
                      “weight_unit”: “g”,
                      “vendor”: “XXX”,

                      “product_handle”: “abc”,

                      “product_url”: “http://www.a.com/abc”,
                      “properties”: [
                          {
                              “name”: “color”,
                              “value”: “red”
                          },
                          {
                              “name”: “color”,
                              “value”: “red”
                          }
                      ]
                  }
              ]
          }
      ],
      “customer”:{
          “email”: “bob.norman@hostmail.com”,
          “created_at”: “2018-11-02T12:30:10-04:00”,
          “updated_at”: “2018-11-02T12:30:10-04:00”,
          “first_name”: “Bob”,
          “last_name”: “Norman”,
          “orders_count”: 1,
          “total_spent”: “41.94”,
          “phone”: “”,
      }
  }
}

 

2)response 404 status code and following json message: 

{
    errors: [“record not found”]
}

 

订单数量API

GET /openapi/orders/count

Parameter:

params key type required example values describe
created_at_min string N “2016-01-18T23:41:00-08:00” 起始创建时间
created_at_max string N “2016-01-18T23:41:00-08:00” 结束创建时间
updated_at_min string N “2014-04-25T16:15:47-04:00” 起始更新时间
updated_at_max string N “2014-04-25T16:15:47-04:00” 结束更新时间
status String N “opened” 订单状态 opened(未完成),placed(进行中),finished(已完成),cancelled(已取消)
financial_status String N “waiting” 订单支付状态 waiting(待支付),paid(已支付),cancelled(已取消),failed(失败)
fulfillment_status String N “initalled” 订单物流状态 initialled(空),waiting(待发货),partially_shipped(部分发货),shipped(已发货),partially_finished(部分完成),finished(已完成), cancelled(取消)

Example Response:

1) response 200 status code and following json message:

{
    “count”: 1
}

 

删除订单API

DELETE /openapi/orders/{id}

Example Response:

1)response 200 status code

2)response 404 status code and following json message:

 

{
    errors: [“record not found”]
}


3) response 422 status code and following json message:

 

{
    errors: [“cannot delete order in this state”]
}

 

取消订单API

POST /openapi/orders/{id}/cancel

Parameter:

params key type required example values describe
reason string N “取消原因” 取消原因

Example Response:

1) response 200 status code and following json message:

 

{
  “order”:{
      “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
      “created_at”: “2014-04-25T16:15:47-04:00”,
      “updated_at”: “2014-04-25T16:15:47-04:00”,
      “note”: “abc”,
      “number”: “ASD01245”,
      “total_price”: “16.99”,
      “sub_total”: “15.00”,
      “currency”: “USD”,
      “financial_status”: “waiting”,
      “status”: “opened”,
      “canceled_at”: null,
      “cancel_reason”: null,
      “payment_method”: “online”,
      “fulfillment_status”: “waiting”,
      “customer_deleted_at”: “2014-04-25T16:15:47-04:00”,
      “deleted_at”: “2014-04-25T16:15:47-04:00”,
      “placed_at”: “2014-04-25T16:15:47-04:00”,
      “tags”: “a, b”,
      “discount_code”: “”,
      “buyer_accepts_marketing”: false,
      “code_discount_total”: “1.00”,
      “line_item_discount_total”: “1.00”,
      “customer_note”: “note”,
      “total_discount”: “100.00”,
      “total_tax”: “10.00”,
      “line_items”: [
          {
              “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “product_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “product_title”: “abc”,
              “variant_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “variant_title”: “XXX”,
              “quantity”: 10,
              “note”: “red”,
              “image”: “http://www.a.com/xxx.jpg”,
              “price”: 12.34,
              “compare_at_price”: 12.34,
              “total”: “12.34 USD”,
              “fulfillment_status”: “waiting”,
              “sku”: “xxx”,
              “weight”: 1.23,
              “weight_unit”: “g”,
              “vendor”: “XXX”,
              “properties”: [
                  {
                      “name”: “color”,
                      “value”: “red”
                  }
              ]
          }
      ],
      “shipping_line”: {
          “name”: “free”
      },
      “billing_address”: {
          “first_name”: “Bob”,
          “last_name”: “Norman”,
          “address1”: “Chestnut Street 92”,
          “address2”: “”,
          “city”: “Louisville”,
          “zip”: “40202”,
          “province”: “Kentucky”,
          “country”: “United States”,
          “company”: null,
          “latitude”: 45.41634,
          “longitude”: -75.6868,
          “name”: “Bob Norman”,
          “country_code”: “US”,
          “province_code”: “KY”,          “email”: “test@gmail.com”, 

          “area”: “sz”
      },
      “shipping_address”: {
          “first_name”: “Bob”,
          “last_name”: “Norman”,
          “address1”: “Chestnut Street 92”,
          “address2”: “”,
          “phone”: “555-625-1199”,
          “city”: “Louisville”,
          “zip”: “40202”,
          “province”: “Kentucky”,
          “country”: “United States”,
          “company”: null,
          “latitude”: 45.41634,
          “longitude”: -75.6868,
          “name”: “Bob Norman”,
          “country_code”: “US”,
          “province_code”: “KY”,

          “phone_area_code”: “80”,

          “area”: “KY”,

          “email”: “80”,

          “phone_area_code”: “80”
      },
      “fulfillments”: [
          {
              “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “order_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “status”: “waiting”,
              “created_at”: “2018-11-02T12:30:10-04:00”,
              “updated_at”: “2018-11-02T12:30:10-04:00”,
              “tracking_company”: null,
              “tracking_number”: “1Z2345”,

              “tracking_company_code”: “3306”,
              “line_items”: [
                  {
                      “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                      “product_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                      “product_title”: “abc”,
                      “variant_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                      “variant_title”: “XXX”,
                      “quantity”: 10,
                      “note”: “red”,
                      “image”: “http://www.a.com/xxx.jpg”,
                      “price”: 12.34,
                      “compare_at_price”: 12.34,
                      “total”: “12.34 USD”,
                      “fulfillment_status”: “waiting”,
                      “sku”: “xxx”,
                      “weight”: 1.23,
                      “weight_unit”: “g”,
                      “vendor”: “XXX”,
                      “properties”: [
                          {
                              “name”: “color”,
                              “value”: “red”
                          },
                          {
                              “name”: “color”,
                              “value”: “red”
                          }
                      ]
                  }
              ]
          }
      ],
      “customer”:{
          “email”: “bob.norman@hostmail.com”,
          “created_at”: “2018-11-02T12:30:10-04:00”,
          “updated_at”: “2018-11-02T12:30:10-04:00”,
          “first_name”: “Bob”,
          “last_name”: “Norman”,
          “orders_count”: 1,
          “total_spent”: “41.94”,
          “phone”: “”,
      }
  }
}

 

订单退款API

POST /openapi/orders/{id}/refund

Example Response:

1) response 200 status code

2)response 404 status code and following json message:

 

{
    errors: [“record not found”]
}


3) response 406 status code and following json message:

 

{
    errors: [“This post sale order cannot do this operation”]
}

 

更新订单API

PUT /openapi/orders/{:id}

Parameter:

params key required example values describe
note N “My note” 订单备注
tags N “a, b” 订单标签,逗号分隔
buyer_accepts_marketing N true 是否订阅
shipping_address first_name N “Win”
last_name N “Li”
email N “123@xx.com” 邮箱
phone N “15423233434” 电话
country N “City” 国家
country_code N “44” 国家编号
province N “Guangdong” 省份
province_code N “686” 省份编号
area N “nanshan” 区域
city N “shenzhen” 城市
address1 N “XX街道” 收货地址
address2 N “XX号”
company N “店匠” 公司
latitude N “10.22” 经度
longitude N “10.22” 纬度
phone_area_code N “80” 手机区号
zip N “518000” 邮编

 

Example Response:

1)response 200 status code

{
  “order”:{
      “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
      “created_at”: “2014-04-25T16:15:47-04:00”,
      “updated_at”: “2014-04-25T16:15:47-04:00”,
      “note”: “abc”,
      “number”: “ASD01245”,
      “total_price”: “16.99”,
      “sub_total”: “15.00”,
      “currency”: “USD”,
      “financial_status”: “waiting”,
      “status”: “opened”,
      “canceled_at”: null,
      “cancel_reason”: null,
      “payment_method”: “online”,
      “fulfillment_status”: “waiting”,
      “customer_deleted_at”: “2014-04-25T16:15:47-04:00”,
      “deleted_at”: “2014-04-25T16:15:47-04:00”,
      “placed_at”: “2014-04-25T16:15:47-04:00”,
      “tags”: “a, b”,
      “discount_code”: “”,
      “buyer_accepts_marketing”: false,
      “code_discount_total”: “1.00”,
      “line_item_discount_total”: “1.00”,
      “customer_note”: “note”,
      “total_discount”: “100.00”,
      “total_tax”: “10.00”,
      “line_items”: [
          {
              “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “product_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “product_title”: “abc”,
              “variant_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “variant_title”: “XXX”,
              “quantity”: 10,
              “note”: “red”,
              “image”: “http://www.a.com/xxx.jpg”,
              “price”: 12.34,
              “compare_at_price”: 12.34,
              “total”: “12.34 USD”,
              “fulfillment_status”: “waiting”,
              “sku”: “xxx”,
              “weight”: 1.23,
              “weight_unit”: “g”,
              “vendor”: “XXX”,              “product_handle”: “abc”,

              “product_url”: “http://www.a.com/abc”,
              “properties”: [
                  {
                      “name”: “color”,
                      “value”: “red”
                  }
              ]
          }
      ],
      “shipping_line”: {
          “name”: “free”
      },
      “billing_address”: {
          “first_name”: “Bob”,
          “last_name”: “Norman”,
          “address1”: “Chestnut Street 92”,
          “address2”: “”,
          “city”: “Louisville”,
          “zip”: “40202”,
          “province”: “Kentucky”,
          “country”: “United States”,
          “company”:””,
          “latitude”: 45.41634,
          “longitude”: -75.6868,
          “name”: “Bob Norman”,
          “country_code”: “US”,
          “province_code”: “KY”,

          “email”: “test@gmail.com”, 

          “area”: “sz”
      },
      “shipping_address”: {
          “first_name”: “Bob”,
          “last_name”: “Norman”,
          “address1”: “Chestnut Street 92”,
          “address2”: “”,
          “phone”: “555-625-1199”,
          “city”: “Louisville”,
          “zip”: “40202”,
          “province”: “Kentucky”,
          “country”: “United States”,
          “company”: null,
          “latitude”: 45.41634,
          “longitude”: -75.6868,
          “name”: “Bob Norman”,
          “country_code”: “US”,
          “province_code”: “KY”,

          “phone_area_code”: “80”,
          “area”: “sz”,

          “email”: “test@gmail.com”
      },
      “fulfillments”: [
          {
              “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “order_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “status”: “waiting”,
              “created_at”: “2018-11-02T12:30:10-04:00”,
              “updated_at”: “2018-11-02T12:30:10-04:00”,
              “tracking_company”: null,
              “tracking_number”: “1Z2345”,

              “tracking_company_code”: “3306”,
              “line_items”: [
                  {
                      “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                      “product_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                      “product_title”: “abc”,
                      “variant_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                      “variant_title”: “XXX”,
                      “quantity”: 10,
                      “note”: “red”,
                      “image”: “http://www.a.com/xxx.jpg”,
                      “price”: 12.34,
                      “compare_at_price”: 12.34,
                      “total”: “12.34 USD”,
                      “fulfillment_status”: “waiting”,
                      “sku”: “xxx”,
                      “weight”: 1.23,
                      “weight_unit”: “g”,
                      “vendor”: “XXX”,

                      “product_handle”: “abc”,

                      “product_url”: “http://www.a.com/abc”,
                      “properties”: [
                          {
                              “name”: “color”,
                              “value”: “red”
                          },
                          {
                              “name”: “color”,
                              “value”: “red”
                          }
                      ]
                  }
              ]
          }
      ],
      “customer”:{
          “email”: “bob.norman@hostmail.com”,
          “created_at”: “2018-11-02T12:30:10-04:00”,
          “updated_at”: “2018-11-02T12:30:10-04:00”,
          “first_name”: “Bob”,
          “last_name”: “Norman”,
          “orders_count”: 1,
          “total_spent”: “41.94”,
          “phone”: “”,
      }
  }
}

2)response 422 status code and following json message:

{
    errors : [“Note is too long (maximum is 200 characters)”]
}

 

运单API

获取运单列表API

GET /openapi/orders/{order_id}/fulfillments

Parameter:

 

params key type required example values describe
created_at_min string N “2016-01-18T23:41:00-08:00” 起始创建时间
created_at_max string N “2016-01-18T23:41:00-08:00” 结束创建时间
updated_at_min string N “2014-04-25T16:15:47-04:00” 起始更新时间
updated_at_max string N “2014-04-25T16:15:47-04:00” 结束更新时间
limit Integer N 10 (default: 50, maximum: 250)
page Integer N 1 (default: 1)
 

 

Example Response:
1) response 200 status code and following json message:

 

{

  “fulfillments”: [

      {

          “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

          “order_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

          “status”: “waiting”,

          “created_at”: “2018-11-02T12:30:10-04:00”,

          “updated_at”: “2018-11-02T12:30:10-04:00”,

          “tracking_company”: “”,

          “tracking_number”: “1Z2345”,

          “tracking_company_code”: “3306”,

          “line_items”: [

              {

                  “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

                  “product_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

                  “product_title”: “abc”,

                  “variant_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

                  “variant_title”: “XXX”,

                  “quantity”: 10,

                  “note”: “red”,

                  “image”: “http://www.a.com/xxx.jpg”,

                  “price”: 12.34,

                  “compare_at_price”: 12.34,

                  “total”: “12.34 USD”,

                  “fulfillment_status”: “waiting”,

                  “sku”: “xxx”,

                  “weight”: 1.23,

                  “weight_unit”: “g”,

                  “vendor”: “XXX”,

                  “product_handle”: “abc”,

                  “product_url”: “http://www.a.com/abc”,

                  “properties”: [

                      {

                          “name”: “color”,

                          “value”: “red”

                      },

                      {

                          “name”: “color”,

                          “value”: “red”

                      }

                  ]

              }

          ]

      }

  ]

}

 

获取运单数量API

GET /openapi/orders/{order_id}/fulfillments/count

Parameter:

 

params key type required example values describe
created_at_min string N “2016-01-18T23:41:00-08:00 起始创建时间
created_at_max string N 2016-01-18T23:41:00-08:00″ 结束创建时间
updated_at_min string N “2014-04-25T16:15:47-04:00” 起始更新时间
updated_at_max string N “2014-04-25T16:15:47-04:00” 结束更新时间

 

Example Response:
1) response 200 status code and following json message:

 

{
  “count”: 1
}

 

获取运单详情API

GET /openapi/orders/{order_id}/fulfillments/{fulfillment_id}

 

Example Response:
1)response 200 status code and following json message:

 

{

  “fulfillment”: {

      “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

      “order_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

      “status”: “waiting”,

      “created_at”: “2018-11-02T12:30:10-04:00”,

      “updated_at”: “2018-11-02T12:30:10-04:00”,

      “tracking_company”: “”,

      “tracking_number”: “1Z2345”,

      “tracking_company_code”: “3306”,

      “line_items”: [

          {

              “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

              “product_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

              “product_title”: “abc”,

              “variant_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

              “variant_title”: “XXX”,

              “quantity”: 10,

              “note”: “red”,

              “image”: “http://www.a.com/xxx.jpg”,

              “price”: 12.34,

              “compare_at_price”: 12.34,

              “total”: “12.34 USD”,

              “fulfillment_status”: “waiting”,

              “sku”: “xxx”,

              “weight”: 1.23,

              “weight_unit”: “g”,

              “vendor”: “XXX”,

              “product_handle”: “abc”,

              “product_url”: “http://www.a.com/abc”,

              “properties”: [

                  {

                      “name”: “color”,

                      “value”: “red”

                  },

                  {

                      “name”: “color”,

                      “value”: “red”

                  }

              ]

          }

      ]

  }

}

 

创建运单API

POST /openapi/orders/#{order_id}/fulfillments

 

Parameter:

params key required type example values describe
line_item_ids Y array(string) [“id”,”id”] 运单包含的Line Item ID数组
tracking_number Y string “1231232113” 运单号
tracking_company N string “DHL” 物流公司名称
tracking_company_code N string 物流公司代码

 

Example Response:

1)response 200 status code and following json message:

 

{

  “fulfillment”: {

      “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

      “order_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

      “status”: “waiting”,

      “created_at”: “2018-11-02T12:30:10-04:00”,

      “updated_at”: “2018-11-02T12:30:10-04:00”,

      “tracking_company”: “”,

      “tracking_number”: “1Z2345”,

      “tracking_company_code”: “3306”,

      “line_items”: [

          {

              “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

              “product_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

              “product_title”: “abc”,

              “variant_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

              “variant_title”: “XXX”,

              “quantity”: 10,

              “note”: “red”,

              “image”: “http://www.a.com/xxx.jpg”,

              “price”: 12.34,

              “compare_at_price”: 12.34,

              “total”: “12.34 USD”,

              “fulfillment_status”: “waiting”,

              “sku”: “xxx”,

              “weight”: 1.23,

              “weight_unit”: “g”,

              “vendor”: “XXX”,

              “product_handle”: “abc”,

              “product_url”: “http://www.a.com/abc”,

              “properties”: [

                  {

                      “name”: “color”,

                      “value”: “red”

                  },

                  {

                      “name”: “color”,

                      “value”: “red”

                  }

              ]

          }

      ]

  }

}

 

更新运单API

PUT /openapi/orders/{order_id}/fulfillments/{fulfillment_id}

 

Parameter:

params key required example values describe
tracking_number N “1231232113” 运单号
tracking_company N “DHL” 物流公司名称
tracking_company_code N 物流公司代码

 

Example Response:

1)response 200 status code and following json message:

 

{

  “fulfillment”: {

      “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

      “order_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

      “status”: “waiting”,

      “created_at”: “2018-11-02T12:30:10-04:00”,

      “updated_at”: “2018-11-02T12:30:10-04:00”,

      “tracking_company”: “”,

      “tracking_number”: “1Z2345”,

      “tracking_company_code”: “3306”,

      “line_items”: [

          {

              “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

              “product_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

              “product_title”: “abc”,

              “variant_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

              “variant_title”: “XXX”,

              “quantity”: 10,

              “note”: “red”,

              “image”: “http://www.a.com/xxx.jpg”,

              “price”: 12.34,

              “compare_at_price”: 12.34,

              “total”: “12.34 USD”,

              “fulfillment_status”: “waiting”,

              “sku”: “xxx”,

              “weight”: 1.23,

              “weight_unit”: “g”,

              “vendor”: “XXX”,

              “product_handle”: “abc”,

              “product_url”: “http://www.a.com/abc”,

              “properties”: [

                  {

                      “name”: “color”,

                      “value”: “red”

                  },

                  {

                      “name”: “color”,

                      “value”: “red”

                  }

              ]

          }

      ]

  }

}

 

运单完成API

POST /openapi/orders/{order_id}/fulfillments/{fulfillment_id}/complete

 

Example Response:

 

1)response 200 status code and following json message:

{

  “fulfillment”: {

      “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

      “order_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

      “status”: “waiting”,

      “created_at”: “2018-11-02T12:30:10-04:00”,

      “updated_at”: “2018-11-02T12:30:10-04:00”,

      “tracking_company”: “”,

      “tracking_number”: “1Z2345”,

     “tracking_company_code”: “3306”,

      “line_items”: [

          {

              “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

              “product_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

              “product_title”: “abc”,

              “variant_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

              “variant_title”: “XXX”,

              “quantity”: 10,

              “note”: “red”,

              “image”: “http://www.a.com/xxx.jpg”,

              “price”: 12.34,

              “compare_at_price”: 12.34,

              “total”: “12.34 USD”,

              “fulfillment_status”: “waiting”,

              “sku”: “xxx”,

              “weight”: 1.23,

              “weight_unit”: “g”,

              “vendor”: “XXX”,

             “product_handle”: “abc”,

             “product_url”: “http://www.a.com/abc”,

              “properties”: [

                  {

                      “name”: “color”,

                      “value”: “red”

                  },

                  {

                      “name”: “color”,

                      “value”: “red”

                  }

              ]

          }

      ]

  }

}

 

2) response 404 status code and following json message: 

{
  errors: [“record not found”]
}

 

3)response 422 status code and following json message:

{
  errors: [“failed to change fulfillment status”]
}

 

取消运单API

POST /openapi/orders/{order_id}/fulfillments/{fulfillment_id}/cancel

1)response 200 status code and following json message:

{

  “fulfillment”: {

      “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

      “order_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

      “status”: “waiting”,

      “created_at”: “2018-11-02T12:30:10-04:00”,

      “updated_at”: “2018-11-02T12:30:10-04:00”,

      “tracking_company”: “”,

      “tracking_number”: “1Z2345”,

      “tracking_company_code”: “3306”,

      “line_items”: [

          {

              “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

              “product_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

              “product_title”: “abc”,

              “variant_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,

              “variant_title”: “XXX”,

              “quantity”: 10,

              “note”: “red”,

              “image”: “http://www.a.com/xxx.jpg”,

              “price”: 12.34,

              “compare_at_price”: 12.34,

              “total”: “12.34 USD”,

              “fulfillment_status”: “waiting”,

              “sku”: “xxx”,

              “weight”: 1.23,

              “weight_unit”: “g”,

              “vendor”: “XXX”,

              “product_handle”: “abc”,

              “product_url”: “http://www.a.com/abc”,

              “properties”: [

                  {

                      “name”: “color”,

                      “value”: “red”

                  },

                  {

                      “name”: “color”,

                      “value”: “red”

                  }

              ]

          }

      ]

  }

}

 

2) response 404 status code and following json message: 

{
  errors: [“record not found”]
}

 

3)response 422 status code and following json message:

{
  errors: [“failed to change fulfillment status”]
}

 

商品API

商品属性

商品 Product

字段名称 字段类型 字段解释
title String 商品标题
brief String 商品副标题
handle String 商品Slug
description String 商品描述
vendor String 供应商名称
vendor_url String 供应商网址
has_only_default_variant Boolean 是否为单款式商品
requires_shipping Boolean 是否需要物流
taxable Boolean 是否需要收税
inventory_tracking Boolean 是否需要库存追踪
inventory_policy String 库存追踪方案:库存为零时[deny(停售), continue(能继续卖), auto_unpublished(商品自动下架)]
inventory_quantity Integer 商品库存
published Boolean 是否上架
published_at String 上架时间
created_at String 创建时间
updated_at String 最后更新时间
note String 商品备注
meta_title String SEO标题
meta_description String SEO描述
meta_keyword String SEO关键字
need_variant_image Boolean 子商品是否需要配图

 

子商品 Variant

字段名称 字段类型 字段解释
title String 子商品标题
price String 子商品售价
compare_at_price String 子商品原价
weight String 子商品重量
weight_unit String 子商品重量单位
inventory_quantity Integer 子商品库存
sku String 子商品SKU
barcode String 子商品条形码编号
note String 款式备注
option1 String 款式一
option2 String 款式二
option3 String 款式三
position Integer 子商品排序位置
created_at String 创建时间
updated_at String 最后更新时间

 

Metafield

字段名称 字段类型 字段解释
namespace String
key String 名称
value String
value_type String 值的类型,有效值: string, integer, json_string
description String 描述

 

商品列表API

GET /openapi/products

 

Parameter:

params key required example values describe
ids N “123456, 43123” 商品IDS
keyword N
collection_id N “123432” 专辑ID
created_at_min N “2018-10-01T16:15:47-04:00” 创建时间-开始
created_at_max N “2018-10-01T16:15:47-04:00” 创建时间-结束
updated_at_min N “2018-10-01T16:15:47-04:00” 更新时间-开始
updated_at_max N “2018-10-01T16:15:47-04:00” 更新时间-结束
published_at_min N “2018-10-01T16:15:47-04:00” 上架时间-开始
published_at_max N “2018-10-01T16:15:47-04:00” 上架时间-结束
published_status N “any” published(已上架)、unpublished(已下架)、any(所有)
page N 1 页数
limit N 50 分页大小
fields N “title, id” 过滤查询返回结果

 

Example Response:

1) response 200 status code  and following json message: 

 

{
  “products”: [
      {
          “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
          “title”:”title1″,
          “brief”: “title2”,
          “description”: “商品描述”,
          “vendor”: “供应商”,           “vendor_url”: “http://www.baidu.com”,
          “has_only_default_variant”:true,
          “requires_shipping”: true,
          “taxable”: true,
          “inventory_tracking”: true,
          “inventory_policy”: “库存追踪方案”,
          “inventory_quantity”: 100,
          “published”: true,
          “published_at”: “2019-10-01 10:00:00 xxxx”,
          “created_at”: “2019-10-01 10:00:00 xxxx”,
          “updated_at”: “2019-10-01 10:00:00 xxxx”,

           “note”: “xxx”,
          “meta_title”: “xxx”,
          “meta_description”: “xxx”,
          “meta_keyword”: “tag1,tag2,tag3”,
          “handle”: “title1”,

           “need_variant_image”: true,
          “image”: {“src”:”https://oss.ali.com/abc.jpg”, “width”:100, “height”:100, “alt”:””},
          “images”: [
              {
                  “id”: “0510dace-34da-4555-a896-495e0cb1ed6e”,
                  “product_id”: “123456”,
                  “position”: 1,
                  “src”: “https://cdn.shoplazza.com/example.png”,
                  “width”: 480,
                  “height”: 360,
                  “alt”: “Image”,
                  “created_at”: “2018-10-31T13:02:19-04:00”,
                  “updated_at”: “2018-10-31T13:02:19-04:00”,
              }
          ],
          “options”:[
              {
                  “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
                  “product_id”: “123456”, 

                   “name”:”color”,
                  “position”:1,
                  “values”: [“red”, “black”]
              },
              {
                “id”:”0510dace-34da-4555-a896-495e0cb1kkd8″,
                “product_id”: “123456”,
                “name”:”size”,
                “position”:2,
                “values”:[“32”, “33”]
              }
          ],
          “variants”:[
              {
                  “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
                  “product_id”: “123456”,
                  “position”:1,
                  “title”:”variants title”,
                  “image”:{“src”:”https://oss.ali.com/abc.jpg”, “width”:100, “height”:100, “alt”:””},
                  “price”: 32,
                  “compare_at_price”: 45,
                  “weight”: 0.1,
                  “weight_unit”:”kg”,
                  “inventory_quantity”: 33,
                  “sku”: “20182002154567873574”,
                  “barcode”: “201213112”,

                   “note”: “xxx”,
                  “option1”: “red”,
                  “option2”: “M”,
                  “option3”: “”,
                  “created_at”: “2018-10-31T13:02:19-04:00”,
                  “updated_at”: “2018-10-31T13:02:19-04:00”,
              }
          ]
      }
  ]
}

 

 

商品总数量API

GET /openapi/products/count

 

Parameter:

params key required example values describe
ids N “123456, 43123” 商品IDS
title N
collection_id N “123432” 专辑ID
created_at_min N “2018-10-01T16:15:47-04:00” 创建时间-开始
created_at_max N “2018-10-01T16:15:47-04:00” 创建时间-结束
updated_at_min N “2018-10-01T16:15:47-04:00” 更新时间-开始
updated_at_max N “2018-10-01T16:15:47-04:00” 更新时间-结束
published_at_min N “2018-10-01T16:15:47-04:00” 上架时间-开始
published_at_max N “2018-10-01T16:15:47-04:00” 上架时间-结束
published_status N “any” published(已上架)、unpublished(已下架)、any(所有)

Example Response:

1) response 200 status code  and following json message: 

 

{
  “count”: 1
}

 

商品详情API

GET /openapi/products/{product_id} 

Example Response:

1) response 200 status code  and following json message: 

 

{
  “product”:{
      “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
      “title”:”title1″,
      “brief”: “title2”,
      “description”: “商品描述”,
      “vendor”: “供应商”,       “vendor_url”: “http://www.baidu.com”,
      “has_only_default_variant”:true,
      “requires_shipping”: true,
      “taxable”: true,
      “inventory_tracking”: true,
      “inventory_policy”: “库存追踪方案”,
      “inventory_quantity”: 100,
      “published”: true,
      “published_at”: “2019-10-01 10:00:00 xxxx”,
      “created_at”: “2019-10-01 10:00:00 xxxx”,
      “updated_at”: “2019-10-01 10:00:00 xxxx”,

       “note”: “xxx”,
      “meta_title”: “xxx”,
      “meta_description”: “xxx”,
      “meta_keyword”: “tag1,tag2,tag3”,
      “handle”: “title1”,

       “need_variant_image”: true,
      “image”: {“src”:”https://oss.ali.com/abc.jpg”, “width”:100, “height”:100, “alt”:””},
      “images”: [
          {
              “id”: “0510dace-34da-4555-a896-495e0cb1ed6e”,
              “product_id”: “123456”,
              “position”: 1,
              “src”: “https://cdn.shoplazza.com/example.png”,
              “width”: 480,
              “height”: 360,
              “alt”: “Image”,
              “created_at”: “2018-10-31T13:02:19-04:00”,
              “updated_at”: “2018-10-31T13:02:19-04:00”,
          }
      ],
      “options”:[
          {
              “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
              “product_id”: “123456”,
              “name”:”color”,
              “position”:1,
              “values”: [“red”, “black”]
          },
          {
              “id”:”0510dace-34da-4555-a896-495e0cb1kkd8″,
              “product_id”: “123456”,
              “name”:”size”,
              “position”:2,
              “values”:[“32”, “33”]
          }
      ],
      “variants”:[
          {
              “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
              “product_id”: “123456”,
              “position”:1
              “title”:”variants title”
              “image”:{“src”:”https://oss.ali.com/abc.jpg”, “width”:100, “height”:100, “alt”:””},
              “price”: 32,
              “compare_at_price”: 45,
              “weight”: 0.1,
              “weight_unit”:”kg”,
              “inventory_quantity”: 33,
              “sku”: “20182002154567873574”,
              “barcode”: “201213112”,

               “note”: “xxx”,
              “option1”: “red”,
              “option2”: “M”,
              “option3”: “”,
              “created_at”: “2018-10-31T13:02:19-04:00”,
              “updated_at”: “2018-10-31T13:02:19-04:00”
          }
      ]
  }
}

 

创建商品API

POST /openapi/products

Parameter:

params key required type example values describe
product Y hash
title Y string “name” 商品名称
brief N string 子标题
description N string “xxx” 描述
published N boolean true, default false 是否上架商品
requires_shipping N boolean true,  default true 是否需要物流
taxable N boolean true, default true 是否收税
tags N string “tag1,tag2” 标签
vendor N string 供应商名称
vendor_url N string 供应商url
note N string “xxx” 商品备注
meta_title N string “xxx” seo标题
handle N string x_x_z” 商品slug
meta_description N string “xxx” seo描述
meta_keyword N string “tag1,tag2” seo关键字
has_only_default_variant Y boolean true 是否为单一子款式
inventory_tracking N boolean false, default false 是否跟踪库存
inventory_policy N string “continue”/”deny”/”auto_unpublished”,

if inventory_tracking is true, inventory_policy must exist

库存追踪方案
need_variant_image N boolean true, if has_only_default_variant is false, need_variant_image must exist 子商品是否需要配图
options (单一子款式不传) N array[hash] if has_only_default_variant is false, options must exist 商品属性
name Y string “color” 属性名
values Y array [“red”, “black”] 属性值
images Y Array[hash] at least has one image 商品图片
src Y hsah “https://cdn.shoplazza.com/c8.jpeg” 图片信息
variants Y array[hash] 最少存在一个 商品子款式
option1 N string “red”
option2 N string “32”
option3 N string
image N hash {“src”:”//cn.cdn.shoplazza.com/c8bf5695d347092d7a010f00182581f7.jpeg”} 图片信息
compare_at_price Y decimals 34.33 原价
price Y decimals 23.44 售价
sku N string “20133322” sku
barcode N string “2012000” 条形码
note N string “xxx” 款式备注
inventory_quantity N integer 21 库存
weight N decimals 23.4 重量
weigh_unit N string “kg” 重量单位
metafields N array[hash] 商品metafield
namespace Y string “inventory”
value Y string “25”
value_type Y string “integer” 值类型
key Y string “warehouse” 名称
description N string “” 描述

Example Response:

1) response 200 status code  and following json message: 

 

{
  “product”:{
      “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
      “title”:”title1″,
      “brief”: “title2”,
      “description”: “商品描述”,
      “vendor”: “供应商”,       “vendor_url”: “http://www.baidu.com”,
      “has_only_default_variant”:true,
      “requires_shipping”: true,
      “taxable”: true,
      “inventory_tracking”: true,
      “inventory_policy”: “库存追踪方案”,
      “inventory_quantity”: 100,
      “published”: true,
      “published_at”: “2019-10-01 10:00:00 xxxx”,
      “created_at”: “2019-10-01 10:00:00 xxxx”,
      “updated_at”: “2019-10-01 10:00:00 xxxx”,

       “note”: “xxx”,
      “meta_title”: “xxx”,
      “meta_description”: “xxx”,
      “meta_keyword”: “tag1,tag2,tag3”,
      “handle”: “title1”,

       “need_variant_image”: true,
      “image”: {“src”:”https://oss.ali.com/abc.jpg”, “width”:100, “height”:100, “alt”:””},
      “images”: [
          {
              “id”: “0510dace-34da-4555-a896-495e0cb1ed6e”,
              “product_id”: “123456”,
              “position”: 1,
              “src”: “https://cdn.shoplazza.com/example.png”,
              “width”: 480,
              “height”: 360,
              “alt”: “Image”,
              “created_at”: “2018-10-31T13:02:19-04:00”,
              “updated_at”: “2018-10-31T13:02:19-04:00”,
          }
      ],
      “options”:[
          {
              “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
              “product_id”: “123456”,
              “name”:”color”,
              “position”:1,
              “values”: [“red”, “black”]
          },
          {
              “id”:”0510dace-34da-4555-a896-495e0cb1kkd8″,
              “product_id”: “123456”,
              “name”:”size”,
              “position”:2,
              “values”:[“32”, “33”]
          }
      ],
      “variants”:[
          {
              “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
              “product_id”: “123456”,
              “position”:1
              “title”:”variants title”
              “image”:{“src”:”https://oss.ali.com/abc.jpg”, “width”:100, “height”:100, “alt”:””},
              “price”: 32,
              “compare_at_price”: 45,
              “weight”: 0.1,
              “weight_unit”:”kg”,
              “inventory_quantity”: 33,
              “sku”: “20182002154567873574”,
              “barcode”: “201213112”,

               “note”: “xxx”,
              “option1”: “red”,
              “option2”: “M”,
              “option3”: “”,
              “created_at”: “2018-10-31T13:02:19-04:00”,
              “updated_at”: “2018-10-31T13:02:19-04:00”
          }
      ]
  }
}

 

更新商品API

PUT /openapi/products/{product_id}

Parameter:

params key required type example values describe
product Y hash
title N string “name” 专辑名称
brief N string 子标题
description N string “xxx” 描述
published N boolean true, default false 是否上架商品
requires_shipping N boolean true, default true 是否需要物流
taxable N boolean true, default false 是否收税
tags N string “tag1,tag2” 标签
vendor N string 供应商名称
vendor_url N string 供应商url
note N string “xxx” 商品备注
meta_title N string “xxx” seo标题
handle N string x_x_z” 商品slug
need_variant_image N boolean false, default true 多款式子款式是否需要配图
meta_description N string “xxx” seo描述
meta_keyword N string “tag1,tag2” seo关键字
inventory_tracking N boolean true, default false 是否跟踪库存
inventory_policy N string “continue”/”deny”/”auto_unpublished”,

if inventory_tracking is true, inventory_policy must exist

库存追踪方案
images N array[hash] at least has one image 商品图片
id N
src N hsah “//cdn.shoplazza.com/c87.jpeg” 图片信息
variants N array[hash] at least has one image 商品子款式
id N string
option1 N string “red”
option2 N string “32”
option3 N string
image N hash {“src”:”//cn.cdn.shoplazza.com/c8bf5695d347092d7a010f00182581f7.jpeg”} 图片信息
compare_at_price N decimals 34.33 原价
price N decimals 23.44 售价
sku N string “20133322” sku
barcode N string “2012000” 条形码
note N string “xxxx” 款式备注
inventory_quantity N integer 21 库存
weight N decimals 23.4 重量
weigh_unit N string “kg” 重量单位
metafields N array[hash] 商品metafield
id N string metafield ID
namespace Y string “inventory”
value Y string “25”
value_type Y string “integer” 值类型
key Y string “warehouse” 名称
description N string “” 描述

注:商品更新API 只会新增或者更新 metafield,不会删除已存在的metafield

Example Response:

1) response 200 status code  and following json message: 

{
  “product”:{
      “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
      “title”:”title1″,
      “brief”: “title2”,
      “description”: “商品描述”,
      “vendor”: “供应商”,       “vendor_url”: “http://www.baidu.com”,
      “has_only_default_variant”:true,
      “requires_shipping”: true,
      “taxable”: true,
      “inventory_tracking”: true,
      “inventory_policy”: “库存追踪方案”,
      “inventory_quantity”: 100,
      “published”: true,
      “published_at”: “2019-10-01 10:00:00 xxxx”,
      “created_at”: “2019-10-01 10:00:00 xxxx”,
      “updated_at”: “2019-10-01 10:00:00 xxxx”,

       “note”: “xxxx”,
      “meta_title”: “xxx”,
      “meta_description”: “xxx”,
      “meta_keyword”: “tag1,tag2,tag3”,
      “handle”: “title1”,

       ”need_variant_image”: true,
      “image”: {“src”:”https://oss.ali.com/abc.jpg”, “width”:100, “height”:100, “alt”:””},
      “images”: [
          {
              “id”: “0510dace-34da-4555-a896-495e0cb1ed6e”,
              “product_id”: “123456”,
              “position”: 1,
              “src”: “https://cdn.shoplazza.com/example.png”,
              “width”: 480,
              “height”: 360,
              “alt”: “Image”,
              “created_at”: “2018-10-31T13:02:19-04:00”,
              “updated_at”: “2018-10-31T13:02:19-04:00”,
          }
      ],
      “options”:[
          {
              “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
              “product_id”: “123456”,
              “name”:”color”,
              “position”:1,
              “values”: [“red”, “black”]
          },
          {
              “id”:”0510dace-34da-4555-a896-495e0cb1kkd8″,
              “product_id”: “123456”,
              “name”:”size”,
              “position”:2,
              “values”:[“32”, “33”]
          }
      ],
      “variants”:[
          {
              “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
              “product_id”: “123456”,
              “position”:1
              “title”:”variants title”
              “image”:{“src”:”https://oss.ali.com/abc.jpg”, “width”:100, “height”:100, “alt”:””},
              “price”: 32,
              “compare_at_price”: 45,
              “weight”: 0.1,
              “weight_unit”:”kg”,
              “inventory_quantity”: 33,
              “sku”: “20182002154567873574”,
              “barcode”: “201213112”,

               “note”: “xxxx”,
              “option1”: “red”,
              “option2”: “M”,
              “option3”: “”,
              “created_at”: “2018-10-31T13:02:19-04:00”,
              “updated_at”: “2018-10-31T13:02:19-04:00”
          }
      ]
  }
}

 

删除商品API

DELETE /openapi/products/{product_id}

Example Response:

1) response 200 status code

子商品API

子商品列表API

GET /openapi/products/{product_id}/variants

Example Response:

1) response 200 status code  and following json message: 

{
    “variants”: [
        {
            “id”: “123123”,
            “product_id”: “123456”,
            “title”: “Green”,
            “price”: “199.00”,
            “sku”: “IPOD2008GREEN”,
            “position”: 3,
            “inventory_policy”: “continue”,
            “compare_at_price”: null,
            “option1”: “Green”,
            “option2”: null,
            “option3”: null,
            “created_at”: “2018-10-31T13:02:19-04:00”,
            “updated_at”: “2018-10-31T13:02:19-04:00”,
            “barcode”: “1234_green”,            “note”: “xxxx”,
            “weight”: 1.25,
            “weight_unit”: “lb”,
            “image”: {
                “src”: “http://cdn.shoplazza.com/example.jpg”,
                “width”: “”,
                “height”: “”,
                “alt”: “”,
            }
        }
    ]
}

 

子商品总数量API

GET /openapi/products/{product_id}/variants/count

Example Response:

1) response 200 status code  and following json message: 

{
    “count”: 1
}

 

子商品详情API

GET /openapi/variants/{variant_id}

Example Response:

1) response 200 status code  and following json message: 

 

{
    “variant”: {
        “id”: “123123”,
        “product_id”: “123456”,
        “title”: “Green”,
        “price”: “199.00”,
        “sku”: “IPOD2008GREEN”,
        “position”: 3,
        “compare_at_price”: null,
        “option1”: “Green”,
        “option2”: null,
        “option3”: null,
        “created_at”: “2018-10-31T13:02:19-04:00”,
        “updated_at”: “2018-10-31T13:02:19-04:00”,
        “barcode”: “1234_green”,        “note”: “xxxx”,
        “weight”: 1.25,
        “weight_unit”: “lb”,
        “inventory_quantity”: 30,
        “image”: {
            “src”: “http://cdn.shoplazza.com/example.jpg”,
            “width”: “”,
            “height”: “”,
            “alt”: “”,
        }
    }
}

 

修改子商品API

PUT /openapi/variants/{variant_id}

Parameter:

params key required example values describe
variant option1 N “Red”
option2 N
option3 N
price N 100.0 售价
compare_at_price N 120.0 原价
position N 1 序号
barcode N “adsfasdf” 条形码
note N “xxx” 款式备注
sku N “123123123” sku
weight N 10 重量
weight_unit N “kg” 重量单位
inventory_quantity N 10 库存
image 图片
src N “http://cnd.shoplazza.com/1.jpg”

Example Response:

1) response 200 status code  and following json message: 

 

{
    “variant”: {
        “id”: “123123”,
        “product_id”: “123456”,
        “title”: “Green”,
        “price”: “199.00”,
        “sku”: “IPOD2008GREEN”,
        “position”: 3,
        “compare_at_price”: null,
        “option1”: “Green”,
        “option2”: null,
        “option3”: null,
        “created_at”: “2018-10-31T13:02:19-04:00”,
        “updated_at”: “2018-10-31T13:02:19-04:00”,
        “barcode”: “1234_green”,        “note”: “xxx”,
        “weight”: 1.25,
        “weight_unit”: “lb”,
        “inventory_quantity”: 30,
        “image”: {
            “src”: “http://cdn.shoplazza.com/example.jpg”,
            “width”: “”,
            “height”: “”,
            “alt”: “”,
        }
    }
}

 

删除子商品API

DELETE /openapi/products/{product_id}/variants/{variant_id}

Example Response:

1) response 200 status code 

 

商品图片API

商品图片列表API

GET /openapi/products/{product_id}/images

Example Response:

1) response 200 status code  and following json message: 

{
    “images”: [
        {
            “id”: “1324312”,
            “product_id”: “123456”,
            “position”: 1,
            “src”: “https://cdn.shoplazza.com/example.png”,
            “width”: 480,
            “height”: 360,
            “alt”: “Image”,
            “created_at”: “2018-10-31T13:02:19-04:00”,
            “updated_at”: “2018-10-31T13:02:19-04:00”,
        }
    ]
}

 

商品图片数量API

GET /openapi/products/{product_id}/images/count

Example Response:

1) response 200 status code  and following json message: 

 

{
    “count”: 1
}

 

商品图片详情API

GET /openapi/products/{product_id}/images/{image_id}

Example Response:

1) response 200 status code  and following json message: 

{
    “image”: {
        “id”: “1324312”,
        “product_id”: “123456”,
        “position”: 1,
        “src”: “https://cdn.shoplazza.com/example.png”,
        “width”: 480,
        “height”: 360,
        “alt”: “Image”,
        “created_at”: “2018-10-31T13:02:19-04:00”,
        “updated_at”: “2018-10-31T13:02:19-04:00”,
    }
}

 

创建商品图片API

POST /openapi/products/{product_id}/images

Parameter:

params key required example values describe
image position N 1 位置
src N “http://cdn.shoplazza.com/1.jpg” 图片路径
height N 300 高度
width N 300 宽度
alt N “Logo”

Example Response:

 

1) response 200 status code  and following json message: 

{
    “image”: {
        “id”: “1324312”,
        “product_id”: “123456”,
        “position”: 1,
        “src”: “https://cdn.shoplazza.com/example.png”,
        “width”: 480,
        “height”: 360,
        “alt”: “Image”,
        “created_at”: “2018-10-31T13:02:19-04:00”,
        “updated_at”: “2018-10-31T13:02:19-04:00”,
    }
}

 

编辑商品图片API

PUT /openapi/products/{product_id}/images/{image_id}

Parameter:

params key required example values describe
image position N 1 位置
src N http://cdn.shoplazza.com/1.jpg 图片路径

Example Response:

1) response 200 status code  and following json message: 

{
  “image”: {
          “id”: “1324312”,
          “product_id”: “123456”,
          “position”: 1,
          “src”: “https://cdn.shoplazza.com/example.png”,
          “width”: 480,
          “height”: 360,
          “alt”: “Image”,
          “created_at”: “2018-10-31T13:02:19-04:00”,
          “updated_at”: “2018-10-31T13:02:19-04:00”,
  }
}

 

删除商品图片API

DELETE /openapi/products/{product_id}/images/{image_id}

Example Response:

1) response 200 status code 

商品 Metafield API

商品 metafield 列表API

GET /openapi/products/{product_id}/metafields

Example Response:

1) response 200 status code  and following json message: 

{
    “metafields”: [
        {
            “id”: “0097cfc8-6ec3-40ed-ab9f-6f2231b705a6”,
            “product_id”: “ffbb507c-e64d-43f5-ae16-b126d2452e03”,
            “key”: “warehouse”,
            “value”:”25″,            “value_type”:”integer”,
            “namespace”:”inventory”,
            “description”: “”,
            “created_at”: “2018-10-31T13:02:19-04:00”,
            “updated_at”: “2018-10-31T13:02:19-04:00”
        }
    ]
}

 

商品 metafield 数量API

GET /openapi/products/{product_id}/metafields/count

Example Response:

1) response 200 status code  and following json message: 

 

{
    “count”: 1
}

 

商品 metafield 详情API

GET /openapi/products/{product_id}/metafields/{metafield_id}

Example Response:

1) response 200 status code  and following json message: 

{
    “metafield”: {
        “id”: “0097cfc8-6ec3-40ed-ab9f-6f2231b705a6”,
        “product_id”: “ffbb507c-e64d-43f5-ae16-b126d2452e03”,
        “key”: “warehouse”,        “value”:”25″,

        “value_type”:”integer”,
        “namespace”:”inventory”,
        “description”: “”,
        “created_at”: “2018-10-31T13:02:19-04:00”,
        “updated_at”: “2018-10-31T13:02:19-04:00”,
    }
}

 

创建商品 metafield API

POST /openapi/products/{product_id}/metafields

Parameter:

params key required example values describe
metafield namespace Y “inventory”
value Y “25”
value_type Y “integer” 值类型
key Y “warehouse” 名称
description N “” 描述

Example Response:

 

1) response 200 status code  and following json message: 

{
    “metafield”: {
        “id”: “0097cfc8-6ec3-40ed-ab9f-6f2231b705a6”,
        “product_id”: “ffbb507c-e64d-43f5-ae16-b126d2452e03”,
        “key”: “warehouse”,        “value”:”25″,

        “value_type”:”integer”,
        “namespace”:”inventory”,
        “description”: “”,
        “created_at”: “2018-10-31T13:02:19-04:00”,
        “updated_at”: “2018-10-31T13:02:19-04:00”,
    }
}

 

编辑商品metafield API

PUT /openapi/products/{product_id}/metafields/{metafield_id}

Parameter:

params key required example values describe
metafield namespace Y “inventory”
value Y “25”
value_type Y “integer” 值类型
key Y “warehouse” 名称
description N “” 描述

 

Example Response:

1) response 200 status code  and following json message: 

{
    “metafield”: {
        “id”: “0097cfc8-6ec3-40ed-ab9f-6f2231b705a6”,
        “product_id”: “ffbb507c-e64d-43f5-ae16-b126d2452e03”,
        “key”: “warehouse”,        “value”:”25″,

        “value_type”:”integer”,
        “namespace”:”inventory”,
        “description”: “”,
        “created_at”: “2018-10-31T13:02:19-04:00”,
        “updated_at”: “2018-10-31T13:02:19-04:00”,
    }
}

 

删除商品 metafield API

DELETE /openapi/products/{product_id}/metafields/{metafield_id}

Example Response:

1) response 200 status code 

专辑 API

专辑属性

专辑 Collection

字段名称 字段类型 字段解释
title String 标题
handle String 专辑Slug
description String 专辑描述
meta_title String SEO标题
meta_description String SEO描述
meta_keyword String SEO关键字

专辑列表API

GET /openapi/collections

Parameter:

params key require example values remark
ids N “0097cfc8-6ec3-40ed, 40ed-ab9f-6f2231b7” 专辑ID
updated_at_min N “2018-10-01T16:15:47-04:00” 更新时间-开始
updated_at_max N “2018-10-01T16:15:47-04:00” 更新时间-截止
product_id N “0097cfc8-6ec3-40ed-ab9f-6f2231b705a6” 商品id
page N 1 页数
limit N 50 分页大小

Example Response:

1) response 200 status code  and following json message: 

{
    “collections”: [
        {
            “id”: “0097cfc8-6ec3-40ed-ab9f-6f2231b705a6”,
            “title”: “Collection”,            “handle”: “Collection”,

            “description”: “”,

            “meta_title”: “xxx”,
            “meta_description”: “xxx”,
            “meta_keyword”: “tag1,tag2,tag3”,
            “image”: {
                    “src”: “https://cdn.shoplazza.com/example.png”,
                    “width”: 480,
                    “height”: 360,
                    “alt”: “Image”

             },

            “sort_order”: “alpha-asc”,
            “created_at”: “2018-10-31T13:02:19-04:00”,
            “updated_at”: “2018-10-31T13:02:19-04:00”
        }
    ]
}

 

专辑数量API

GET /openapi/collections/count

 

Parameter:

params key require example values remark
ids N “0097cfc8-6ec3-40ed, 40ed-ab9f-6f2231b7” 专辑ID
updated_at_min N “2018-10-01T16:15:47-04:00” 更新时间-开始
updated_at_max N “2018-10-01T16:15:47-04:00 更新时间-截止

Example Response:

1) response 200 status code  and following json message: 

 

{
    “count”: 1
}

 

专辑详情API

GET /openapi/collections/{id}

 

Example Response:

1) response 200 status code  and following json message: 

{

     “collection”: {
            “id”: “0097cfc8-6ec3-40ed-ab9f-6f2231b705a6”,
            “title”: “Collection”,

            “handle”: “Collection”,

            “description”: “”,

            “meta_title”: “xxx”,
            “meta_description”: “xxx”,
            “meta_keyword”: “tag1,tag2,tag3”,
            “image”: {
                    “src”: “https://cdn.shoplazza.com/example.png”,
                    “width”: 480,
                    “height”: 360,
                    “alt”: “Image”

             },

            “sort_order”: “alpha-asc”,
            “created_at”: “2018-10-31T13:02:19-04:00”,
            “updated_at”: “2018-10-31T13:02:19-04:00”
        }
}

 

创建专辑 API

POST /openapi/collections

 

Parameter:

params key required example values describe
collection title Y “collection” 标题
handle N “25” 专辑Slug
meta_title N “integer” SEO标题
meta_description N “warehouse” SEO描述
meta_keyword N “key1,key2” SEO关键字
description N “” 描述
image N { “src”: “https://cdn.shoplazza.com/example.png”, “width”: 480, “height”: 360, “alt”: “image” } 专辑图片
sort_order N “alpha-asc” 取值范围: “alpha-asc”/”alpha-desc”/”price-asc”/”price-desc”/”created-desc”/”manual”
product_ids N “0097cfc8-6ec3-40ed-ab9f-6f2231b705a6,0097cfc8-6ec3-40ed-ab9f-6f2231b705a6” 商品ids

 

Example Response:

1) response 200 status code  and following json message: 

{

     “collection”: {
            “id”: “0097cfc8-6ec3-40ed-ab9f-6f2231b705a6”,
            “title”: “Collection”,

            “handle”: “Collection”,

            “description”: “”,

            “meta_title”: “xxx”,
            “meta_description”: “xxx”,
            “meta_keyword”: “tag1,tag2,tag3”,
            “image”: {
                    “src”: “https://cdn.shoplazza.com/example.png”,
                    “width”: 480,
                    “height”: 360,
                    “alt”: “Image”

             },

            “sort_order”: “alpha-asc”,
            “created_at”: “2018-10-31T13:02:19-04:00”,
            “updated_at”: “2018-10-31T13:02:19-04:00”
        }
}

 

编辑专辑 API

PUT /openapi/collections/{id}

 

Parameter:

params key required example values describe
collection title N “collection” 标题
handle N “25” 专辑Slug
meta_title N “integer” SEO标题
meta_description N “warehouse” SEO描述
meta_keyword N SEO关键字
description N “” 描述
image N { “src”: “https://cdn.shoplazza.com/example.png”, “width”: 480, “height”: 360, “alt”: “image” } 专辑图片
sort_order N “alpha-asc” 取值范围: “alpha-asc”/”alpha-desc”/”price-asc”/”price-desc”/”created-desc”/”manual”
product_ids N “0097cfc8-6ec3-40ed-ab9f-6f2231b705a6,0097cfc8-6ec3-40ed-ab9f-6f2231b705a6” 商品ids

 

Example Response:

1) response 200 status code  and following json message: 

{

     “collection”: {
            “id”: “0097cfc8-6ec3-40ed-ab9f-6f2231b705a6”,
            “title”: “Collection”,

            “handle”: “Collection”,

            “description”: “”,

            “meta_title”: “xxx”,
            “meta_description”: “xxx”,
            “meta_keyword”: “tag1,tag2,tag3”,
            “image”: {
                    “src”: “https://cdn.shoplazza.com/example.png”,
                    “width”: 480,
                    “height”: 360,
                    “alt”: “Image”

             },

            “sort_order”: “alpha-asc”,
            “created_at”: “2018-10-31T13:02:19-04:00”,
            “updated_at”: “2018-10-31T13:02:19-04:00”
        }
}

 

删除专辑API

DELETE /openapi/collections/{id}

 

Example Response:

1) response 200 status code 

Collect API

collect 列表API

GET /openapi/collects

Parameter:

params key require example values remark
collection_id N “0097cfc8-6ec3-40ed” 专辑ID
product_id N “0097cfc8-6ec3-40ed” 商品ID
page N 1 页数
limit N 50 分页大小

 

Example Response:

1) response 200 status code  and following json message: 

{
    “collects”: [
        {
            “id”: “0097cfc8-6ec3-40ed-ab9f-6f2231b705a6”,
            “collection_id”: “0097cfc8-63c3-45ed-ab9f-6f2231b700k9”,            “product_id”: “8397cfc8-63c3-45ed-ab9f-6f2231b700k9”,

            “position”: 1,

            “created_at”: “2018-10-31T13:02:19-04:00”,
            “updated_at”: “2018-10-31T13:02:19-04:00”
        }
    ]
}

 

collect 数量API

GET /openapi/collects/count

 

Parameter:

params key require example values remark
collection_id N “0097cfc8-6ec3-40ed” 专辑ID
product_id N “0097cfc8-6ec3-40ed” 商品ID

 

Example Response:

1) response 200 status code  and following json message: 

{
    “count”: 1
}

 

collect 详情API

GET /openapi/collects/{id}

 

Example Response:

1) response 200 status code  and following json message: 

{

     “collect”: {
            “id”: “0097cfc8-6ec3-40ed-ab9f-6f2231b705a6”,
            “collection_id”: “0097cfc8-63c3-45ed-ab9f-6f2231b700k9”,

            “product_id”: “8397cfc8-63c3-45ed-ab9f-6f2231b700k9”,

            “position”: 1,

            “created_at”: “2018-10-31T13:02:19-04:00”,
            “updated_at”: “2018-10-31T13:02:19-04:00”
        }
}

 

创建 collect API

POST /openapi/collects

Parameter:

params key required example values describe
collect collection_id Y “0097cfc8-63c3-45ed-ab9f-6f2231b700k9” 专辑id
product_id Y “8397cfc8-63c3-45ed-ab9f-6f2231b700k9” 商品id

 

Example Response:

1) response 200 status code  and following json message: 

{

     “collect”: {
            “id”: “0097cfc8-6ec3-40ed-ab9f-6f2231b705a6”,
            “collection_id”: “0097cfc8-63c3-45ed-ab9f-6f2231b700k9”,

            “product_id”: “8397cfc8-63c3-45ed-ab9f-6f2231b700k9”,

            “position”: 1,

            “created_at”: “2018-10-31T13:02:19-04:00”,
            “updated_at”: “2018-10-31T13:02:19-04:00”
        }
}

 

删除 collect API

DELETE /openapi/collects/{id}

Example Response:

1) response 200 status code 

Webhook事件API

Webhook列表API

GET /openapi/webhooks

 

Parameters:

params key type required example values describe
address string N “https://example.com/webhook” Webhook通知URL
topic string N “orders/cancelled,orders/create” 订阅事件名称
created_at_min string N “2018-08-26T06:19:53Z” 查詢的Webhook的紀錄建立時間必須大于這個時間戳,格式為iso-8601
created_at_max string N “2018-08-26T06:19:53Z” 查詢的Webhook的紀錄建立時間必須小于這個時間戳,格式為iso-8601
updated_at_min string N “2018-08-26T06:19:53Z” 查询的Webhook的纪录最后更新时间必须大于这个时间戳,格式为iso-8601
updated_at_max string N “2018-08-26T06:19:53Z” 查询的Webhook的纪录最后更新时间必须小于这个时间戳,格式为iso-8601
limit integer N 50 指定每分页返回Webhook结果的数量,预设值为50,最大值为250
page integer N 1

Example Response:

1) response 200 status code  and following json message: 

{

  “webhooks”: [

      {

          “id”: “ea88df20-525b-457b-beed-d49e546be683”,

          “address”: “https://example.com/webhook”,

          “topic”: “orders/create”,

          “created_at”: “2018-08-26T06:30:55Z”,

          “updated_at”: “2018-08-26T06:30:55Z”,

          “format”: “json”

      },

      {

          “id”: “2c3772b4-8a92-4afd-bb7b-d89cd31844c2”,

          “address”: “https://example.com/webhook”,

          “topic”: “orders/delete”,

          “created_at”: “2018-08-26T06:30:55Z”,

          “updated_at”: “2018-08-26T06:30:55Z”,

          “format”: “json”

      }

  ]

}

2) response 422 status code  and following json message: 

{

  “errors”: {

      “limit”: [

          “must be less than or equal to 250”

      ],

      “page”: [

          “must be greater than or equal to 1”

      ]

  }

}

Webhook事件数量API

GET /openapi/webhooks/count

 

Parameters:

params key type required example values describe
address string N “https://example.com/webhook” Webhook通知URL
topic string N “orders/cancelled,orders/create” 订阅事件名称

Example Response:

1) response 200 status code  and following json message: 

 

{

     “count”: 5

}

Webhook详情API

GET /openapi/webhooks/{id}

Example Response:

1) response 200 status code  and following json message: 

{

  “webhook”: {

      “id”: “37593634-c272-4ed5-9096-1a4f1212125e”,

      “address”: “https://abc.com”,

      “topic”: “order/create”,

      “created_at”: “2018-08-26T06:50:00Z”,

      “updated_at”: “2018-08-26T06:50:00Z”,

      “format”: “json”

  }

}

2) response 404 status code  and following json message: 

{

    “errors”: [

         “record not found!”

    ]

}

创建WebhookAPI

POST  /openapi/webhooks

 

Parameters:

params key type required example values describe
address string Y “https://example.com/webhook” Webhook通知URL
topic string Y “orders/cancelled” 订阅事件名称

Example Response:

1) response 200 status code  and following json message: 

{

  “webhook”: {

      “id”: “37593634-c272-4ed5-9096-1a4f1212125e”,

      “address”: “https://abc.com”,

      “topic”: “order/create”,

      “created_at”: “2018-08-26T06:50:00Z”,

      “updated_at”: “2018-08-26T06:50:00Z”,

      “format”: “json”

  }

}

2) response 422 status code  and following json message: 

{

  “errors”: {

      “address”: [

          “can’t be blank”,

          “is invalid”

      ],

      “topic”: [

          “can’t be blank”

      ]

  }

}

编辑WebhookAPI

PUT   /openapi/webhooks/{id}

 

Parameters:

params key type required example values describe
address string N “https://example.com/webhook” Webhook通知URL
topic string N “orders/cancelled,orders/create” 订阅事件名称

Example Response:

1) response 200 status code  and following json message: 

{

  “webhook”: {

      “id”: “37593634-c272-4ed5-9096-1a4f1212125e”,

      “address”: “https://abc.com”,

      “topic”: “order/create”,

      “created_at”: “2018-08-26T06:50:00Z”,

      “updated_at”: “2018-08-26T06:50:00Z”,

      “format”: “json”

  }

}

2) response 422 status code  and following json message: 

{

  “errors”: {

      “address”: [

          “can’t be blank”,

          “is invalid”

      ],

      “topic”: [

          “can’t be blank”

      ]

  }

}

删除WebhookAPI

DELETE   /openapi/webhooks/{idi}

Example Response:

1) response 200 status code

2) response 404 status code  and following json message: 

{

    “errors”: [

         “record not found!”

    ]

}

Webhook事件通知

您可以使用webhook订阅来接收有关商店中特定事件的通知。 订阅webhook后,您可以让App在安装了应用程序的商店中发生特定事件后立即执行代码,而不必定期轮询API以检查其状态。 例如,当顾客创建订单时,或者当商家在店匠管理后台中创建新商品时,您可以依靠webhook来触发应用中的操作。通过使用webhooks订阅,您可以减少整体API的调用,从而确保您的应用程序更高效并快速。

您可以使用Header中的X-Shoplazza-Shop-Domain字段区分发出webhook时间的店铺,X-Shoplazza-Topic字段区分webhook事件类型

支持的webhook事件和主题

Event Topic
Order orders/cancelled, orders/create, orders/fulfilled, orders/paid, orders/partially_fulfilled, orders/update, orders/finished, orders/delete, orders/refunded
Product products/create, products/delete, products/update

 

订单事件通知返回

{
  “order”:{
      “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
      “created_at”: “2014-04-25T16:15:47-04:00”,
      “updated_at”: “2014-04-25T16:15:47-04:00”,
      “note”: “abc”,
      “number”: “ASD01245”,
      “total_price”: “16.99”,
      “sub_total”: “15.00”,
      “currency”: “USD”,
      “financial_status”: “waiting”,
      “status”: “opened”,
      “canceled_at”: null,
      “cancel_reason”: null,
      “payment_method”: “online”,
      “fulfillment_status”: “waiting”,
      “customer_deleted_at”: “2014-04-25T16:15:47-04:00”,
      “deleted_at”: “2014-04-25T16:15:47-04:00”,
      “placed_at”: “2014-04-25T16:15:47-04:00”,
      “tags”: “a, b”,
      “discount_code”: “”,
      “buyer_accepts_marketing”: false,
      “code_discount_total”: “1.00”,
      “line_item_discount_total”: “1.00”,
      “customer_note”: “note”,
      “total_discount”: “100.00”,
      “total_tax”: “10.00”,
      “line_items”: [
          {
              “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “product_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “product_title”: “abc”,
              “variant_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “variant_title”: “XXX”,
              “quantity”: 10,
              “note”: “red”,
              “image”: “http://www.a.com/xxx.jpg”,
              “price”: 12.34,
              “compare_at_price”: 12.34,
              “total”: “12.34 USD”,
              “fulfillment_status”: “waiting”,
              “sku”: “xxx”,
              “weight”: 1.23,
              “weight_unit”: “g”,
              “vendor”: “XXX”,              “product_handle”: “abc”,

              “product_url”: “http://www.a.com/abc”,
              “properties”: [
                  {
                      “name”: “color”,
                      “value”: “red”
                  }
              ]
          }
      ],
      “shipping_line”: {
          “name”: “free”
      },
      “billing_address”: {
          “first_name”: “Bob”,
          “last_name”: “Norman”,
          “address1”: “Chestnut Street 92”,
          “address2”: “”,
          “city”: “Louisville”,
          “zip”: “40202”,
          “province”: “Kentucky”,
          “country”: “United States”,
          “company”: null,
          “latitude”: 45.41634,
          “longitude”: -75.6868,
          “name”: “Bob Norman”,
          “country_code”: “US”,
          “province_code”: “KY”,

          “email”: “test@gmail.com”, 

          “area”: “sz”
      },
      “shipping_address”: {
          “first_name”: “Bob”,
          “last_name”: “Norman”,
          “address1”: “Chestnut Street 92”,
          “address2”: “”,
          “phone”: “555-625-1199”,
          “city”: “Louisville”,
          “zip”: “40202”,
          “province”: “Kentucky”,
          “country”: “United States”,
          “company”: null,
          “latitude”: 45.41634,
          “longitude”: -75.6868,
          “name”: “Bob Norman”,
          “country_code”: “US”,
          “province_code”: “KY”,

          “phone_area_code”: “80”,
          “area”: “sz”,

          “email”: “test@gmail.com”
      },
      “fulfillments”: [
          {
              “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “order_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
              “status”: “waiting”,
              “created_at”: “2018-11-02T12:30:10-04:00”,
              “updated_at”: “2018-11-02T12:30:10-04:00”,
              “tracking_company”: null,
              “tracking_number”: “1Z2345”,

              “tracking_company_code”: “3306”,
              “line_items”: [
                  {
                      “id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                      “product_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                      “product_title”: “abc”,
                      “variant_id”: “db4469f3-5e56-4c69-a2b6-03e81d24d5b5”,
                      “variant_title”: “XXX”,
                      “quantity”: 10,
                      “note”: “red”,
                      “image”: “http://www.a.com/xxx.jpg”,
                      “price”: 12.34,
                      “compare_at_price”: 12.34,
                      “total”: “12.34 USD”,
                      “fulfillment_status”: “waiting”,
                      “sku”: “xxx”,
                      “weight”: 1.23,
                      “weight_unit”: “g”,
                      “vendor”: “XXX”,

                      “product_handle”: “abc”,

                      “product_url”: “http://www.a.com/abc”,
                      “properties”: [
                          {
                              “name”: “color”,
                              “value”: “red”
                          },
                          {
                              “name”: “color”,
                              “value”: “red”
                          }
                      ]
                  }
              ]
          }
      ],
      “customer”:{
          “email”: “bob.norman@hostmail.com”,
          “created_at”: “2018-11-02T12:30:10-04:00”,
          “updated_at”: “2018-11-02T12:30:10-04:00”,
          “first_name”: “Bob”,
          “last_name”: “Norman”,
          “orders_count”: 1,
          “total_spent”: “41.94”,
          “phone”: “”,
      }
  }
}

 

商品事件通知返回

{
  “product”:{
      “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
      “title”:”title1″,
      “brief”: “title2”,
      “description”: “商品描述”,
      “vendor”: “供应商”,       “vendor_url”: “http://www.baidu.com”,
      “has_only_default_variant”:true,
      “requires_shipping”: true,
      “taxable”: true,
      “inventory_tracking”: true,
      “inventory_policy”: “库存追踪方案”,
      “inventory_quantity”: 100,
      “published”: true,
      “published_at”: “2019-10-01 10:00:00 xxxx”,
      “created_at”: “2019-10-01 10:00:00 xxxx”,
      “updated_at”: “2019-10-01 10:00:00 xxxx”,

       “note”: “xxx”,
      “meta_title”: “xxx”,
      “meta_description”: “xxx”,
      “meta_keyword”: “tag1,tag2,tag3”,
      “handle”: “title1”,
      “image”: {“src”:”https://oss.ali.com/abc.jpg”, “width”:100, “height”:100, “alt”:””},
      “images”: [
          {
              “id”: “0510dace-34da-4555-a896-495e0cb1ed6e”,
              “product_id”: “123456”,
              “position”: 1,
              “src”: “https://cdn.shoplazza.com/example.png”,
              “width”: 480,
              “height”: 360,
              “alt”: “Image”,
              “created_at”: “2018-10-31T13:02:19-04:00”,
              “updated_at”: “2018-10-31T13:02:19-04:00”,
          }
      ],
      “options”:[
          {
              “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
              “product_id”: “123456”,
              “name”:”color”,
              “position”:1,
              “values”: [“red”, “black”]
          },
          {
              “id”:”0510dace-34da-4555-a896-495e0cb1kkd8″,
              “product_id”: “123456”,
              “name”:”size”,
              “position”:2,
              “values”:[“32”, “33”]
          }
      ],
      “variants”:[
          {
              “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
              “product_id”: “123456”,
              “position”:1
              “title”:”variants title”
              “image”:{“src”:”https://oss.ali.com/abc.jpg”, “width”:100, “height”:100, “alt”:””},
              “price”: 32,
              “compare_at_price”: 45,
              “weight”: 0.1,
              “weight_unit”:”kg”,
              “inventory_quantity”: 33,
              “sku”: “20182002154567873574”,
              “barcode”: “201213112”,

               “note”: “xxx”,
              “option1”: “red”,
              “option2”: “M”,
              “option3”: “”,
              “created_at”: “2018-10-31T13:02:19-04:00”,
              “updated_at”: “2018-10-31T13:02:19-04:00”
          }
      ]
  }
}

 

Script Tag API

创建Script Tag API

POST /openapi/script_tags

Parameter:

params key required type example values describe
src Y string <script src=”https://shoplazza.com/x.js”></script> JS脚本
display_scope N string “all” 页面类型,默认all-全部

Example Response:

1) response 200 status code  and following json message: 

 

{
  “script_tag”:{
      “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,       “display_scope”:”all”,
      “src”: “<script src=\”https://assets.shoplazza.com/add_to_cart.07fb91d6064f1902127d.js\“></script>”,

       “event_type”: “myapp”,

       “created_at”: “2018-08-26T06:50:00Z”,

       “updated_at”: “2018-08-26T06:50:00Z”

   }

}

 

修改Script Tag Api

PUT /openapi/script_tags/{id}

Parameter:

params key required type example values describe
src Y string <script src=”https://shoplazza.com/x.js”></script> JS脚本
display_scope N string “all” 页面类型,默认all-全部
event_type N string myapp 插件标示,默认app

Example Response:

1) response 200 status code  and following json message: 

 

{
  “script_tag”:{
      “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
      “display_scope”:”all”,
      “src”: “<script src=\”https://assets.shoplazza.com/add_to_cart.07fb91d6064f1902127d.js\“></script>”,       “event_type”: “myapp”,
      “created_at”: “2018-08-26T06:50:00Z”,

       “updated_at”: “2018-08-26T06:50:00Z”

   }

}

删除Script Tag Api

DELETE /openapi/script_tags/{id}

Example Response:

1) response 200 status code

2) response 404 status code  and following json message: 

{

    “errors”: [

         “record not found!”

    ]

}

获取Script Tag Api

GET /openapi/script_tags/{id}

Example Response:

1) response 200 status code  and following json message: 

 

{
  “script_tag”:{
      “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
      “display_scope”:”all”,
      “src”: “<script src=\”https://assets.shoplazza.com/add_to_cart.07fb91d6064f1902127d.js\“></script>”,       “event_type”: “myapp”,
      “created_at”: “2018-08-26T06:50:00Z”,

       “updated_at”: “2018-08-26T06:50:00Z”

   }

}

获取Script Tag列表 Api

GET /openapi/script_tags/

Example Response:

1) response 200 status code  and following json message: 

 

{
  “script_tags”:[{
      “id”:”0510dace-34da-4555-a896-495e0cb1ed6e”,
      “display_scope”:”all”,
      “src”: “<script src=\”https://assets.shoplazza.com/add_to_cart.07fb91d6064f1902127d.js\“></script>”,       “event_type”: “myapp”,
      “created_at”: “2018-08-26T06:50:00Z”,

       “updated_at”: “2018-08-26T06:50:00Z”

   }]

}

获取Script Tag数量 Api

GET /openapi/script_tags/count

Example Response:

1) response 200 status code  and following json message: 

 

{
  “count”:5}

Comment API

创建Comment API

POST /openapi/comments

Parameter:

params key required type example values describe
product_id Y string “0510dace-34da-4555-a896-495e0cb1ed6e” 商品ID
username Y string 张三 用户名
content Y string  物廉价美 评论文本
star Y integer 1-5 星星数
image N string http://abc.com/img.jpg 评论图片url多个以;隔开
like N integer 点赞数
created_at Y string 2019-07-10 15:00:00 评论时间

Example Response:

1) response 200 status code  and following json message: 

 

{
  “comment”: {           “id”:256

   }

}

 

批量创建Comment API

POST /openapi/comments/batch

Parameter:

params key required type example values describe
comments[] product_id Y string “0510dace-34da-4555-a896-495e0cb1ed6e” 商品ID
username Y string 张三 用户名
content Y string  物廉价美 评论文本
star Y integer 1-5 星星数
image N string http://abc.com/img.jpg 评论图片url多个以;隔开
like N integer 点赞数
created_at Y string 2019-07-10 15:00:00 评论时间

 

Example Response:

1) response 200 status code  and following json message: 

{
  “success_count”: 12,

   “error_count”:3,

   “error_info”: [

{

           “product_id”:”…”,

“username”:”…”,

            …

“error_message”: “”

}

    ]

}

 

Shop API

Shop详情API

GET /openapi/shop

Parameter:

params key required type example values describe
fields N string id,name,email 返回字段筛选

Example Response:

1) response 200 status code  and following json message: 

 

{
  “shop”:{       “id”: 2019,

       “name”: “Nike Store”,

       “email”: “steve@nike.com”,

       “domain”: “shop.nike.com”,

       “address1”: “1 Infinite Loop”,

       “zip”: “95014”,

       “city”: “Cupertino”,

       “phone”: “1231231234”,

       “primary_locale”: “en_US”,

       “address2”: “Suite 100”,

       “created_at”: “2007-12-31T19:00:00-05:00”,

       “updated_at”: “2019-04-09T11:08:53-04:00”,

       “country_code”: “US”,

       “currency”: “USD”,

       “customer_email”: “customers@nike.com”,

       “timezone”: “(GMT-05:00) Eastern Time (US & Canada)”,

       “shop_owner”: “nick”,

       “account”: “account@nike.com”,

       “province_code”: “CA”,

       “icon”: {

           “src”: “https://cn.cdn.shoplazza.com/0d42d239eb4a6a6e07652b24219e62b9.jpg“,

           “path”: “0d42d239eb4a6a6e07652b24219e62b9.jpg”

       }

   }

}

2) response 404 status code  and following json message:

 

{

    “errors”: [

         “record not found!”

    ]

}

是否能帮到你?