Giter VIP home page Giter VIP logo

api-sdk-php's Introduction

Real.de Onlineshop - API SDK for PHP Build Status

Latest Stable Version Coverage Status Total Downloads

PHP client for Real.de Onlineshop API.

Install

Via Composer

$ composer require hitmeister/api-sdk

Via GitHub

$ git clone [email protected]: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.

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.