商品庫存查詢與更新 #
庫存多筆更新 #
更新 多筆商品庫存。
Endpoint URL: https://tw.scm.yahooapis.com/scmapi/api/GdStock/UpdateMultipleQuantities
HTTP Method: POST
Request Body #
productId #
商品編號。
資料型態: Integer
必填: 是
說明: 需為正整數
Quantity #
數量。
資料型態: Integer
必填: 是
說明:
- 加量:正整數
 - 減量:負數
 - 輸入0:顯示結果為
可銷售數量無異動 - 若更新數量(Quantity)為負數且大於可銷售數量(LeftQty)時,則顯示結果為
更新成功可銷售數量(LeftQty)會更新至0 
Request/Response Sample #
POST /scmapi/api/GdStock/UpdateMultipleQuantities
[
    {
        "productId": 6458100,
        "quantity": -2
    },
    {
        "productId": 6923827,
        "quantity": 0
    },
    {
        "productId": 6458101,
        "quantity": -2
    },
    {
        "productId": 6458102,
        "quantity": -2
    },
    {
        "productId": 6458103,
        "quantity": -3
    },
    {
        "productId": 6458104,
        "quantity": 4
    },
    {
        "productId": 6458105,
        "quantity": -40000
    },
    {
        "productId": 6457249,
        "quantity": 5
    },
    {
        "productId": 6297039,
        "quantity": 5
    },
    {
        "productId": 6457249,
        "quantity": 2
    },
    {
        "productId": 7297039,
        "quantity": 5
    },
    {
        "productId": 6458100,
        "quantity": 20
    }
]
[
    {
        "Id": 6923827,
        "UpdateQty": 0,
        "IsAbstract": false,
        "IsSuccess": false,
        "Message": "目前可銷售數量為:5, 欲增加數量為:0, 實際增加數量:0, 結果:可銷售數量無異動",
        "ProducerResponses": []
    },
    {
        "Id": 6458101,
        "UpdateQty": 0,
        "IsAbstract": false,
        "IsSuccess": false,
        "Message": "目前可銷售數量為:0, 欲增加數量為:-2, 實際增加數量:0, 結果:可銷售數量無異動",
        "ProducerResponses": []
    },
    {
        "Id": 6458102,
        "UpdateQty": 0,
        "IsAbstract": true,
        "IsSuccess": false,
        "Message": "虛主件無法更新庫存",
        "ProducerResponses": []
    },
    {
        "Id": 6458103,
        "UpdateQty": 0,
        "IsAbstract": false,
        "IsSuccess": false,
        "Message": "目前可銷售數量為:0, 欲增加數量為:-3, 實際增加數量:0, 結果:可銷售數量無異動",
        "ProducerResponses": []
    },
    {
        "Id": 6458104,
        "UpdateQty": 4,
        "IsAbstract": false,
        "IsSuccess": true,
        "Message": "目前可銷售數量為:41270, 欲增加數量為:4, 實際增加數量:4, 結果:更新成功",
        "ProducerResponses": []
    },
    {
        "Id": 6458105,
        "UpdateQty": -40000,
        "IsAbstract": false,
        "IsSuccess": true,
        "Message": "目前可銷售數量為:872902, 欲增加數量為:-40000, 實際增加數量:-40000, 結果:更新成功",
        "ProducerResponses": []
    },
    {
        "Id": 6457249,
        "UpdateQty": 0,
        "IsAbstract": false,
        "IsSuccess": false,
        "Message": "快速到貨商品不可更新",
        "ProducerResponses": []
    },
    {
        "Id": 6458100,
        "UpdateQty": 0,
        "IsAbstract": false,
        "IsSuccess": false,
        "Message": "商品編號重複",
        "ProducerResponses": []
    },
    {
        "Id": 6457249,
        "UpdateQty": 0,
        "IsAbstract": false,
        "IsSuccess": false,
        "Message": "商品編號重複",
        "ProducerResponses": []
    }
]
Response Elements #
若操作成功,API 會回傳 HTTP 200 response。並以 JSON 格式回傳完整的更新後商品庫存資訊。
Id #
商品編號。
資料型態: Integer
UpdateQty #
更新數量。
資料型態: Integer
IsAbstract #
是否為虛主件。
資料型態: Boolean
說明:
- true: 虛主件,庫存數量固定為:32767
 - false: 主件商品
 
IsSuccess #
是否更新成功。
資料型態: Boolean
說明:
- true: 更新成功
 - false: 更新失敗
 
Message #
訊息狀態。
資料型態: String
說明:顯示更新成功與否的訊息
Errors #
Bad Request #
輸入的參數不符合 API 定義的 Pattern。
HTTP Status Code: 400
Error List
| Error Code | Description | 
|---|---|
| Invalid input | |
| 400 | 商品資訊未提供 | 
| 400 | 無可更新庫存之商品 |