Update Product, Product Variation Quantity by SKU
Notice æé
Product unlimited_quantity should be false
åå įĄéæ¸é éčĻč¨åŽįē false
Function
Update product or product variation quantity by SKU
äŊŋį¨åå貨čæ´æ°ååæååčĻæ ŧåēĢåæ¸é
URL
PUT <<api_domain>>/v1/products/update_quantity
Request parameters
Parameter | Column Type | Description | Example |
---|---|---|---|
sku | String | Product or Product Variation sku ååæååčĻæ ŧįåå貨č | ruby "sku": "sku-123" |
quantity | Integer | Quantity (æ°åĸ/æ¸å°)ååæ¸é - *if replace sets as false, allows quantity to be negative number åĻæ replace įē falseīŧå訹 quantity įēč˛ æ¸ | ruby "quantity": 10 |
replace | Boolean | Whether replacing the original quantity æ¯åĻåäģŖåæŦæ¸é - _true: replace the product's 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/products/update_quantity' \
-H 'Accept: application/json' \
-H 'Authorization: Bearar {{access_token}}' \
-H 'Content-Type: application/json' \
-d '{
"sku": "sku-123",
"quantity": 21,
"replace": true
}'
curl -X PUT \
https://open.shoplineapp.com/v1/products/update_quantity \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {{access_token}}' \
-H 'Content-Type: application/json' \
-H 'User-Agent: shopline' \
-d '{
"sku": "sku-123",
"quantity": -1,
"replace": false
}'
Response fields
Field | Column Type | Description | Example |
---|---|---|---|
id | String | Product's ID or Product variation's ID ååæååčĻæ ŧįID | 5a8165efe38809548f0000f8 |
sku | String | Product SKU ååæååčĻæ ŧįåå貨č | sku-123 |
quantity | Number | Product's Current Quantity ååæååčĻæ ŧįæ¸é | 21 |
updated_at | DateTime | Last Updated Time æåžæ´æ°æé | 2018-02-23T04:17:15.544+00:00 |
product_id | String | Product's ID ä¸ģååID (åĻææ´æ°įé įŽįēååčĻæ ŧææéĄ¯į¤ē) |
Response Example
{
"id": "5a8165efe38809548f0000f8",
"sku": "sku-123",
"quantity": 21,
"updated_at": "2018-02-23T04:17:15.544+00:00"
}
{
"id": "5a8165efe38809548f0000f8",
"sku": "sku-1234",
"quantity": 1,
"updated_at": "2018-12-25T04:52:25.279+00:00",
"product_id": "5bd7e5b5e388091b1c5a5f9b"
}
FAQ
- åĻææŗæ´æ°æ¸éį SKU å¨ EC Admin ä¸åå¨īŧææå°æ error åīŧ
æīŧčĢčĻä¸æšį¯äžã
{
"error": "Not found.",
"code": "NotFoundError",
"caused_by": null
}
-
åĻæ SKU å¨ EC Admin å°æå°å¤ååå/ååčĻæ ŧ
å ¨é¨éŊæčĸĢæ´æ°æ Open API æįæåŽåēĢåįĩæã
-
æåŽæ¸éæ´æ°åžīŧOpen API åčĻį quantity æ¯ææ´æ°åžįæ¸éåīŧ
å°ã
-
åĻææ¯įĄéåēĢåä¸å¯äģĨæ´æ°åēĢåīŧææå°æ error åīŧ
æīŧčĢčĻä¸æšį¯äžã
"errors": [
{
"id": "63a9161244525f0020c49337",
"message": {
"error": "Do not allow to update quantity of the product which contains one or multiple products or has unlimited quantity.",
"code": "QuantityUpdateNotAllowedError",
"caused_by": null
},
"status": 403
}
]
Updated 4 days ago