Stock
With the stock endpoint you will be able to get the current stock of a product. Depending on your access level you will be able to get the stock as a string status or as an absolute value.
The stock model
The stock model contains all the information about the stock of a product. It contains the product id and the current stock level. You can use this to check if a product is available or not.
Properties
- Name
product_id
- Type
- string
- Description
Unique identifier for the product.
- Name
stock
- Type
- integer
- Description
The current stock level of the product.
- Name
status
- Type
- string
- Description
The current stock status of the product.
Status optionsavailable
The product is available and can be ordered.incoming
This product will be in stock soon. Delivery should be possible within 2 days.on_request
The stock is currently unknown.out_of_stock
This product is currently not on stock.
List all stock
This endpoint allows you to retrieve a list of the stock of all products from VDH-Solar. Refer to the list at the top of this page to see which properties are included with stock objects.
Query parameters
You can use the query parameters below to filter the list of products you receive from the API. You can also paginate the results. Please check the pagination section for more information.
- Name
name
- Type
- string
- Description
Filter on the name of the product. This will use a
%LIKE%
query.
- Name
id
- Type
- integer
- Description
We will do an exact match on the product id. It would be beter to use the single product endpoint for this.
- Name
status
- Type
- string
- Description
Filter on the availability of the product. You can see the possible options fot this filter in the properties overview.
Request
$client = new \VdhSolar\ApiClient('eyJ...');
$client->stock->list([
'name' => 'EGE Solar',
]);
Response
{
"data": [
{
"product_id": 12345,
"stock": 200,
"status": "available",
},
{
// etc...
},
]
}
List a single product
This endpoint allows you to to get the stock from a single product. Refer to the list at the top of this page to see which properties are included with stock objects.
Request
$client = new \VdhSolar\ApiClient('eyJ...');
$client->stock->get(12345);
Response
{
"data": {
"product_id": 12345,
"stock": 0,
"status": "out_of_stock",
}
}