需要 write_products 权限点。
更多权限点使用信息,请参考:
PUT https://{handle}.myshopline.com/admin/openapi/v20220601/products/:product_id.json
handle :店铺的唯一标识符,值为店铺域名的前缀。例如,域名为 open001.myshopline.com 的店铺,其 handleopen001
增量更新商品接口
路径参数
  • product_id string required
    商品ID,限制64个字符
请求头
  • Content-Type required
    字段值固定为application/json; charset=utf-8
  • Authorization string required
    资源的访问令牌。请参考 应用授权 获取访问令牌,然后将获取到的访问令牌以 Bearer 格式传入
    Example:
    Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw
请求体
  • productobject
    商品信息
  • body_html string
    商品描述,限制128k
    Example: 这是商品描述
  • brand string
    品牌名称,限制64个字符
    Example: 优衣库
  • handle string
    全局唯一的商品handle,默认商品标题,限制255个字符
    Example: t-shirt
  • imagesobject[]
    商品主图,最多40张
  • alt string
    图片的alt信息,限制255个字符
    Example: 这是图片ALT
  • src string
    对应的图片src链接,限制255个字符
    Example: https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png
  • optionsobject[]
    属性集合,最多5个Option
  • name string
    属性名称,限制50个字符
    Example: 颜色
  • values_images map
    规格值图,例如:{ "red" : "src" }
    Example: [object Object]
  • published_scope string
    设置发布范围,值为「web」时表示在线商店
  • status string
    商品上下架状态:active,draft,archived
    Example: active
  • subtitle string
    商品摘要,限制255个字符
    Example: 这是副标题
  • tags array
    商品标签,最多60个标签,每个标签限制100个字符
    Example: 衣服,T恤
  • title string
    商品标题,限制255个字符
    Example: 联名T恤
  • variantsobject[]
    商品规格,最多500个
  • barcode string
    条形码,限制100个字符
    Example: 1111111123434
  • compare_at_price string
    原价,默认为空
    Example: 11
  • id string
    商品变种ID
    Example: 18050375907221969070393099
  • imageobject
    商品变种的属性图
  • alt string
    图片的alt信息,限制255个字符
    Example: 这是图片ALT
  • src string
    对应的图片src链接,限制255个字符
    Example: https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png
  • inventory_policy string
    超卖策略:不允许超卖(deny),允许超卖(continue)
    Example: deny
  • inventory_quantity integer
    库存数,最小值-999999,最大值999999
    Example: 11
  • inventory_tracker boolean
    追踪库存:true,不追踪库存:false,默认为不追踪
    Example: true
  • option1 string
    该SKU对应的option1的值,限制255个字符
    Example: 红色
  • option2 string
    该SKU对应的option2的值,限制255个字符
  • option3 string
    该SKU对应的option3的值,限制255个字符
  • option4 string
    该SKU对应的option4的值,限制255个字符
  • option5 string
    该SKU对应的option5的值,限制255个字符
  • price string
    售价,默认为0
    Example: 10.11
  • sku string
    SKU码,限制100个字符
    Example: 2111341123434
  • weight string
    重量,要求大于0,超过两位小数向上取整
    Example: 1.2
  • weight_unit string
    重量单位:g, kg, lb, oz
    Example: kg
响应
更多状态码信息请参考 HTTP 状态码

响应头
  • traceId
    traceId
响应体
  • productobject
    商品对象
  • body_html string
    商品描述
    Example: 这是商品描述
  • brand string
    商品品牌
    Example: 优衣库
  • created_at string
    创建时间
    Example: 2021-09-02T14:11:54+00:00
  • handle string
    全局唯一的商品handle
    Example: t-shirt
  • id string
    商品ID
    Example: 16050375155238626683133099
  • imageobject
    商品主图
  • alt string
    图片alt信息
    Example: 这是图片ALT
  • src string
    对应的图片src链接
    Example: https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png
  • imagesobject[]
    商品图片列表
  • alt string
    图片alt信息
    Example: 这是图片ALT
  • src string
    对应的图片src链接
    Example: https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png
  • optionsobject[]
    属性集合,最多5个Option
  • id string
    属性名ID
    Example: 16150375907221969070413099
  • name string
    属性名称
    Example: 颜色
  • product_id string
    商品ID
    Example: 16050375155238626683133099
  • values array
    属性值列表,不能超过50个
    Example: 红色
  • values_images map
    规格值图,例如:{ "red" : "src" }
    Example: [object Object]
  • product_behavior string
    商品行为
  • product_type string
    商品类型:NORMAL-正常商品,POD_TEMPORARY-POD临时商品,TEMPORARY-临时商品
  • published_at string
    发布时间
  • published_scope string
    发布范围,值为「web」时表示在线商店
  • status string
    商品上下架状态:active,draft,archived
    Example: active
  • subtitle string
    商品摘要
    Example: 这是副标题
  • tags string
    商品标签
    Example: 衣服,T恤
  • template_path string
    主题模板
  • title string
    商品标题
    Example: 联名T恤
  • updated_at string
    更新时间
    Example: 2021-09-02T14:11:54+00:00
  • variantsobject[]
    商品规格,最多500个
  • barcode string
    条形码
    Example: 1111111123434
  • compare_at_price string
    原价
    Example: 11
  • created_at string
    创建时间
    Example: 2021-09-02T14:11:54+00:00
  • id string
    商品变种ID
    Example: 18050375907221969070393099
  • imageobject
    商品变种的属性图
  • alt string
    图片alt信息
    Example: 这是图片ALT
  • src string
    对应的图片src链接
    Example: https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png
  • inventory_item_id string
    库存对象ID
  • inventory_policy string
    超卖策略:不允许超卖(deny),允许超卖(continue)
    Example: deny
  • inventory_quantity integer
    库存数,最小值-999999,最大值999999
    Example: 11
  • inventory_tracker boolean
    追踪库存:true,不追踪库存:false,默认为不追踪
    Example: true
  • option1 string
    该SKU对应的option1的值
    Example: 红色
  • option2 string
    该SKU对应的option2的值
  • option3 string
    该SKU对应的option3的值
  • option4 string
    该SKU对应的option4的值
  • option5 string
    该SKU对应的option5的值
  • price string
    售价
    Example: 10.11
  • product_id string
    商品ID
    Example: 16050375155238626683133099
  • sku string
    SKU码
    Example: 2111341123434
  • title string
    商品变种标题
    Example: 颜色·红色
  • updated_at string
    更新时间
    Example: 2021-09-02T14:11:54+00:00
  • weight string
    重量
    Example: 1.2
  • weight_unit string
    重量单位
    Example: kg
API Explorer
https://openapiceshidianpu.myshopline.com/admin/openapi/v20220601

ParamOptions

— path required
— header required

Body

required
{
  "product": {
    "body_html": "这是商品描述",
    "brand": "优衣库",
    "handle": "t-shirt",
    "images": [
      {
        "alt": "这是图片ALT",
        "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
      }
    ],
    "options": [
      {
        "name": "颜色",
        "values_images": {}
      }
    ],
    "published_scope": "",
    "status": "active",
    "subtitle": "这是副标题",
    "tags": [
      "衣服,T恤"
    ],
    "title": "联名T恤",
    "variants": [
      {
        "barcode": "1111111123434",
        "compare_at_price": "11",
        "id": "18050375907221969070393099",
        "image": {
          "alt": "这是图片ALT",
          "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
        },
        "inventory_policy": "deny",
        "inventory_quantity": 11,
        "inventory_tracker": true,
        "option1": "红色",
        "option2": "",
        "option3": "",
        "option4": "",
        "option5": "",
        "price": "10.11",
        "sku": "2111341123434",
        "weight": "1.2",
        "weight_unit": "kg"
      }
    ]
  }
}

Language

curl --request PUT \
--url https://openapiceshidianpu.myshopline.com/admin/openapi/v20220601/products/product_id.json \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw' \
--header 'Content-Type: application/json; charset=utf-8' \
--header 'accept: application/json'
Examples
更新商品
Request
{
"product": {
"body_html": "这是商品描述",
"brand": "鸿星尔克-1",
"created_at": "2023-01-31T13:22:37+08:00",
"handle": "to-be-no.1--779597504",
"id": "16057850264845250791280282",
"images": [
{
"alt": "这是主图",
"id": "5785060242207917075",
"src": "https://d2n979dmt31clo.cloudfront.net/image/store/3300003249/1609823068438/9d058cfacb8e42299460086d9764f7ac.jpeg?w=750&h=1000"
}
],
"options": [
{
"id": "16157850264851626133440282",
"name": "color",
"product_id": "16057850264845250791280282",
"values": [
"red",
"blue"
],
"values_images": {
"blue": "https://d2n979dmt31clo.cloudfront.net/image/store/3300003249/1609823068438/22691677cd1848e8816a9736f0187f6e.jpg?w=225&h=225",
"red": "https://d2n979dmt31clo.cloudfront.net/image/store/3300003249/1609823068438/22691677cd1848e8816a9736f0187f6e.jpg?w=225&h=225"
}
},
{
"id": "16157850264851626133470282",
"name": "size",
"product_id": "16057850264845250791280282",
"values": [
"big",
"small"
],
"values_images": {}
}
],
"product_behavior": "",
"product_type": "NORMAL",
"published_at": "2023-01-31T13:22:37+08:00",
"published_scope": "web",
"status": "active",
"subtitle": "这是副标题",
"title": "鞋子的商品",
"updated_at": "2023-01-31T13:56:11+08:00",
"variants": [
{
"barcode": "b-111112",
"created_at": "2023-01-31T13:22:37+08:00",
"id": "18057850264851626133420282",
"image": {
"alt": "这是主图",
"id": "5785060242207917075",
"src": "https://d2n979dmt31clo.cloudfront.net/image/store/3300003249/1609823068438/9d058cfacb8e42299460086d9764f7ac.jpeg?w=750&h=1000"
},
"inventory_item_id": "5785026488367064846",
"inventory_policy": "deny",
"inventory_quantity": 0,
"inventory_tracker": true,
"option1": "red",
"option2": "big",
"price": "99.80",
"product_id": "16057850264845250791280282",
"required_shipping": true,
"sku": "i-1111112",
"taxable": true,
"title": "red·big",
"updated_at": "2023-01-31T13:56:11+08:00",
"weight": "21.20",
"weight_unit": "g"
},
{
"barcode": "b-111113",
"compare_at_price": "100.11",
"created_at": "2023-01-31T13:22:37+08:00",
"id": "18057850264851626133510282",
"image": {
"id": "5785060242375689228",
"src": "https://d2n979dmt31clo.cloudfront.net/image/store/3300003249/1609823068438/22691677cd1848e8816a9736f0187f6e.jpg?w=225&h=225"
},
"inventory_item_id": "5785026488367064845",
"inventory_policy": "continue",
"inventory_quantity": 0,
"inventory_tracker": true,
"option1": "blue",
"option2": "big",
"price": "0.00",
"product_id": "16057850264845250791280282",
"required_shipping": true,
"sku": "i-1111113",
"taxable": true,
"title": "blue·big",
"updated_at": "2023-01-31T13:56:11+08:00",
"weight": "2.30",
"weight_unit": "kg"
},
{
"barcode": "b-111113",
"compare_at_price": "100.45",
"created_at": "2023-01-31T13:22:37+08:00",
"id": "18057850264851626133570282",
"inventory_item_id": "5785026488367064844",
"inventory_policy": "deny",
"inventory_quantity": 0,
"inventory_tracker": false,
"option1": "blue",
"option2": "small",
"price": "99.55",
"product_id": "16057850264845250791280282",
"required_shipping": true,
"sku": "i-1111113",
"taxable": true,
"title": "blue·small",
"updated_at": "2023-01-31T13:56:11+08:00",
"weight": "2.39",
"weight_unit": "oz"
}
]
}
}
Response
{
"product": {
"body_html": "这是商品描述",
"brand": "鸿星尔克-1",
"created_at": "2023-01-31T13:22:37+08:00",
"handle": "to-be-no.1--779597504",
"id": "16057850264845250791280282",
"image": {
"alt": "这是主图",
"src": "https://d2n979dmt31clo.cloudfront.net/image/store/3300003249/1609823068438/9d058cfacb8e42299460086d9764f7ac.jpeg?w=750&h=1000"
},
"images": [
{
"alt": "这是主图",
"src": "https://d2n979dmt31clo.cloudfront.net/image/store/3300003249/1609823068438/9d058cfacb8e42299460086d9764f7ac.jpeg?w=750&h=1000"
},
{
"src": "https://d2n979dmt31clo.cloudfront.net/image/store/3300003249/1609823068438/22691677cd1848e8816a9736f0187f6e.jpg?w=225&h=225"
}
],
"options": [
{
"id": "16157850264851626133440282",
"name": "color",
"product_id": "16057850264845250791280282",
"values": [
"red",
"blue"
],
"values_images": {
"blue": "https://d2n979dmt31clo.cloudfront.net/image/store/3300003249/1609823068438/22691677cd1848e8816a9736f0187f6e.jpg?w=225&h=225",
"red": "https://d2n979dmt31clo.cloudfront.net/image/store/3300003249/1609823068438/22691677cd1848e8816a9736f0187f6e.jpg?w=225&h=225"
}
},
{
"id": "16157850264851626133470282",
"name": "size",
"product_id": "16057850264845250791280282",
"values": [
"big",
"small"
],
"values_images": {}
}
],
"product_behavior": "",
"product_type": "NORMAL",
"published_at": "2023-01-31T13:22:37+08:00",
"published_scope": "web",
"status": "active",
"subtitle": "这是副标题",
"tags": "直播间",
"title": "鞋子的商品",
"updated_at": "2023-02-23T17:54:02+08:00",
"variants": [
{
"barcode": "b-111112",
"created_at": "2023-01-31T13:22:37+08:00",
"id": "18057850264851626133420282",
"image": {
"alt": "这是主图",
"src": "https://d2n979dmt31clo.cloudfront.net/image/store/3300003249/1609823068438/9d058cfacb8e42299460086d9764f7ac.jpeg?w=750&h=1000"
},
"inventory_item_id": "5785026488367064846",
"inventory_policy": "deny",
"inventory_quantity": 0,
"inventory_tracker": true,
"option1": "red",
"option2": "big",
"price": "99.80",
"product_id": "16057850264845250791280282",
"sku": "i-1111112",
"title": "red · big",
"updated_at": "2023-02-23T17:54:02+08:00",
"weight": "21.20",
"weight_unit": "g"
},
{
"barcode": "b-111113",
"compare_at_price": "100.11",
"created_at": "2023-01-31T13:22:37+08:00",
"id": "18057850264851626133510282",
"image": {
"src": "https://d2n979dmt31clo.cloudfront.net/image/store/3300003249/1609823068438/22691677cd1848e8816a9736f0187f6e.jpg?w=225&h=225"
},
"inventory_item_id": "5785026488367064845",
"inventory_policy": "continue",
"inventory_quantity": 0,
"inventory_tracker": true,
"option1": "blue",
"option2": "big",
"price": "0.00",
"product_id": "16057850264845250791280282",
"sku": "i-1111113",
"title": "blue · big",
"updated_at": "2023-02-23T17:54:02+08:00",
"weight": "2.30",
"weight_unit": "kg"
},
{
"barcode": "b-111113",
"compare_at_price": "100.45",
"created_at": "2023-01-31T13:22:37+08:00",
"id": "18057850264851626133570282",
"inventory_item_id": "5785026488367064844",
"inventory_policy": "deny",
"inventory_quantity": 0,
"inventory_tracker": false,
"option1": "blue",
"option2": "small",
"price": "99.55",
"product_id": "16057850264845250791280282",
"sku": "i-1111113",
"title": "blue · small",
"updated_at": "2023-02-23T17:54:02+08:00",
"weight": "2.39",
"weight_unit": "oz"
}
]
}
}
这篇文章对你有帮助吗?

Error loading component.

Error loading component.