---
# System prepended metadata

title: 庫存管理API
tags: [API Document]

---

# 庫存管理API
1. 取得商品庫存資料 Stock/Get
* Request Parameter
``` json
{
    "pid": "2024_01_0001"
}
```
* Response Json
``` json
[
    {
        "id": 1,
        "pid": "2024_01_0001",
        "spec_name": "白色",
        "stock_count": 4,
        "restock_count": 20,
        "total_count": 24,
        "sold_count": 16
    }
]

```
2. 更新商品庫存資料 Stock/Update
* Request Parameter
``` json
{
    "spec_id": 1,
    "type": 1,//1:Plus 2:Minus
    "count": 5
}
```
* Response Json
``` json
{
    "status": "success",
    "msg": "庫存異動成功!",
    "rtn_page": "index"
}
```