Combo API
General Information
This new web service lets you download the list of products combinations, aka related products.
JSON/REST
The data is provided through one endpoint: combostyles
This webservice is very similar to the other web services in our API's. Therefore:
-
Method to be used is POST
-
Encoding is UTF-8
-
The API must be called with the https prefix
In order to use this system, valid credentials are required. If you do not have one yet, please request an account.
If you wish to test your code, you can do so with a tool like Postman.
Integration
Endpoint Settings
Environment | Server | Database |
PROD | https://api.stanleystella.com | production_api |
Get JSON
Service | URL
|
Get Combos | /webrequest/combostyles/get_json |
JSON format as input
Submit this JSON message as input. There are no filters possible on this call.
{JSON format as output
"jsonrpc":"2.0",
"method":"call",
"params":{
"db_name":"production_api",
"password":"YOUR_PASSWORD",
"user":"YOUR_LOGIN"
},
"id":0
}
The following JSON is the output of the call.
{
"id": 0,
"jsonrpc": "2.0",
"result": "[
{ \"StyleCode\": \"STTU759\", \"Combos\": [ {\"StyleCode\": \"STBM569\"}, {\"StyleCode\": \"STSU857\"}, {\"StyleCode\": \"STSU856\"} ] }, { \"StyleCode\": \"STTU831\", \"Combos\": [ {\"StyleCode\": \"STSU720\"}, {\"StyleCode\": \"STBU576\"}, {\"StyleCode\": \"STSU853\"} ] }, ...
]"
}
PHP code example with curl
Here is an example of PHP code used to call the Combos JSON/REST service. This code is given as illustration.
$url = "https://api.stanleystella.com/webrequest/combostyles/get_json";
$jsonData = array(
'jsonrpc' => '2.0',
'method' => 'call',
'params' => array(
'db_name' => "production_api",
'password' => "YOUR_PASSWORD",
'user' => "YOUR_LOGIN",
),
'id' => 0
);
$ch = curl_init($url);
$jsonDataEncoded = json_encode($jsonData);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = curl_exec($ch);
$jsonDataDecoded = json_decode($result)->result;
curl_close($ch);