Stock API
General information
The Stanley/Stella Stock Overview web service is a feature that allows you to retrieve the latest stock information about our products.
This web service can be used to:
-
Retrieve the complete stock overview, of all available SKU's
-
Retrieve the stock position of 1 particular SKU
We also provide the next replenishment date for each requested SKU, if any replenishment is foreseen.
Technical details
Endpoint Setting
We provide 2 different versions of this web service:
-
v3 framework: the standard answer of this service is formatted in XML
-
v4 framework: the standard answer of this service is formatted in JSON
Both versions provide the same information.
Baseurls :
-
v3 framework : https://webservices.stanleystella.com/OData/StockOverview
-
v4 framework : https://webservices.stanleystella.com/ODatav4/StockOverview
Credentials
In order to use this feature, you will need valid credentials.
NOTE : The user and password of the Stock API is different than the user and password of the Products API's. If you wish to use our Stock API and you already have an account for the Products API's, be sure to request new credentials for the Stock API.
Please contact us by sending an email to helpdesk[at]stanleystella[dot]com to request your credentials. Or just click the button below.
Important note:
This web service is secured using a Digest Access Authentication.
Parameters
You can pass an optional parameter to the URL to request the stock position of 1 specific SKU.
The parameter is: ?$filter=SKU eq {Stanley/Stella SKU}
Important note:
As you can see, the parameter contains white spaces. If you test this URL in your browser, your browser will automatically replace the white spaces with %20.
If you use this URL programmatically, be sure to first encode the URL before submitting the query. For example, in PHP you can use the function url_encode() to encode these white spaces.
Example:
v3
https://webservices.stanleystella.com/OData/StockOverview?$filter=SKU%20eq%20%27STAU760C002OS%27
v4
https://webservices.stanleystella.com/ODatav4/StockOverview?$filter=SKU%20eq%20%27STAU760C002OS%27
Response examples
v3 XML
The response of this web service is a feed of entries. Each entry gives the current available stock of a specific SKU at a particular date.
See the example here under. It is a snapshot taken on July 4th 2018.
The Tote Bag Black (SKU = STAU760C002OS):
-
There are 15014 units available on July 4 2018
-
There will be 15000 units available on the next replenishment planned on November 1 2018
<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="https://webservices.stanleystella.com:7448/StanleyStellaWebservice/OData/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<id>https://webservices.stanleystella.com:7448/StanleyStellaWebservice/OData/StockOverview</id>
<title type="text">StockOverview</title>
<updated>2018-07-04T13:15:38Z</updated>
<link rel="self" title="StockOverview" href="StockOverview" />
<entry>
<id>https://webservices.stanleystella.com:7448/StanleyStellaWebservice/OData/StockOverview(202)</id>
<category term="NAV.StockOverview" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" title="StockOverview" href="StockOverview(202)" />
<title />
<updated>2018-07-04T13:15:38Z</updated>
<author><name /></author>
<content type="application/xml">
<m:properties>
<d:SKU>STAU760C002OS</d:SKU>
<d:Style_Code>STAU760</d:Style_Code>
<d:Variant_Code>C002OS</d:Variant_Code>
<d:Available_Quantity m:type="Edm.Decimal">15014</d:Available_Quantity>
<d:Receipt_Date m:type="Edm.DateTime">2018-07-04T00:00:00</d:Receipt_Date>
<d:Is_Inventory m:type="Edm.Boolean">true</d:Is_Inventory>
<d:Generated_On m:type="Edm.DateTime">2018-07-04T12:26:54.943Z</d:Generated_On>
<d:Style_Name>Tote Bag</d:Style_Name>
<d:Layout_Size>OS</d:Layout_Size>
<d:Color_Description>Black</d:Color_Description>
<d:AuxiliaryIndex1 m:type="Edm.Int32">202</d:AuxiliaryIndex1>
</m:properties>
</content>
</entry>
<entry>
<id>https://webservices.stanleystella.com:7448/StanleyStellaWebservice/OData/StockOverview(203)</id>
<category term="NAV.StockOverview" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" title="StockOverview" href="StockOverview(203)" /><title />
<updated>2018-07-04T13:15:38Z</updated>
<author><name /></author>
<content type="application/xml">
<m:properties>
<d:SKU>STAU760C002OS</d:SKU>
<d:Style_Code>STAU760</d:Style_Code>
<d:Variant_Code>C002OS</d:Variant_Code>
<d:Available_Quantity m:type="Edm.Decimal">15000</d:Available_Quantity>
<d:Receipt_Date m:type="Edm.DateTime">2018-11-01T00:00:00</d:Receipt_Date>
<d:Is_Inventory m:type="Edm.Boolean">false</d:Is_Inventory>
<d:Generated_On m:type="Edm.DateTime">2018-07-04T12:26:54.943Z</d:Generated_On>
<d:Style_Name>Tote Bag</d:Style_Name>
<d:Layout_Size>OS</d:Layout_Size>
<d:Color_Description>Black</d:Color_Description>
<d:AuxiliaryIndex1 m:type="Edm.Int32">203</d:AuxiliaryIndex1>
</m:properties>
</content>
</entry>
</feed>
v4 JSON
The JSON format of v4 has exactly the same logic as v3.
{
"@odata.context":"https://webservices.stanleystella.com:7448/StanleyStellaWebservice/ODatav4/$metadata#StockOverview",
"value":[
{
"SKU":"STAU760C002OS",
"Style_Code":"STAU760",
"Variant_Code":"C002OS",
"Available_Quantity":15014,
"Receipt_Date":"2018-07-04T00:00:00Z",
"Is_Inventory":true,
"Generated_On":"2018-07-04T12:26:54.943Z",
"Style_Name":"Tote Bag",
"Layout_Size":"OS",
"Color_Description":"Black",
"AuxiliaryIndex1":202
},
{
"SKU":"STAU760C002OS",
"Style_Code":"STAU760",
"Variant_Code":"C002OS",
"Available_Quantity":15000,
"Receipt_Date":"2018-11-01T00:00:00Z",
"Is_Inventory":false,
"Generated_On":"2018-07-04T12:26:54.943Z",
"Style_Name":"Tote Bag",
"Layout_Size":"OS",
"Color_Description":"Black",
"AuxiliaryIndex1":203
}
]
}
Example of using this web service in PHP
As an illustration we provide you this PHP code snippet showing how to call the Stock Overview web service.
<?php
$url = 'https://webservices.stanleystella.com/OData/StockOverview';
$username = "YOUR_USERNAME";
$password = "YOUR_PASSWORD";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
$result = curl_exec($ch);
$httpCode = curl_getinfo($ch , CURLINFO_HTTP_CODE);
if ($result === false) {
$result = curl_error($ch);
}
print_r($result);
curl_close($ch);
?>