HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

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 \
  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": 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"
}