PHP client for Kaufland.de Onlineshop API.
Via Composer
$ composer require hitmeister/api-sdk
Via GitHub
$ git clone [email protected]:hitmeister/api-sdk-php.git
This section will give you a quick overview of the client and how the major functions work.
Before starting, you will need the API keys from your API settings page. Also please provide the name of your partner solution name to the setUserAgent() field.
Include the autoloader in your main project (if you haven’t already), and instantiate a new client.
require 'vendor/autoload.php';
use Hitmeister\Component\Api\ClientBuilder;
$client = ClientBuilder::create()
->setClientKey('YOUR_CLIENT_KEY')
->setClientSecret('YOUR_CLIENT_SECRET')
->setUserAgent('YOUR_USER_AGENT')
->build();
The client has a number of "namespaces", which generally expose API functionality. The namespaces correspond to the various API endpoints. This is a complete list of namespaces:
Namespace | Functionality |
---|---|
attributes() |
Retrieve the attributes data |
categories() |
Retrieve the categories data |
claimMessages() |
Post messages to the claim DEPRECATED, use ticketMessages |
claims() |
Retrieve and manage the claims DEPRECATED, use tickets |
importFiles() |
To send inventory data for multiple items at once |
items() |
Retrieve the product data |
orders() |
Retrieve the orders data |
orderInvoices() |
Retrieve and manage order invoices data |
orderUnits() |
Retrieve and manage your order units |
productData() |
Upload or change your product data for an EAN |
productDataStatus() |
Retrieve the status of your product data |
reports() |
Generate and retrieve summary reports |
returns() |
Retrieve the returns from your sales |
returnUnits() |
Accept, reject or repair returns from your sales |
shipments() |
Add shipment information to order units |
shippingGroups() |
Retrieve the shipping groups data |
status() |
System status |
subscriptions() |
Push notifications management |
ticketMessages() |
Post messages to the tickets |
tickets( ) |
Manage tickets, i.e. N-to-N relations between order-units and claims |
warehouses() |
Warehouses management |
units() |
To upload inventory data one item at a time |
You can search for categories:
$categories = $client->categories()->find('handy');
foreach ($categories as $category) {
echo "Category ID: {$category->id_category}\n";
echo "Category Name: {$category->name}\n";
}
Or get the information about one of them:
$category = $client->categories()->get(1);
echo "Category ID: {$category->id_category}\n";
echo "Category Name: {$category->name}\n";
Search for items:
$items = $client->items()->find('iphone');
foreach ($items as $item) {
$eans = implode(',', $item->eans);
echo "Item ID: {$item->id_item}\n";
echo "Category ID: {$item->id_category}\n";
echo "Title: {$item->title}\n";
echo "EANs: {$eans}\n";
}
Also you can find the items by EAN:
$items = $client->items()->findByEan('0885909781652');
According to the API documentation you have two options:
// Post the task to import your file. You will have the ID of the task.
$importFileId = $client->importFiles()
->post('http://www.example.com/my_products.csv', 'PRODUCT_FEED');
// Retrieve the information about your task
$data = $client->importFiles()->get($importFileId);
echo "URL: {$data->uri}\n";
echo "Status: {$data->status}\n";
// $result will be true or false
$result = $client->units()->update(10, ['condition' => 'new']);
$ composer test
The MIT License (MIT). Please see License File for more information.