HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

Get Stock/Quantity for Warehouse (Product/Gift/Add-on)

Function

To get stock information for a specific product/ gift/ add-on product with its ID
使用商品 ID 獲取特定一個商品/ 贈品/ 加購品的庫存資料

URL

Product stock: GET <<api_domain>>/v1/products/:id/stocks
Gift stock: GET <<api_domain>>/v1/gifts/:id/stocks
Add-on stock: GET <<api_domain>>/v1/addon_products/:id/stocks

Request Parameters

ParameterTypeDescriptionExample
Id
*Required
StringProduct’s id
Gift’s id
Add-on’s id
商品id / 贈品id / 加購品id
5d3594c276e7ec003b7021c0
excludesStringCould exclude certain parameters in the response
結果要排除哪些參數
excludes[]=items.status
fieldsStringCould only show certain parameters in the response
結果只顯示哪些參數
fields[]=items.status

Response Fields

FieldTypeDescriptionExample
idStringProduct’s id
Gift’s id
Add-on’s id
商品id / 贈品id / 加購品id
5d3594c276e7ec003b7021c0
title_translationsTranslationTitle translations
商品 / 贈品 / 加購品 名稱
Please check the link on the left
stocksStock []Each stock
各倉庫的庫存
Please check the link on the left

Response Example

{
   "id": "5ef1e5cbf1159c004ed9e789",
   "title_translations": {
       "zh-hant": "測試商品*"
   },
   "variations": [
       {
           "id": "5ef1e5cb214bbc0013813cfd",
           "fields_translations": {
               "en": [
                   "s"
               ],
               "zh-hant": [
                   "s"
               ]
           },
           "stocks": [
               {
                   "warehouse_id": "5e83216e2e4f81001e756014",
                   "quantity": 0
               },
               {
                   "warehouse_id": "5e831cb68fa5fc000f9925ab",
                   "quantity": 0
               }
           ]
       },
       {
           "id": "5ef1e5cb214bbc0013813cfe",
           "fields_translations": {
               "en": [
                   "m"
               ],
               "zh-hant": [
                   "m"
               ]
           },
           "stocks": [
               {
                   "warehouse_id": "5e83216e2e4f81001e756014",
                   "quantity": 0
               },
               {
                   "warehouse_id": "5e831cb68fa5fc000f9925ab",
                   "quantity": 0
               }
           ]
       }
   ]
}
{
   "id":"5ed4b4cc4ff2fe003019c8cd",
   "title_translations":{
      "zh-hant":"測試商品",
      "en":"Test"
   },
   "stocks":[
      {
         "warehouse_id":"5e83216e2e4f81001e756014",
         "quantity":15
      },
      {
         "warehouse_id":"5e831cb68fa5fc000f9925ab",
         "quantity":5
      }
   ]
}