需要 write_products 权限点。
更多权限点使用信息,请参考:
PUT https://{handle}.myshopline.com/admin/openapi/v20260301/products/:product_id.json
handle :店铺的唯一标识符,值为店铺域名的前缀。例如,域名为 open001.myshopline.com 的店铺,其 handleopen001
更新店铺中的商品。你可以使用该接口更新该商品状态、商品标题、及其它商品相关信息。如果所更新的商品不存在,则根据传入的商品信息直接新增商品。
路径参数
  • product_id string required
    商品的唯一标识 ID。
    最大长度限制:64
    例子: 16050375155238626683133099
请求头
  • Content-Type string required
    字段值固定为 application/json; charset=utf-8
  • Authorization string required
    资源的访问令牌。参考 应用授权 获取访问令牌,然后将获取到的访问令牌以 Bearer 格式传入。
    例子:
    Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw
请求体
  • productobject
    商品信息。
  • body_html string
    商品的描述。
    最大长度限制:512
    例子: This is a description
  • handle string
    商品的语义化的唯一标识,默认基于 title 生成。
    最大长度限制: 255
    例子: product-handle
  • imagesobject[]
    商品图片列表。
    最大个数限制:502
  • alt string
    商品图的替代文本描述,通常是具有图片特征或内容的单词或短语。
    最大长度限制:512
    例子: This is an image alt.
  • id string
    商品图的唯一标识 ID。
    最大长度限制:64
    例子: 5759070976424132652
  • src string
    商品图的链接,以 URL 形式展示。
    最大长度限制:255
    例子: https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png
  • optionsobject[]
    商品规格列表。
    最大个数限制:5
  • name string
    规格的名称。
    最大长度限制:255
    例子: Color
  • values_images map
    规格值与对应图片 URL 的映射关系。
    例子: {"red":"https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"}
  • path string
    商品的相对路径。
    最大长度限制:512
    例子: /products/clothes
  • product_category string
    商家自定义的商品类型。
    最大长度限制:255
    例子: Electronic
  • published_scope string
    商品的销售渠道发布范围。有效值固定为web,代表在线商城。
  • spu string
    商家为商品自定义的标识,区别于 SHOPLINE 生成的 product.id
    最大个数限制:255
    例子: S000001
  • status string
    商品的状态。有效枚举值包含:
    • active:上架
    • draft:下架
    • archived:归档
    默认值: draft
  • subtitle string
    商品的摘要。
    最大长度限制:400
    例子: This is a subtitle
  • tags array
    商品的标签。
    最大个数限制:250
    单字符串长度限制:255
    例子: ["tag1, tag2"]
  • template_path string
    商品的主题模板。
    例子: templates/product.product_template_name.json
  • title string
    商品的标题。
    最大长度限制:255
    例子: This is a Product title
  • variantsobject[]
    商品款式列表。
    最大个数限制:500
  • barcode string
    款式的条形码。
    最大长度限制:255
    例子: T0000001
  • compare_at_price string
    款式的原价,数值保留到小数点后两位。
    默认值: 0
    例子: 129.99
  • id string
    款式的唯一标识 ID。
    最大长度限制:64
    例子: 18050375907221969070393099
  • imageobject
    款式的图片。
  • alt string
    款式图的替代文本描述,通常是具有图片特征或内容的单词或短语。
    例子: This is an image alt.
  • id string
    款式图的唯一标识 ID。
    最大长度限制:64
    例子: 5759070976424132652
  • src string
    款式图的链接,以 URL 形式展示。
    最大长度限制:255
    例子: https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png
  • inventory_policy string
    表明款式是否允许超卖。
    • deny:不允许超卖。
    • continue:允许超卖。
    默认值: deny
  • inventory_tracker boolean
    表明是否开启库存追踪。
    • true:开启库存追踪。
    • false:不开启库存追踪。
    默认值:true
  • option1 string
    款式第一个规格的信息。
    最大长度限制:255
    例子: red
  • option2 string
    款式第二个规格的信息。
    最大长度限制:255
    例子: xl
  • option3 string
    款式第三个规格的信息。
    最大长度限制:255
    例子: cotton
  • option4 string
    款式第四个规格的信息。
    最大长度限制:255
    例子: short
  • option5 string
    款式第五个规格的信息。
    最大长度限制:255
    例子: casual
  • price string
    款式的售价,数值保留到小数点后两位。
    默认值:0
    例子: 90.22
  • required_shipping boolean
    表明款式是否需要运输。
    • true:需要运输。
    • false:不需要运输。
    默认值:true
  • sku string
    商家为款式自定义的标识,区别于 SHOPLINE 生成的 variants.id
    最大个数限制:255
    例子: S000000001
  • taxable boolean
    表明款式是否需要收税。
    • true:需要收税。
    • false:不需要收税。
    默认值: true
  • weight string
    款式的重量,要求大于 0,超过两位小数向上取整。
    例子: 0.23
  • weight_unit string
    款式的重量单位。有效枚举值包含:
    • g:克
    • kg:千克
    • lb:磅
    • oz:盎司
    • zh_kg:公斤
    默认值: g
  • vendor string
    商品的品牌或厂商。
    最大长度限制:255
    例子: SHOPLINE
状态码
更多状态码信息,参考 HTTP 状态码

响应头
  • traceId
    请求的全局唯一标识符。用于追踪请求在系统中的流转,以便于问题发生时进行定位和调试。
响应体
  • productobject
    商品信息。
  • body_html string
    商品的描述。
  • created_at string
    商品的创建时间。格式:ISO 8601
    例子: 2025-03-06T02:20:26+08:00
  • handle string
    商品的语义化的唯一标识,默认基于 title 生成。
    例子: product-handle
  • id string
    商品的唯一标识 ID。
    例子: 16050375155238626683133099
  • imageobject
    商品的封面图。
  • alt string
    图片的替代文本描述,通常是具有图片特征或内容的单词或短语。
    例子: This is an image alt.
  • id string
    图片的唯一标识 ID。
    例子: 5759070976424132652
  • src string
    图片的链接,以 URL 形式展示。
    例子: https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png
  • imagesobject[]
    商品图片列表。
  • alt string
    商品图的替代文本描述,通常是具有图片特征或内容的单词或短语。
    例子: This is an image alt.
  • id string
    商品图的唯一标识 ID。
    例子: 5759070976424132652
  • src string
    商品图的链接,以 URL 形式展示。
    例子: https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png
  • optionsobject[]
    商品规格列表。
  • id string
    规格的唯一标识 ID。
    例子: 16150375907221969070413099
  • name string
    规格的名称。
    例子: Color
  • option_valueobject[]
    商品规格值列表。
  • id string
    规格值的唯一标识 ID。
    例子: 16050375155238626683133099
  • value string
    规格值。
    例子: red
  • product_id string
    规格对应商品的唯一标识 ID。
    例子: 16050375155238626683133099
  • values array
    规格值列表。
    例子: ["[\"red\", \"green\", \"white\"]"]
  • values_images map
    规格值与对应图片 URL 的映射关系。
    例子: {"red":"https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"}
  • product_behavior string
    用于标识商品的特殊行为,只在特定情况下有值返回。例如,当商品有潜在风险时,返回一个值。
    例子: RISK, HIDDEN
  • product_category string
    商家自定义的商品类型。
    例子: Electronic
  • product_type string
    商品的来源。有效枚举值包含:
    • NORMAL : SHOPLINE 商家后台维护的商品
    • POD_TEMPORARY : POD 应用的临时商品
    • TEMPORARY : 其他临时商品
  • published_at string
    商品发布到在线商店的时间。格式:ISO 8601
    例子: 2025-03-06T02:20:26+08:00
  • published_scope string
    商品的销售渠道发布范围。有效值固定为web,代表在线商城。
  • spu string
    商家为商品自定义的标识,区别于 SHOPLINE 生成的 product.id
    例子: S000001
  • status string
    商品的状态。有效枚举值包含:
    • active: 上架
    • draft: 下架
    • archived: 归档
  • subtitle string
    商品的摘要。
    例子: This is a subtitle
  • tags string
    商品的标签。
    例子: tag1, tag2
  • template_path string
    商品的主题模板。
    例子: templates/product.product_template_name.json
  • title string
    商品的标题。
    例子: This is a Product title
  • updated_at string
    商品最近一次更新的时间。格式:ISO 8601
    例子: 2025-03-06T02:20:26+08:00
  • variantsobject[]
    商品款式列表。
  • barcode string
    款式的条形码。
    例子: T0000001
  • compare_at_price string
    款式的原价,数值保留到小数点后两位。
    例子: 129.99
  • created_at string
    款式的创建时间。格式:ISO 8601
    例子: 2025-03-06T02:20:26+08:00
  • id string
    款式的唯一标识 ID。
    例子: 18050375907221969070393099
  • imageobject
    款式的图片。
  • alt string
    款式图的替代文本描述,通常是具有图片特征或内容的单词或短语。
    例子: This is an image alt.
  • id string
    款式图的唯一标识 ID。
    例子: 5759070976424132652
  • src string
    款式图的链接,以 URL 形式展示。
    例子: https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png
  • inventory_item_id string
    库存单位的唯一标识 ID。
    例子: 5705499385037070868
  • inventory_policy string
    表明款式是否允许超卖。
    • deny:不允许超卖。
    • continue:允许超卖。
  • inventory_quantity integer
    各存放地点的库存数量总和。
    例子: 99
  • inventory_tracker boolean
    表明是否开启库存追踪。
    • true:开启库存追踪。
    • false:不开启库存追踪。
  • option1 string
    款式第一个规格的信息。
    例子: red
  • option2 string
    款式第二个规格的信息。
    例子: xl
  • option3 string
    款式第三个规格的信息。
    例子: cotton
  • option4 string
    款式第四个规格的信息。
    例子: short
  • option5 string
    款式第五个规格的信息。
    例子: casual
  • price string
    款式的售价,数值保留到小数点后两位。
    例子: 90.22
  • product_id string
    款式对应商品的唯一标识 ID。
    例子: 16050375155238626683133099
  • required_shipping boolean
    表明款式是否需要运输。
    • true:需要运输。
    • false:不需要运输。
  • sku string
    商家为款式自定义的标识,区别于 SHOPLINE 生成的 variants.id
    例子: T0000000001
  • taxable boolean
    表明款式是否需要收税。
    • true:需要收税。
    • false:不需要收税。
  • title string
    款式的标题,由款式的规格值拼装而成。
    例子: red · xl
  • updated_at string
    商品发布到在线商店的时间。格式:ISO 8601
    例子: 2025-03-06T02:20:26+08:00
  • weight string
    款式的重量,超过两位小数时向上取整。
    例子: 0.23
  • weight_unit string
    款式的重量单位。有效枚举值包含:
    • g:克
    • kg:千克
    • lb:磅
    • oz:盎司
    • zh_kg:公斤
  • vendor string
    商品的品牌或厂商。
    例子: SHOPLINE
API Explorer
https://openapiceshidianpu.myshopline.com/admin/openapi/v20260301

ParamOptions

path required
header required

Body

required
{
  "product": {
    "body_html": "This is a description",
    "handle": "product-handle",
    "images": [
      {
        "alt": "This is an image alt.",
        "id": "5759070976424132652",
        "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
      }
    ],
    "options": [
      {
        "name": "Color",
        "values_images": {
          "red": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
        }
      }
    ],
    "path": "/products/clothes",
    "product_category": "Electronic",
    "published_scope": null,
    "spu": "S000001",
    "status": null,
    "subtitle": "This is a subtitle",
    "tags": [
      "tag1, tag2"
    ],
    "template_path": "templates/product.product_template_name.json",
    "title": "This is a Product title",
    "variants": [
      {
        "barcode": "T0000001",
        "compare_at_price": "129.99",
        "id": "18050375907221969070393099",
        "image": {
          "alt": "This is an image alt.",
          "id": "5759070976424132652",
          "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
        },
        "inventory_policy": null,
        "inventory_tracker": null,
        "option1": "red",
        "option2": "xl",
        "option3": "cotton",
        "option4": "short",
        "option5": "casual",
        "price": "90.22",
        "required_shipping": null,
        "sku": "S000000001",
        "taxable": null,
        "weight": "0.23",
        "weight_unit": null
      }
    ],
    "vendor": "SHOPLINE"
  }
}

Language

curl --request PUT \
--url https://openapiceshidianpu.myshopline.com/admin/openapi/v20260301/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": {
"activated_at": "2024-08-23T16:04:42+08:00",
"body_html": "This is a description",
"created_at": "2024-08-22T16:03:42+08:00",
"handle": "shopline-2025-05-14",
"id": "16069938731613985273252340",
"image": {
"alt": "This is a image alt",
"id": "6993873159989240881",
"src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
},
"images": [
{
"alt": "This is a image alt",
"id": "6993873159989240881",
"src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
}
],
"options": [
{
"id": "16169938731621367248382340",
"name": "Color",
"product_id": "16069938731613985273252340",
"values": [
"Red"
],
"values_images": {
"Red": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
}
},
{
"id": "16169938731621367248412340",
"name": "Size",
"product_id": "16069938731613985273252340",
"values": [
"L"
],
"values_images": {
"L": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
}
}
],
"product_behavior": "",
"product_category": "Electronic",
"product_type": "NORMAL",
"published_at": "2024-08-23T16:04:42+08:00",
"published_scope": "web",
"spu": "S000001",
"status": "active",
"subtitle": "This is a subtitle",
"tags": [
"tag1",
"tag2"
],
"template_path": null,
"title": "A product title",
"updated_at": "2025-05-14T12:03:54+08:00",
"variants": [
{
"barcode": "B000000001",
"compare_at_price": "11.20",
"created_at": "2025-05-14T12:03:54+08:00",
"id": "18069938731621367248362340",
"image": {
"alt": "This is a image alt",
"id": "6993873159989240881",
"src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
},
"inventory_item_id": "6993873164569420530",
"inventory_policy": "deny",
"inventory_quantity": 0,
"inventory_tracker": true,
"option1": "Red",
"option2": "L",
"option3": null,
"option4": null,
"option5": null,
"price": "10.11",
"product_id": "16069938731613985273252340",
"required_shipping": true,
"sku": "T0000000001",
"taxable": true,
"title": "Red · L",
"updated_at": "2025-05-14T12:03:54+08:00",
"weight": "1.20",
"weight_unit": "kg"
}
],
"vendor": "Shopline"
}
}
Response
{
"product": {
"body_html": "This is a description",
"created_at": "2024-08-22T16:03:42+08:00",
"handle": "shopline-2025-05-14",
"id": "16069938731613985273252340",
"image": {
"alt": "This is a image alt",
"id": "6993873159989240881",
"src": "https://img-preview.myshopline.com/image/store/1672369729606/e46e6189dd5641a3b179444cacdcdd2a.png?w=1024&h=1024"
},
"images": [
{
"alt": "This is a image alt",
"id": "6993873159989240881",
"src": "https://img-preview.myshopline.com/image/store/1672369729606/e46e6189dd5641a3b179444cacdcdd2a.png?w=1024&h=1024"
}
],
"options": [
{
"id": "16169938731621367248382340",
"name": "Color",
"product_id": "16069938731613985273252340",
"values": [
"Red"
],
"values_images": {
"Red": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
}
},
{
"id": "16169938731621367248412340",
"name": "Size",
"product_id": "16069938731613985273252340",
"values": [
"L"
],
"values_images": {
"L": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
}
}
],
"product_behavior": "",
"product_category": "Electronic",
"product_type": "NORMAL",
"published_at": "2024-08-23T16:04:42+08:00",
"published_scope": "web",
"spu": "S000001",
"status": "active",
"subtitle": "This is a subtitle",
"tags": "tag1,tag2",
"template_path": null,
"title": "A product title",
"updated_at": "2025-05-14T12:06:32+08:00",
"variants": [
{
"barcode": "B000000001",
"compare_at_price": "11.20",
"created_at": "2025-05-14T12:03:54+08:00",
"id": "18069938731621367248362340",
"image": {
"alt": "This is a image alt",
"id": "6993875810822923314",
"src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
},
"inventory_item_id": "6993873164569420530",
"inventory_policy": "deny",
"inventory_quantity": 0,
"inventory_tracker": true,
"option1": "Red",
"option2": "L",
"option3": null,
"option4": null,
"option5": null,
"price": "10.11",
"product_id": "16069938731613985273252340",
"required_shipping": true,
"sku": "T0000000001",
"taxable": true,
"title": "Red · L",
"updated_at": "2025-05-14T12:06:32+08:00",
"weight": "1.20",
"weight_unit": "kg"
}
],
"vendor": "Shopline"
}
}
这篇文章对你有帮助吗?