Availability Tutorial

How to specify availability, popularity, or stock level for a product

Information about a specific product's availability, popularity, and stock levels is stored inside the Availability object.

Take a look at the relationships between the Availability object and other resources in the Emporix Commerce Engine:

Before you start

Make sure you created a product. For more information, check out How to add your first product.

Create the Availability object

To add availability-related information for a specific product, you need to send a request to the Creating a new availability for a product endpoint.

API Reference
curl -i -X POST \
  'https://api.emporix.io/availability/{tenant}/availability/{productId}/{site}' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "stockLevel": 10,
    "available": true,
    "popularity": 5,
    "distributionChannel": "ASSORTMENT",
    "metadata": {
      "mixins": {
        "productCustomAttributes": "https://res.cloudinary.com/saas-ag/raw/upload/schemata/productCustomAttributesMixIn.v29.json"
      }
    },
    "mixins": {
      "productCustomAttributes": {
        "minOrderQuantity": 2
      }
    }
  }'

Retrieve the availability information of a product

To check if a product's availability was added successfully, you need to send a request to the Retrieving a product's availability endpoint with the product's ID in the request body.

API Reference
curl -i -X GET \
  'https://api.emporix.io/availability/{tenant}/availability/{productId}/{site}' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>'

How to calculate a product bundle's stock level

The Availability Service makes it possible to automatically calculate the stock level of a product bundle. The value is always equal to the lowest stock level of the bundled products.

Before you start

Make sure the following requirements are fulfilled:

  • You have already created all products that make up the bundle.

  • You have already specified stock levels for all products that make up the bundle.

  • You have already created a product bundle.

Retrieve the product bundle's availability information

To find out what the stock level of a product bundle is, you need to send a request to the Retrieving a product's availability endpoint with the product bundle's ID in the path.

API Reference
curl -i -X GET \
  'https://api.emporix.io/availability/{tenant}/availability/{productId}/{site}' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>'

The response includes both the availability information of the bundle as a whole, as well as the bundled products.

Last updated

Was this helpful?