Skip to content

Kaufland.de Onlineshop (former real.de and Hitmeister) API SDK for PHP

License

Notifications You must be signed in to change notification settings

ChrisSantiago82/kauflandapi

 
 

Repository files navigation

Kaufland.de Onlineshop - API SDK for PHP Build Status

Latest Stable Version Coverage Status Total Downloads

PHP client for Kaufland.de Onlineshop API.

Install

Via Composer

$ composer require hitmeister/api-sdk

Via GitHub

$ git clone git@github.com:hitmeister/api-sdk-php.git

Quickstart

This section will give you a quick overview of the client and how the major functions work.

Create client

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();

Namespaces overview

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

Retrieve the categories data

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";

Retrieve the product data

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');

Send inventory data

According to the API documentation you have two options:

To upload your product data as CSV file

// 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";

To update a single unit

// $result will be true or false
$result = $client->units()->update(10, ['condition' => 'new']);

Testing

$ composer test

License

The MIT License (MIT). Please see License File for more information.

About

Kaufland.de Onlineshop (former real.de and Hitmeister) API SDK for PHP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%