Developer Guides
  • Introduction
    • Welcome
  • Core
    • Overview
    • Frontend
      • Implementation & Testing
      • Using the API endpoints
      • Gift cards
        • Gift Card validation API (Optional)
      • Check stock
      • Sibling products
      • Rewards program
      • Customer signatures
      • Retail transactions
      • Shopify Local Pick-up
  • API
    • Overview
    • Quick Start
    • Accounts
    • Changelog
    • Reference
      • Customers
      • Inventory
      • Orders
      • Products
      • Rewards
      • Stores
      • Vouchers
      • Staff
Powered by GitBook
On this page
  • 1. Make a request
  • 2. Parse the response

Was this helpful?

Export as PDF
  1. Core
  2. Frontend

Check stock

PreviousGift Card validation API (Optional)NextSibling products

Last updated 1 year ago

Was this helpful?

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 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

The proxy URL path /apps/dotapparel could be different depending on the specific setup of the Shopify app proxy. It is important to take into account that certain earlier versions of DotApparel might require using an alternative URL path, /apps/dotapparel21. In this case, the example request URL will be /apps/dotapparel21/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
      }
    }
  ]
}

Shopify app proxy