HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

Update AddonProduct Quantity

Function

To update quantity of add-on products with open API
透過open API 更新加購品數量

URL

PUT <<api_domain>>/v1/addon_products/:id/update_quantity

Request parameters

ParameterColumn TypeDescriptionExample
idStringAddonProduct's ID
加購品ID
quantityNumberQuantity
(新增/減少)加購品數量
-
*if replace sets as false, allows quantity to be negative number
如果 replace 為 false,准許 quantity 為負數
ruby "quantity"=12
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":false

Request Example

curl -X PUT \
  <<api_domain>>/v1/addon_products/5892d8679f9a4fc07b008295/update_quantity \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearar access_token' \
  -F quantity=12

Response fields

The same as Get AddonProducts

Response Example

{
    "id": "5892d8679f9a4fc07b008295",
    "status": "draft",
    "title_translations": {
        "en": "Addon Products",
        "zh-hant": "加購品"
    },
    "price": null,
    "quantity": 10,
    "unlimited_quantity": false,
    "medias": [
        {
            "images": {
                "original": {
                    "width": 740,
                    "height": 416,
                    "url": "https://img.shoplineapp.com/media/image_clips/5892d84259d5241718001040/original.jpg?1486018626"
                },
                "landscape": {
                    "width": 740,
                    "height": 416,
                    "url": "https://img.shoplineapp.com/media/image_clips/5892d84259d5241718001040/original.jpg?1486018626"
                },
                "source": {
                    "width": 740,
                    "height": 416,
                    "url": "https://img.shoplineapp.com/media/image_clips/5892d84259d5241718001040/source.jpg?1486018626"
                },
                "thumb": {
                    "width": 200,
                    "height": 200,
                    "url": "https://img.shoplineapp.com/media/image_clips/5892d84259d5241718001040/thumb.jpg?1486018626"
                },
                "medium": {
                    "width": 250,
                    "height": 141,
                    "url": "https://img.shoplineapp.com/media/image_clips/5892d84259d5241718001040/medium.jpg?1486018626"
                },
                "large": {
                    "width": 500,
                    "height": 281,
                    "url": "https://img.shoplineapp.com/media/image_clips/5892d84259d5241718001040/large.jpg?1486018626"
                },
                "xlarge": {
                    "width": 740,
                    "height": 416,
                    "url": "https://img.shoplineapp.com/media/image_clips/5892d84259d5241718001040/xlarge.jpg?1486018626"
                },
                "favicon_small": {
                    "width": 200,
                    "height": 200,
                    "url": "https://img.shoplineapp.com/media/image_clips/5892d84259d5241718001040/thumb.jpg?1486018626"
                },
                "favicon": {
                    "width": 200,
                    "height": 200,
                    "url": "https://img.shoplineapp.com/media/image_clips/5892d84259d5241718001040/thumb.jpg?1486018626"
                },
                "favicon_large": {
                    "width": 200,
                    "height": 200,
                    "url": "https://img.shoplineapp.com/media/image_clips/5892d84259d5241718001040/thumb.jpg?1486018626"
                },
                "transparent_thumb": {
                    "width": 200,
                    "height": 200,
                    "url": "https://img.shoplineapp.com/media/image_clips/5892d84259d5241718001040/thumb.jpg?1486018626"
                },
                "transparent_medium": {
                    "width": 250,
                    "height": 141,
                    "url": "https://img.shoplineapp.com/media/image_clips/5892d84259d5241718001040/medium.jpg?1486018626"
                },
                "transparent_large": {
                    "width": 500,
                    "height": 281,
                    "url": "https://img.shoplineapp.com/media/image_clips/5892d84259d5241718001040/large.jpg?1486018626"
                },
                "transparent_xlarge": {
                    "width": 740,
                    "height": 416,
                    "url": "https://img.shoplineapp.com/media/image_clips/5892d84259d5241718001040/xlarge.jpg?1486018626"
                }
            },
            "_id": "5892d84259d5241718001040",
            "alt_translations": {}
        }
    ],
    "sku": "addon_product_sku"
}