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 |
Supplier detail | GET | /suppliers/[supplierId].json | Returns supplier information |
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.
Usage: List
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 |
- Status field can be used to query for 'old' suppliers, which or no longer commercially available at this moment. (old suppliers)
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:
- texts
- links
- logo
- contact_info
Example code
- 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();
}
- 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();
}
Usage: Detail
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 |
---|---|---|---|---|
Language | lang | yes | nl / fr | Language |
Detaillevel | detaillevel | no | array | Level of detail in response (see detaillevel-chapter) |
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:
- texts
- links
- logo
- contact_info
- products -> include products in results
- single_review -> include a single review in results
Example:
https://api.econtract.be/suppliers/6.json?lang=nl&key=ea219b10492eb4e0dec2b6c5970d2d20c69c86bb&time=1539951874&nonce=182971d542e45687d97b3f1454db23f6&ip=81.82.215.70&apikey=7a68137750e590e7f8fcfe12e102711ea1b12640&detaillevel[]=products