Categories API

General Information

You can access the list of all our product categories (formally the tag "Type" in the Products API) and their attributes using our Categories JSON/REST API.

This is a useful service for example when integrating with e-commerce platforms that require to first import all categories.

JSON/REST

The data is provided through one endpoint: category

This webservice is very similar to the Products and Product Images web service. Therefore:

  • Method to be used is POST

  • Encoding is UTF-8

  • Text delimiter is the double quote (")

  • Field delimiter is the semicolon (;)

  • 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.

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
TEST
https://apitest.stanleystella.com
mig_api
PROD
https://api.stanleystella.com
production_api

Note : the test endpoint is deemed to be used with eligible partners when we develop new features with our API. You should connect to our prod environment.

Get JSON

Service
URL
Categories
/webrequest/category/get_json

JSON format as input  

Submit this JSON message as input. There are no filters possible on this call.

{
    "jsonrpc":"2.0",
    "method":"call",
    "params":{
        "db_name":"production_api",
        "password":"YOUR_PASSWORD",
        "user":"YOUR_LOGIN"
    },
    "id":0
}
JSON format as output

The following JSON is the output of the call.

{
    "jsonrpc": "2.0",
    "id": 0,
    "result": "[
        {
            \"Code\": \"Default\",
            \"Name\": \"Default\",
            \"Category\": \"Default\"
        },
        {
            \"Code\": \"Tee-shirt\",
            \"Name\": \"Tee-shirt\",
            \"Category\": \"Top\"
        },
        {
            \"Code\": \"Sweatshirts\",
            \"Name\": \"Sweatshirts\",
            \"Category\": \"Top\"
        },
        ...
    ]"
}



PHP code example with curl

Here is an example of PHP code used to call the Colours JSON/REST service. This code is given as illustration.

$url = "https://api.stanleystella.com/webrequest/category/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(json_decode($result)->result, true);
curl_close($ch);