Product Resource

Product list

Returns a complete or limited list of products

Method

Overview parameters

Parameters needed to successfully get a list of products

Name Parameter Required Type Description
Public key key yes string Public key issued to you after registration
API key apikey yes string Calculated key
Unix timestamp timestamp yes string Unix timestamp used to calculate the api key
Producttype cat yes string Type of product
Language lang yes nl , fr Language indicator
Segment sg no consumer , sme Segment indicator (can be empty)
Supplier (s) sid ([]) no id , list of ids numeric (array of) ID of the supplier
Product id(s) productid ([]) no numeric or list of numerics One or more id's of a product
Detaillevel detaillevel[] no array Level of detail in response (see detaillevel-chapter)
Limit limit no numeric Limit to num results
Sort sort no enum ** (default by name) Sort order of results (see sort-chapter)
Status status no numeric or numeric array Specify the required status of the products. 0=inactive, 1=active (default), 2=archived

* ([]) indicates that the parameter accepts either a single value, of an array of values.

As you can see most of the parameters are required. If you have trouble understanding what these parameters mean, please consult the vocabulary.

Detaillevel

Detaillevel gives you the possibility to scale down the response array. When you only need texts, you can add texts to your detaillevel array and will only get the text array in your output. When no detaillevel is given, all details are returned. Details are regularly added to the array. It's recommended to specify only the information that you need, this to avoid unneeded resources usage and network traffic. Less data means faster responses.

In this case, you have the choice in:

Sorting

You can specify the sorting of the results. Many sorting methods are common, but some from producttype to producttype.

Name Parameter Description Producttype
Full Name fn Full Name (default sorting) all
Price sort_price all
Productname n Productname all
Customer Rating rat Customer rating all

Examples

1) get all the products of product type 'internet' in dutch and in the segment 'consumer'

require_once '../aanbieders.php';
 
 $config =  array(
                 'key'             => 'dummy',
                 'secret'         => 'dummy'
         );
 try {
     // instantiate the Aanbieders class and provide the necessary parameters
    $client = new Aanbieders($config);

     // define the parameters
    $params = [
                'cat' => 'internet',
                'lang' => 'nl',
                'sg' => 'consumer'
                ];

     // get the products
         $products = $client->getProducts($params);    
 } catch (Exception $e) {
     // Oeps , something went wrong
     echo $e->getMessage();
 }

example request:
/products.json?cat=internet&lang=nl&sg=consumer&timestamp=1334229265&key=xxxx&apikey=xxxx

2) get all products of product type energy in dutch for professional usage, with only texts in the response.

require_once '../aanbieders.php';
 
 $config =  array(
                 'key'             => 'dummy',
                 'secret'         => 'dummy'
         );
 try {
     // instantiate the Aanbieders class and provide the necessary parameters
    $client = new Aanbieders($config);

     // define the parameters
        $params = [
                'cat' => 'electricity',
                'lang' => 'nl',
                'sg' => 'sme',
                'detaillevel' => ['texts']
                ];
               
     // get the products
         $products = $client->getProducts($params);    
 } catch (Exception $e) {
     // Oeps , something went wrong
     echo $e->getMessage();
 }

example request:
/products.json?cat=electricityt&lang=nl&sg=sme&detaillevel[0]=texts&timestamp=1334229265&key=xxxx&apikey=xxxx

Product detail

Method

Overview parameters

Parameters needed to successfully get a productdetail

Name Parameter Required Type Description
Public key key yes string Public key issued to you after registration
API key apikey yes string Calculated key
Unix timestamp timestamp yes string Unix timestamp used to calculate the api key
Producttype cat yes string Type of product
Language lang yes nl , fr Language indicator
Segment sg yes consumer, sme Segment indicator
Detaillevel detaillevel no array Level of detail in response (see detaillevel-chapter)

As you can see most of the parameters are required. If you have trouble understanding what these parameters mean, please consult the vocabulary.

Detaillevel

Detaillevel gives you the possibility to scale down the response array. When you only need texts, you can add texts to your detaillevel array and will only get the text array in your output.

In this case, you have the choice in: + contract_periods + availability + texts + links + supplier + options + promotions + attachments + reviews + order_preferences + specifications

Example

get a specific product of product type 'internet' in dutch and in the segment 'consumer'

require_once '../aanbieders.php';
 
 $config =  array(
                 'key'             => 'dummy',
                 'secret'         => 'dummy'
         );
 try {
     // instantiate the Aanbieders class and provide the necessary parameters
    $client = new Aanbieders($config);

     // define the parameters
        $params = [
                'cat' => 'internet',
                'lang' => 'nl',
                'sg' => 'consumer'
        ];
        //product id
        $productid = 2;
       
     // get the product
         $product = $client->getProducts($params, $productid);    
       
 } catch (Exception $e) {
     // Oeps , something went wrong
     echo $e->getMessage();
 }

example request:
/products/2.json?cat=internet&lang=nl&sg=consumer&timestamp=1334230603&key=xxxxx&apikey=xxxxx

The result

The most important part of the request is of course the response. Let's take a closer look to a possible response and examine the various parts. Following is the response to requesting 1 specific internet product in dutch in segment 'consumer'.

HTTP/1.1 200 OK

In case of a successfull request, the body contains a json encoded list of products.

[{"producttype":"internet","product_id":"2","group_id":"0","segment":"consumer","last_update":"2009-10-02 15:35:08","last_update_timestamp":1254490508,"contract_periods":["12"],"availability":{"flanders":true,"wallonia":true,"brussels":true},"texts":{"name":"ADSL Light","oneliner":"","explanation":"","remarks":""},"links":{"terms_conditions":null,"clickout":"http:\/\/localhost\/www.ab.be\/internet\/providers\/belcenter\/internet\/adsl-light\/bestel"},"supplier":{"supplier_id":"36","name":"Belcenter","logo":{"100x70":{"color":"http:\/\/static.econtract.be\/brands\/logos\/no_logo.gif","grayscale":"http:\/\/static.econtract.be\/brands\/logos\/gray\/no_logo.gif"},"60x42":{"color":"http:\/\/static.econtract.be\/brands\/midsize\/no_logo.gif","grayscale":"http:\/\/static.econtract.be\/brands\/midsize\/gray\/no_logo.gif"},"80x30":{"color":"http:\/\/static.econtract.be\/brands\/thumbs\/no_logo.gif","grayscale":"http:\/\/static.econtract.be\/brands\/thumbs\/gray\/no_logo.gif"}}},"options":[],"promotions":[],"specifications":{"volume":{"value":1,"unit":"GB"},"download":{"value":1024,"unit":"Mbps"},"upload":{"value":256,"unit":"Mbps"},"fixed_ip":{"value":"0","unit":""},"technology":{"value":"adsl","unit":""},"max_computers":{"value":-1,"unit":""},"antispam":{"value":"0","unit":""},"antivirus":{"value":"0","unit":""}},"price":{"monthly":28,"activation":50,"modem":0,"installation_full":0,"installation_diy":0,"line_rental":19.65}}]

HTTP/1.1 400 Bad Request

Api error : Not all required parameters are set : Parameter cat is required