Skip to content

Inventory Webhook Notification (v2) ​

Webhook Version

This page documents Webhook v2 inventory updates. For the previous version, see Inventory Updates v1.

The Inventory Webhook Notification from MyLION provides you with updates about changes in inventory levels for specific products. This enables you to maintain accurate and up-to-date inventory information within your application. Below, you'll find details about the payload structure of the notification and how to set up your receiving endpoint to process these inventory updates.

What's New in v2 ​

  • Product identification is now a nested productId object (instead of flat myLionId / externalId fields).
  • sku and parentSku fields added for product identification.
  • Stock data is now grouped under a stockDetail object with more granular fields:
    • localCurrentQuantity replaces stock.
    • localCurrentProducibleQuantity replaces manufacturingQuantity.
    • localIncomingQuantities — new array of upcoming stock arrivals with date and quantity.
    • external1CurrentQuantity / external2CurrentQuantity — new fields for external warehouse stock levels.

Payload Structure ​

When an inventory update event occurs within the MyLION ERP system, a webhook notification is sent to your designated endpoint. The payload of this notification follows this structure:

json
{
    "inventories": [
        {
            "productId": {
                "myLionId": 12345678,
                "externalId": "extId"
            },
            "parentId": {
                "myLionId": 456,
                "externalId": "parentExtId"
            },
            "sku": "SKU-001",
            "parentSku": "SKU-PARENT",
            "stockDetail": {
                "localCurrentQuantity": 1.24,
                "localCurrentProducibleQuantity": 5.3,
                "localIncomingQuantities": [
                    {
                        "arrival": "2024-06-01",
                        "quantity": 100.0
                    }
                ],
                "external1CurrentQuantity": 10.0,
                "external2CurrentQuantity": 5.0
            }
        }
    ]
}
{
    "inventories": [
        {
            "productId": {
                "myLionId": 12345678,
                "externalId": "extId"
            },
            "parentId": {
                "myLionId": 456,
                "externalId": "parentExtId"
            },
            "sku": "SKU-001",
            "parentSku": "SKU-PARENT",
            "stockDetail": {
                "localCurrentQuantity": 1.24,
                "localCurrentProducibleQuantity": 5.3,
                "localIncomingQuantities": [
                    {
                        "arrival": "2024-06-01",
                        "quantity": 100.0
                    }
                ],
                "external1CurrentQuantity": 10.0,
                "external2CurrentQuantity": 5.0
            }
        }
    ]
}

Field Reference ​

inventories[]

FieldTypeDescription
productIdobjectIdentifies the product. See below.
parentIdobjectIdentifies the parent product. See below.
skuStringThe SKU of the product.
parentSkuStringThe SKU of the parent product.
stockDetailobjectGrouped stock information. See below.

productId / parentId

FieldTypeDescription
myLionIdIntegerThe unique identifier within MyLION.
externalIdStringYour external identifier.

stockDetail

FieldTypeDescription
localCurrentQuantityDoubleCurrent local stock level.
localCurrentProducibleQuantityDoubleCurrent producible quantity in the local warehouse.
localIncomingQuantitiesArray<object>Upcoming stock arrivals. See below.
external1CurrentQuantityDoubleCurrent stock level in external warehouse 1.
external2CurrentQuantityDoubleCurrent stock level in external warehouse 2.

localIncomingQuantities[]

FieldTypeDescription
arrivalStringExpected arrival date (yyyy-MM-dd).
quantityDoubleExpected incoming quantity.

Receiving Endpoint ​

To process the Inventory Webhook Notification from MyLION, you need to set up a receiving endpoint in your application. The endpoint URL should follow this format:

bash
https://<your_base_url>/rest/mylion/v2/inventory
https://<your_base_url>/rest/mylion/v2/inventory

When MyLION sends a webhook notification, it will make a POST request to the specified endpoint with the payload containing the updated inventory information. The expected response is HTTP OK (200), no payload.

Processing the Notification ​

Upon receiving the webhook notification, you can process the payload to update the inventory levels in your application's database or system. You should validate the authenticity of the incoming request using the webhook authentication method previously outlined to ensure the data's integrity.