需要 write_inventory 权限点。
更多权限点使用信息,请参考:
PUT https://{handle}.myshopline.com/admin/openapi/v20250601/inventory_items/:inventory_item_id.json
handle :店铺的唯一标识符,值为店铺域名的前缀。例如,域名为 open001.myshopline.com 的店铺,其 handleopen001
更新单个库存对象
路径参数
  • inventory_item_id string required
    库存对象ID
请求头
  • Content-Type required
    字段值固定为application/json; charset=utf-8
  • Authorization string required
    资源的访问令牌。请参考 应用授权 获取访问令牌,然后将获取到的访问令牌以 Bearer 格式传入
    Example:
    Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw
请求体
  • inventory_itemobject required
    库存对象
  • cost string
    成本价
    Example: 10.9
  • required_shipping boolean
    是否需要发货
    Example: true
  • sku string
    SKU码,限制长度255
    Example: K00000001
  • tracked boolean
    是否追踪库存,true:追踪,false:不追踪
    Example: true
响应
更多状态码信息请参考 HTTP 状态码

响应头
  • traceId
    traceId
响应体
  • inventory_itemobject
    库存对象
  • cost string
    成本价
    Example: 10.9
  • created_at string
    创建时间
    Example: 2022-12-06T20:23:06+08:00
  • id string
    库存对象ID
    Example: 5703943989105270965
  • required_shipping boolean
    是否需要发货
    Example: true
  • sku string
    SKU码
    Example: K00000001
  • tracked boolean
    是否追踪库存,true:追踪,false:不追踪
    Example: true
  • updated_at string
    更新时间
    Example: 2022-12-06T20:23:06+08:00
  • variant_id string
    商品款式ID
    Example: 18057039432358082693350282
API Explorer
https://openapiceshidianpu.myshopline.com/admin/openapi/v20250601

ParamOptions

path required
header required

Body

required
{
  "inventory_item": {
    "cost": "10.9",
    "required_shipping": true,
    "sku": "K00000001",
    "tracked": true
  }
}

Language

curl --request PUT \
--url https://openapiceshidianpu.myshopline.com/admin/openapi/v20250601/inventory_items/inventory_item_id.json \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw' \
--header 'Content-Type: application/json; charset=utf-8' \
--header 'accept: application/json' \
--data '
{
"inventory_item": {
"cost": "10.9",
"required_shipping": true,
"sku": "K00000001",
"tracked": true
}
}
'
Examples
更新SKU码
Request
{
"inventory_item": {
"sku": "T100002"
}
}
Response
{
"inventory_item": {
"cost": "120.00",
"created_at": "2022-12-06T14:53:39+08:00",
"id": "5703943240925324252",
"required_shipping": true,
"sku": "T100002",
"tracked": false,
"updated_at": "2022-12-06T21:04:16+08:00",
"variant_id": "18057039432358082693350282"
}
}
这篇文章对你有帮助吗?