Check stock
The Check stock API endpoint receives an SKU parameter for a particular product. The SKU can be found in the Shopify variant sku attribute.
In return, DotApparel will respond with a list of inventory locations, identified by their Apparel21 store ID, and the current stock level for each location. This data should be matched with the enriched store data stored elsewhere, and displayed to the customer.
1. Make a request
Make a GET request to /apps/dotapparel/api-checkStock?sku= from the frontend of your Shopify store. This uses the Shopify app proxy to pass the request through to the DotApparel backend for calculation.
For example, if the Shopify sku is 9328088450762, you can make a GET request to /apps/dotapparel/api-checkStock?sku=9328088450762
2. Parse the response
The response will look like the example below.
Each entry in the data array corresponds to a store in which that product is stocked. If a store is missing, it means that the item is not currently stocked at that location.
The storeId and storeNumber attributes are taken directly from Apparel21. The storeId is a unique ID that Apparel21 assigns to the store, which makes be different between Apparel21 instances. The storeNumber attribute is manually entered by your administrator when setting up stores. Therefore, we recommend using storeNumber to identify stores.
// GET /apps/dotapparel/api-checkStock?sku=9328088450762
// Or GET /apps/dotapparel21/api-checkStock?sku=9328088450762
{
"data": [
{
"type": "inventoryLevel",
"id": "5226-9328088450762",
"attributes": {
"sku": "9328088450762",
"storeName": "High Street",
"storeId": 5226,
"storeNumber": 204,
"freeStock": 1
}
}
]
}Last updated
Was this helpful?