商品庫存查詢與更新 #
庫存多筆查詢 #
查詢 多筆商品庫存
。
Endpoint URL: https://tw.scm.yahooapis.com/scmapi/api/GdStock/GetMultipleQuantities
HTTP Method: POST
Request Body #
ProductIds #
商品編號。
資料型態: Integer Array
必填: 是
說明: 需為正整數, 陣列上限200筆
Request/Response Sample #
POST /scmapi/api/GdStock/GetMultipleQuantities
{
"ProductIds": [
6458103,
6458104,
6458105,
6458106,
6458107,
6458108,
6458109,
6458110,
6458111,
6458112
]
}
{
"GdStocks": [
{
"ProductId": 6458103,
"Qty": 17,
"QtyReg": 4,
"LeftQty": 13,
"IsAbstract": false
},
{
"ProductId": 6458104,
"Qty": 41226,
"QtyReg": 0,
"LeftQty": 41226,
"IsAbstract": false
},
{
"ProductId": 6458105,
"Qty": 432902,
"QtyReg": 0,
"LeftQty": 432902,
"IsAbstract": false
},
{
"ProductId": 6458106,
"Qty": 32767,
"QtyReg": 0,
"LeftQty": 32767,
"IsAbstract": true
},
{
"ProductId": 6458107,
"Qty": 32767,
"QtyReg": 0,
"LeftQty": 32767,
"IsAbstract": true
},
{
"ProductId": 6458108,
"Qty": 32767,
"QtyReg": 0,
"LeftQty": 32767,
"IsAbstract": true
},
{
"ProductId": 6458109,
"Qty": 32767,
"QtyReg": 0,
"LeftQty": 32767,
"IsAbstract": true
},
{
"ProductId": 6458110,
"Qty": 32767,
"QtyReg": 0,
"LeftQty": 32767,
"IsAbstract": true
},
{
"ProductId": 6458111,
"Qty": 32767,
"QtyReg": 0,
"LeftQty": 32767,
"IsAbstract": true
},
{
"ProductId": 6458112,
"Qty": 32767,
"QtyReg": 0,
"LeftQty": 32767,
"IsAbstract": true
}
]
}
Response Elements #
若操作成功,API 會回傳 HTTP 200 response。並以 JSON 格式回傳完整的商品庫存資訊。
GdStocks #
顯示商品庫存的內容。GdStocks 的結構分別說明如下:
- ProductId:商品編號
- Qty:庫存數量
- QtyReg:已登記數量
- LeftQty:可銷售數量
- IsAbstract:是否為虛主件
資料型態: String Array
ProductId #
商品編號。
資料型態: Integer
Qty #
庫存數量。
資料型態: Integer
QtyReg #
已登記數量。
資料型態: Integer
說明:商品已銷售的數量
LeftQty #
可銷售數量。
資料型態: Integer
說明:LeftQty = (Qty - QtyReg) » 賣場可銷售數量
IsAbstract #
是否為虛主件。
資料型態: Boolean
說明:
- true: 虛主件,庫存數量固定為:32767
- false: 主件商品
Errors #
Bad Request #
輸入的參數不符合 API 定義的 Pattern。
HTTP Status Code: 400
Error List
Error Code | Description |
---|---|
Invalid input | |
400 | 商品資訊未提供 |
400 | 多筆庫存查詢,單次僅限200筆 |