Example with all allowed parameters
<?php
$url = 'https://www.vendus.pt/ws/v1.1/products/stocks/';
$apiKey = 'c433ff57a5ba6cdf301a48c97d9432594e35e73ce545945639bc4fb5798f1e8a';
$method = 'POST';
$params = array(
'product_id' => 12345,
'amount' => 21,
'type' => 'transfer',
'store_id' => 21,
'store_id_target' => 12345,
'stockAlert' => 5,
'obs' => 'Supplier delivery',
);
$content = json_encode($params);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, $apiKey);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array(
"Content-type: application/json",
"Content-Length: " . strlen($content),
)
);
$result = curl_exec($curl);
?>
Request
| Name | Type | Example | Description |
|---|
| product_id | int | 12345 | Product ID |
| amount | float | 21 | Stock |
| type | string reset, add, remove, transfer | Operation Type |
| store_id | int | 21 | Stock |
| store_id_target | int | 12345 | To be used only when type = transfer |
| stockAlert | int | 5 | Minimum Stock Alert |
| obs | text | Supplier delivery | Observation |
Response
| Name | Type | Example | Description |
|---|
| total | int | 155 | Stock Total |
| stores | collection | | |
| Name | Type | Example | Description |
|---|
| store_id | int | 12345 | Store ID | | stock | int | 55 | Stock | | stock_alert | int | 20 | Minimum Stock Alert |
|