Accessing the SUPPLIERS resource

The suppliers resource provides read only access to the suppliers on Aanbieders.be.

Choose the appropriate HTTP method

Resource HTTP format URL.format Description
Suppliers GET /suppliers.json Returns a list of suppliers

By using this method, you can request a list of suppliers. The suppliers in this list are selected based on parameters that are either optional or required and passed along with HTTP method.

Define the parameters

The suppliers resource accepts a number of parameters based. You can either request explicit suppliers by providing their IDs, or do a more Find-based approach to find all suppliers operating in a certain product-area.

Supplier ID based search (when you provide a SupplierID this searh method gets priority, even if other params are provided)

Name Parameter Required Type Description
Supplier ID(s) pref_cs no array Returns the suppliers identified by the (array of) supplier_id
Language lang yes nl / fr Language
Detaillevel detaillevel no array Level of detail in response (see detaillevel-chapter)

Supplier operating-search based search

Name Parameter Required Type Description
Product type cat yes string Product type
Language lang yes nl / fr Language
Segment sg no consumer /sme Segment
Detaillevel detaillevel no array Level of detail in response (see detaillevel-chapter)
Exclude Supplier(s) excl_sids no numeric / array Exclude the specified suppliers from the results
Status status no numeric or numeric array Specify the required status of the suppliers products. 0=inactive, 1=active (default), 2=archived

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:

Example code

  1. Gas suppliers in french for consumers
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 = array('cat' => 'gas', 'lang' => 'fr', 'sg' => 'consumer');
     
     // get the products
     $suppliers = $client->getSuppliers($params);
     
 } catch (Exception $e) {
     echo $e->getMessage();
 }
  1. Gas suppliers in french for consumers
<?php
require_once '../aanbieders.php';
 
 $config =  array(
                 'key'             => 'dummy',
                 'secret'         => 'dummy'
         );
 try {
     // instantiate the Aanbieders class and provide the necessary parameters
     $test = new Aanbieders($config);
     
     // define the parameters
     $params = array('cat' => 'gas', 'lang' => 'fr', 'sg' => 'consumer');
     
     // get the products
     $suppliers = ($params);
     
     // now do whatever you need to do with the result
     if(is_array($suppliers)) {
         foreach($suppliers as $supplier) {
             echo $supplier->supplier_id . '| ' . $supplier->name . '<br/>';
         }
     }
     
 } catch (Exception $e) {
     // Oeps , something went wrong
     echo $e->getMessage();
 }