Update Gifts Quantity by SKU

📘

Notice 提醒

Gifts unlimited_quantity should be false
贈品 無限數量 需要設定為 false

Funciton

To update gifts quantity by SKU
使用商品貨號更新贈品庫存數量

URL

PUT <<api_domain>>/v1/gifts/update_quantity

Request parameters

ParameterColumn TypeDescriptionExample
sku
*Required
StringGift's SKU
贈品的商品貨號
ruby "sku": "sku-123"
quantityIntegerQuantity
(新增/減少)贈品數量

- *if replace sets as false, allows quantity to be negative number
如果 replace 為 false,准許 quantity 為負數
ruby "quantity": 10 "quantity": -1
replaceBooleanWhether replacing the original quantity
是否取代原本數量

- _true: replace the quantity with the number you provided
取代原本數量_false: increase/decrease the quantity with the number you provided
增加/減少數量*Default: true
ruby "replace": true

Request Example

curl -X PUT \
  '<<api_domain>>/v1/gifts/update_quantity' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearar {{access_token}}' \
  -H 'User-Agent: shopline-test' \
  -H 'Content-Type: application/json' \
  -d '{
  "sku": "sku-123",
  "quantity": 10,
  "replace": true
}'
curl -X PUT \
  https://open.shoplineapp.com/v1/gifts/update_quantity \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearar {{access_token}}' \
  -H 'User-Agent: shopline-test' \
  -H 'Content-Type: application/json' \
  -d '{
  "sku": "sku-123",
  "quantity": -1,
  "replace": false
}'

Response fields

FieldColumn TypeDescriptionExample
idStringGift's ID
贈品ID
5bf68afde3880941d320ecae
skuStringGift's SKU
贈品貨號
sku-123
quantityNumberGift's Current Quantity
贈品目前庫存
123
updated_atDateTimeLast Updated Time
贈品上次更新時間
2019-01-25T06:56:19.561+00:00

Response Example

{
    "id": "5bf68afde3880941d320ecae",
    "sku": "sku-123",
    "quantity": 123,
    "updated_at": "2019-01-25T06:56:19.561+00:00"
}