getInventoryProductsStock
The method allows you to retrieve stock and reservations data of products from BaseLinker catalogs, optionally narrowed down with product filters.
Input parameters
| inventory_id | int | Catalog ID. The list of identifiers can be retrieved using the method getInventories. |
| filter_id | int | (optional) limits results to a specific product ID |
| filter_category_id | int | (optional) limits results to products from a specific category |
| filter_ean | varchar(32) | (optional) limits results to a specific EAN (including additional product EANs) |
| filter_sku | varchar(50) | (optional) limits results to a specific SKU (stock keeping unit) |
| filter_name | varchar(200) | (optional) product name filter (part of the searched name or an empty field) |
| filter_asin | varchar(50) | (optional) limits results to a specific ASIN |
| filter_stock_from | int | (optional) minimum stock quantity |
| filter_stock_to | int | (optional) maximum stock quantity |
| page | int | (optional) Results paging (1000 products per page for BaseLinker warehouse) |
| filter_sort | varchar(30) | (optional) sorts the returned products. Possible values: "id [ASC|DESC]". |
| filter_locations | varchar(20) | (optional) filters results by location name |
Output data
The method returns the data in JSON format.
| status | varchar(30) | SUCCESS - request executed correctly ERROR - an error occurred during an API request. Error details will be described in 2 additional returned fields: error_message and error_code |
| products | array | A list containing product stocks, where the key is the product ID and the value is an array containing the fields listed below. |
| | - product_id | int | ID of the product. |
| | - stock | array | A list where the key is the warehouse ID and the value is a stock for this warehouse. Warehouse ID should have the following format: "[type:bl|shop|warehouse]_[id:int]" (e.g. "bl_123"). The list of warehouse IDs can be retrieved with getInventoryWarehouses method. |
| | - reservations | array | Only returned for inventories that have reservations enabled. A list where the key is the warehouse ID and the value is a reserved stock for this warehouse. |
| | - variants | array | A list containing variants stocks, where the key is the variant ID. The value is a list where a key is a warehouse ID and value is a stock in this warehouse. |
| | - variant_reservations | array | Only returned for inventories that have reservations enabled and only for products that have variants. A list containing variant reservations, where the key is the variant ID and the value is a list where the key is a warehouse ID and the value is a reserved stock for this warehouse. Only variants with non-zero reservations are included. |
Sample
Input data:Output data:
A sample request in PHP: