需要 write_products 权限点。
更多权限点使用信息,请参考:
PUT https://{handle}.myshopline.com/admin/openapi/v20230301/products/:product_id.json
handle :店铺的唯一标识符,值为店铺域名的前缀。例如,域名为 open001.myshopline.com 的店铺,其 handleopen001
更新商品
路径参数
  • product_id string required
    商品ID,限制64个字符
    Example: 16050375155238626683133099
请求头
  • 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
    商品描述,限制512k
    Example: This is a description
  • handle string
    全局唯一的商品handle,默认商品标题,限制255个字符
    Example: product-handle
  • imagesobject[]
    商品主图,最多500张
  • alt string
    图片的alt信息,限制255个字符
    Example: This is a image alt
  • id string
    图片ID
    Example: 5759070976424132652
  • src string
    对应的图片链接,限制255个字符
    Example: https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png
  • optionsobject[]
    选项集合,最多5个
  • name string
    选项名称,限制255个字符
    Example: Color
  • values_images map
    选项值图
    Example: [object Object]
  • product_category string
    产品类别
    Example: Electronic
  • published_scope string
    设置发布范围,值为「web」时表示在线商店
    Example: web
  • spu string
    SPU码,限制255个字符
    Example: S0000001
  • status string
    商品状态:active - 上架,draft - 下架,archived - 归档
    Example: active
  • subtitle string
    商品摘要,限制400个字符
    Example: This is a subtitle
  • tags array
    商品标签,最多250个标签,每个标签长度限制最大255
    Example: tag1,tag2
  • title string
    商品标题,限制255个字符
    Example: This is a title
  • variantsobject[]
    商品款式,最多500个
  • barcode string
    条形码,限制255个字符
    Example: B0000001
  • compare_at_price string
    原价,默认为空
    Example: 11
  • id string
    款式ID
    Example: 18050375907221969070393099
  • imageobject
    款式图
  • alt string
    图片的alt信息,限制255个字符
    Example: This is a image alt
  • id string
    图片ID
    Example: 5759070976424132652
  • src string
    对应的图片链接,限制255个字符
    Example: https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png
  • inventory_policy string
    超卖策略:deny - 不允许超卖,continue - 允许超卖
    Example: deny
  • inventory_tracker boolean
    是否追踪库存,默认为不追踪
    Example: true
  • option1 string
    该款式对应的第一个选项的值,限制255个字符
    Example: Red
  • option2 string
    该款式对应的第二个选项的值,限制255个字符
    Example: L
  • option3 string
    该款式对应的第三个选项的值,限制255个字符
  • option4 string
    该款式对应的第四个选项的值,限制255个字符
  • option5 string
    该款式对应的第五个选项的值,限制255个字符
  • price string
    售价,默认为0
    Example: 10.11
  • required_shipping boolean
    是否需要发货
    Example: true
  • sku string
    SKU码,限制255个字符
    Example: 2111341123434
  • taxable boolean
    是否需要收税
    Example: true
  • weight string
    重量,要求大于0,超过两位小数向上取整
    Example: 1.2
  • weight_unit string
    重量单位:g, kg, lb, oz, zh_kg
    Example: kg
  • vendor string
    厂商名称,限制255个字符
    Example: Shopline
响应
更多状态码信息请参考 HTTP 状态码

响应头
  • traceId
    traceId
响应体
  • productobject
    商品对象
  • body_html string
    商品描述
    Example: This is a description
  • created_at string
    创建时间
    Example: 2021-09-02T14:11:54+00:00
  • handle string
    全局唯一的商品handle
    Example: product-handle
  • id string
    商品ID
    Example: 16050375155238626683133099
  • imageobject
    商品主图
  • alt string
    图片alt信息
    Example: This is a image alt
  • id string
    图片ID
    Example: 5759070976424132652
  • src string
    对应的图片链接
    Example: https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png
  • imagesobject[]
    商品图片列表
  • alt string
    图片alt信息
    Example: This is a image alt
  • id string
    图片ID
    Example: 5759070976424132652
  • src string
    对应的图片链接
    Example: https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png
  • optionsobject[]
    选项集合,最多5个
  • id string
    选项ID
    Example: 16150375907221969070413099
  • name string
    选项名称
    Example: Color
  • product_id string
    商品ID
    Example: 16050375155238626683133099
  • values array
    选项值列表
    Example: ["Red", "Green", "White"]
  • values_images map
    选项值图
    Example: [object Object]
  • product_behavior string
    商品行为
  • product_category string
    产品类别
    Example: Electronic
  • product_type string
    商品类型:NORMAL - 正常商品,POD_TEMPORARY - POD临时商品,TEMPORARY - 临时商品
    Example: NORMAL
  • published_at string
    发布到在线商店的时间
    Example: 2021-09-02T14:11:54+00:00
  • published_scope string
    发布范围,值为「web」时表示在线商店
    Example: web
  • spu string
    SPU
    Example: S0000000001
  • status string
    商品状态:active - 上架,draft - 下架,archived - 归档
    Example: active
  • subtitle string
    商品摘要
    Example: This is a subtitle
  • tags string
    商品标签
    Example: tag1,tag2
  • template_path string
    主题模板
  • title string
    商品标题
    Example: This is a title
  • updated_at string
    更新时间
    Example: 2021-09-02T14:11:54+00:00
  • variantsobject[]
    商品款式
  • barcode string
    条形码
    Example: B0000000001
  • 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: This is a image alt
  • id string
    图片ID
    Example: 5759070976424132652
  • src string
    对应的图片链接
    Example: https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png
  • inventory_item_id string
    库存对象ID
    Example: 5785060242375689228
  • inventory_policy string
    超卖策略:deny - 不允许超卖,continue - 允许超卖
    Example: deny
  • inventory_quantity integer
    所有地点的库存数量汇总
    Example: 99
  • inventory_tracker boolean
    是否追踪库存
    Example: true
  • option1 string
    该款式对应的第一个选项的值
    Example: Red
  • option2 string
    该款式对应的第二个选项的值
    Example: L
  • option3 string
    该款式对应的第三个选项的值
  • option4 string
    该款式对应的第四个选项的值
  • option5 string
    该款式对应的第五个选项的值
  • price string
    售价
    Example: 10.11
  • product_id string
    商品ID
    Example: 16050375155238626683133099
  • required_shipping boolean
    是否需要发货
    Example: true
  • sku string
    SKU码
    Example: 2111341123434
  • taxable boolean
    是否需要收税
    Example: true
  • title string
    款式标题
    Example: Red/L
  • updated_at string
    更新时间
    Example: 2021-09-02T14:11:54+00:00
  • weight string
    重量
    Example: 1.2
  • weight_unit string
    重量单位:g , kg , lb , oz , zh_kg
    Example: kg
  • vendor string
    商品厂商
    Example: Shopline
API Explorer
https://openapiceshidianpu.myshopline.com/admin/openapi/v20230301

ParamOptions

— path required
— header required

Body

required
{
  "product": {
    "body_html": "This is a description",
    "handle": "product-handle",
    "images": [
      {
        "alt": "This is a image alt",
        "id": "5759070976424132652",
        "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
      }
    ],
    "options": [
      {
        "name": "Color",
        "values_images": {}
      }
    ],
    "product_category": "Electronic",
    "published_scope": "web",
    "spu": "S0000001",
    "status": "active",
    "subtitle": "This is a subtitle",
    "tags": [
      "tag1,tag2"
    ],
    "title": "This is a title",
    "variants": [
      {
        "barcode": "B0000001",
        "compare_at_price": "11",
        "id": "18050375907221969070393099",
        "image": {
          "alt": "This is a image alt",
          "id": "5759070976424132652",
          "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
        },
        "inventory_policy": "deny",
        "inventory_tracker": true,
        "option1": "Red",
        "option2": "L",
        "option3": "",
        "option4": "",
        "option5": "",
        "price": "10.11",
        "required_shipping": true,
        "sku": "2111341123434",
        "taxable": true,
        "weight": "1.2",
        "weight_unit": "kg"
      }
    ],
    "vendor": "Shopline"
  }
}

Language

curl --request PUT \
--url https://openapiceshidianpu.myshopline.com/admin/openapi/v20230301/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": "<p>Thisisadesription</p>",
"created_at": "2023-08-28T12:46:37+08:00",
"handle": "my-product-24",
"id": "16060879464944338685503144",
"images": [
{
"alt": "Thisisaimagealt",
"id": "5976632123224980485",
"src": "https://img-va.myshopline.com/image/store/2001026666/1653474941510/c4845f8f7cd84ff18f082eaf9c05b820.webp?w=1024&h=1024"
}
],
"product_category": "Clothes",
"published_scope": "web",
"spu": "S000000001",
"status": "active",
"subtitle": "Thisisasubtitle",
"tags": [
"Spring",
"Tshirt"
],
"title": "MyProduct24",
"variants": [
{
"barcode": "T00000001",
"compare_at_price": "120.00",
"id": "18060879464948700761723144",
"image": {
"alt": "Thisisaimagealt",
"id": "5976632123224980485",
"src": "https://img-va.myshopline.com/image/store/2001026666/1653474941510/c4845f8f7cd84ff18f082eaf9c05b820.webp?w=1024&h=1024"
},
"inventory_policy": "deny",
"inventory_tracker": true,
"price": "100.00",
"product_id": "16060879464944338685503144",
"required_shipping": true,
"sku": "S00000000101",
"taxable": true,
"weight": "10.00",
"weight_unit": "g"
},
{
"barcode": "B0000000001",
"compare_at_price": "120.00",
"id": "18060879464948700761813144",
"image": {
"alt": "Thisisaimagealt",
"id": "5976632123224980485",
"src": "https://img-va.myshopline.com/image/store/2001026666/1653474941510/c4845f8f7cd84ff18f082eaf9c05b820.webp?w=1024&h=1024"
},
"inventory_policy": "deny",
"inventory_tracker": true,
"price": "100.00",
"required_shipping": true,
"sku": "S00000000102",
"taxable": true,
"weight": "50.00",
"weight_unit": "g"
},
{
"barcode": "B0000000001",
"compare_at_price": "120.00",
"id": "18060879464948700761873144",
"image": {
"alt": "Thisisaimagealt",
"id": "5976632123224980485",
"src": "https://img-va.myshopline.com/image/store/2001026666/1653474941510/c4845f8f7cd84ff18f082eaf9c05b820.webp?w=1024&h=1024"
},
"inventory_item_id": "6087946495557900203",
"inventory_policy": "deny",
"inventory_tracker": true,
"price": "100.00",
"required_shipping": true,
"sku": "S00000000103",
"taxable": true,
"weight": "50.00",
"weight_unit": "g"
}
],
"vendor": "Shopline"
}
}
Response
{
"product": {
"body_html": "<p>Thisisadesription</p>",
"created_at": "2023-08-28T12:46:37+08:00",
"handle": "my-product-24",
"id": "16060879464944338685503144",
"image": {
"alt": "Thisisaimagealt",
"id": "5976632123224980485",
"src": "https://img-va.myshopline.com/image/store/2001026666/1653474941510/c4845f8f7cd84ff18f082eaf9c05b820.webp?w=1024&h=1024"
},
"images": [
{
"alt": "Thisisaimagealt",
"id": "5976632123224980485",
"src": "https://img-va.myshopline.com/image/store/2001026666/1653474941510/c4845f8f7cd84ff18f082eaf9c05b820.webp?w=1024&h=1024"
}
],
"options": [
{
"id": "16160879464948700761743144",
"name": "Size",
"product_id": "16060879464944338685503144",
"values": [
"L",
"XL",
"XXL"
],
"values_images": {}
},
{
"id": "16160879464948700761773144",
"name": "Color",
"product_id": "16060879464944338685503144",
"values": [
"White"
],
"values_images": {}
}
],
"product_behavior": "",
"product_category": "Clothes",
"product_type": "NORMAL",
"published_at": "2023-08-28T12:46:37+08:00",
"published_scope": "web",
"spu": "S000000001",
"status": "active",
"subtitle": "Thisisasubtitle",
"tags": "Spring,Tshirt",
"template_path": "templates/products/detail.html",
"title": "MyProduct24",
"updated_at": "2024-03-29T17:03:46+08:00",
"variants": [
{
"barcode": "T00000001",
"compare_at_price": "120.00",
"created_at": "2023-08-28T12:46:37+08:00",
"id": "18060879464948700761723144",
"image": {
"alt": "Thisisaimagealt",
"id": "5976632123224980485",
"src": "https://img-va.myshopline.com/image/store/2001026666/1653474941510/c4845f8f7cd84ff18f082eaf9c05b820.webp?w=1024&h=1024"
},
"inventory_item_id": "6087946495557900202",
"inventory_policy": "deny",
"inventory_quantity": 580,
"inventory_tracker": true,
"option1": "L",
"option2": "White",
"price": "100.00",
"product_id": "16060879464944338685503144",
"required_shipping": true,
"sku": "S00000000101",
"taxable": true,
"title": "L · White",
"updated_at": "2024-03-29T17:03:46+08:00",
"weight": "10.00",
"weight_unit": "g"
},
{
"barcode": "B0000000001",
"compare_at_price": "120.00",
"created_at": "2023-08-28T12:46:37+08:00",
"id": "18060879464948700761813144",
"image": {
"alt": "Thisisaimagealt",
"id": "5976632123224980485",
"src": "https://img-va.myshopline.com/image/store/2001026666/1653474941510/c4845f8f7cd84ff18f082eaf9c05b820.webp?w=1024&h=1024"
},
"inventory_item_id": "6087946495557900201",
"inventory_policy": "deny",
"inventory_quantity": 100,
"inventory_tracker": true,
"option1": "XL",
"option2": "White",
"price": "100.00",
"product_id": "16060879464944338685503144",
"required_shipping": true,
"sku": "S00000000102",
"taxable": true,
"title": "XL · White",
"updated_at": "2024-03-29T17:03:46+08:00",
"weight": "50.00",
"weight_unit": "g"
},
{
"barcode": "B0000000001",
"compare_at_price": "120.00",
"created_at": "2023-08-28T12:46:37+08:00",
"id": "18060879464948700761873144",
"image": {
"alt": "Thisisaimagealt",
"id": "5976632123224980485",
"src": "https://img-va.myshopline.com/image/store/2001026666/1653474941510/c4845f8f7cd84ff18f082eaf9c05b820.webp?w=1024&h=1024"
},
"inventory_item_id": "6087946495557900203",
"inventory_policy": "deny",
"inventory_quantity": 120,
"inventory_tracker": true,
"option1": "XXL",
"option2": "White",
"price": "100.00",
"product_id": "16060879464944338685503144",
"required_shipping": true,
"sku": "S00000000103",
"taxable": true,
"title": "XXL · White",
"updated_at": "2024-03-29T17:03:46+08:00",
"weight": "50.00",
"weight_unit": "g"
}
],
"vendor": "Shopline"
}
}
这篇文章对你有帮助吗?

Error loading component.

Error loading component.