The Bol.com Open Api is an RESTfull API wich you can use to communicate with the Bol.com webshop catalogue. This library makes it very easy to use this API as a service within your PHP application.
You need to have a developer key to use this API. You can get one by registering at the Bol.com developer center.
This library is released under the MIT license. See the complete license in the LICENSE file.
First install composer and after that install the dependencies.
PHP >=5.3.0
// ..
$httpBrowser = new \Buzz\Browser();
$accessKey = 'ABC';
$secretAccessKey = 'DEF';
$apiClient = new Client($accessKey, $secretAccessKey, $httpBrowser);
// ..
The searchresults operation returns product information by supplying keywords or ISBN/EAN. The operation has filtering and paging options.
// ..
$term = 'PHP';
$options = array(
'categoryIdAndRefinements' => null,
'offset' => 0,
'nrProducts' => 10,
'sortingMethod' => SortingMethod::PRICE,
'sortingAscending' => true,
'includeProducts' => true,
'includeCategories' => true,
'includeRefinements' => true
);
$searchResult = $apiClient->searchResults($term, $options);
// ..
The listresults operation returns various product lists, based on list type and category. The category is based on the id, which can be obtained by the category list request.
For available list types see the documentation.
// ..
$type = ProductListType::TOPLIST_DEFAULT;
$categoryIdAndRefinements = '87';
$options = array(
'offset' => null,
'nrProducts' => 10,
'sortingMethod' => SortingMethod::TITLE,
'sortingAscending' => true,
'includeProducts' => false,
'includeCategories' => true,
'includeRefinements' => true
);
$listResult = $apiClient->listResults($type, $categoryIdAndRefinements, $options);
// ..
The products operation gets detailed information for products.
// ...
$productId = '1002004011800815';
$productResponse = $apiClient->products($productId);
// ...
For a list of the possible enumerations options (for example sorting methods) take a look at the classes within the Enum namespace.
Further documentation about the API can be found at the Bol.com developer center.
Be sure to install the dependencies first and after that just run phpunit in the lib root:
phpunit