2017 © Pedro Pelรกez
 

sdk rest-sdk

image

epages/rest-sdk

  • Sunday, March 4, 2018
  • by dbawdy
  • Repository
  • 2 Watchers
  • 1 Stars
  • 36 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 36 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

ePages REST SDK

This is the PHP REST SDK to easily connect to an ePages shop. You can use it as a developer to develop apps for ePages. Just sign up for the ePages Developer Program and create a free developer test shop., (*1)

Requirements

To use this SDK, you'll need:, (*2)

  • at least PHP 7.0

All dependencies comes automatically with the client and could be updated via composer., (*3)

Installation via composer

Its easy to get the client via Composer. Just search for epages/rest-sdk and put this to you composer.yml file:, (*4)

{
   "require": {
      "epages/rest-sdk": ">=0.2"
    }
}

Configuration

You can configure it with putting a config.json into you main directory. Just copy the config.example.json from GitHub or create a new one:, (*5)

{
    "Client": {
        "host": "www.some.host",
        "shop": "shopName",
        "isSSL": true,
        "userAgent": "UserAgent",
        "token": "TheTokenIfExists"
    },
    "Logger": {
        "level": "ERROR",
        "output": "SCREEN"
    }
}

Version information

The following information are provided with the ePages REST SDK until now., (*6)

Feature GET PUT POST DELETE PATCH information
carts โœ˜ โœ˜ โœ˜ โœ˜ ?
categories โœ˜ โœ˜ - - ?
currencies โœ” - - - ?
legal โœ˜ - - - ? won't do, it's not needed
legal/contact-information โœ” โœ˜ - - ?
legal/privacy-policy โœ” โœ˜ - - ?
legal/rights-of-withdrawal โœ” โœ˜ - - ?
legal/shipping-information โœ” โœ˜ - - ?
legal/terms-and-condition โœ” โœ˜ - - ?
locales โœ” - - - ?
products โœ” - - โœ” ?
products//custom-attributes โœ” - - . ?
products//stock-level โœ” โœ” - - ?
products/export โœ˜ - - - ?
sales โœ˜ โœ˜ โœ˜ โœ˜ ?
search/product-suggest โœ˜ - - - ?
shipping-methods โœ˜ - - - ?

Code examples

For code examples, see the examples folder., (*7)

Example Get 100 products

require_once("libraries/epages-rest-client.phar");
ep6\Logger::setLogLevel(ep6\LogLevel::NOTIFICATION);    // activate visible output

// set connection constants
$HOST       = "www.meinshop.de";
$SHOP       = "DemoShop";
$AUTHTOKEN  = "xyzxyzxyzxyzxyzxyzxyzxyz";
$ISSSL      = true;

// connect to shop
$shop = new ep6\Shop($HOST, $SHOP, $AUTHTOKEN, $ISSSL);

// use a product filter to search for products
$productFilter = new ep6\ProductFilter();
$productFilter->setLocale("de_DE");
$productFilter->setCurrency("EUR");
$productFilter->setSort("name");
$productFilter->setResultsPerPage(100);
$products = $productFilter->getProducts();

// print the products
foreach ($products as $product) {

    echo "<h2>" . htmlentities($product->getName()) . "</h2>";
    echo "<p>";
    echo "<img style=\"float:left\" src=\"" . $product->getSmallImage()->getOriginURL() . "\"/>";
    echo "<strong>ProductID:</strong> " . $product->getID() . "<br/>";
    echo "<strong>Description:</strong> " . htmlentities($product->getDescription()) . "<br/><br/>";
    echo "<strong>This product is ";
    if (!$product->isForSale()) {
        echo "NOT ";
    }
    echo "for sale and is ";
    if ($product->isSpecialOffer()) {
        echo "<u>a</u> ";
    }
    else {
        echo "not a ";
    }
    echo "special offer.</strong>";
    echo "</p><hr style=\"clear:both\"/>";
}

Example Retrieve shop information

require_once("libraries/epages-rest-php.phar");
ep6\Logger::setLogLevel(ep6\LogLevel::NOTIFICATION);    //activate visible output

// set connection constants
$HOST       = "www.meinshop.de";
$SHOP       = "DemoShop";
$AUTHTOKEN  = "xyzxyzxyzxyzxyzxyzxyzxyz";
$ISSSL      = true;

// connect to shop
$shop = new ep6\Shop($HOST, $SHOP, $AUTHTOKEN, $ISSSL);

// prints the default currency and localization
echo $shop->getDefaultLocales();
echo $shop->getDefaultCurrencies();

// prints the name of the contact information in default language and in german
$contactInformation = $shop->getContactInformation();
echo $contactInformation->getDefaultName();
echo $contactInformation->getName();

Utilities

Logger

The library comes with a huge Logger called ep6\Logger. To use this (instead of the echo command) write, (*8)

ep6\Logger::force("Print this!");

The force printer also can print arrays in a simple structure., (*9)

By default all notification messages are printed. To change this use:, (*10)

ep6\Logger::setLogLevel(ep6\LogLevel::NOTIFICATION);    // shows all messages
ep6\Logger::setLogLevel(ep6\LogLevel::WARNING);         // shows warning and error messages
ep6\Logger::setLogLevel(ep6\LogLevel::ERROR);           // shows only error messages
ep6\Logger::setLogLevel(ep6\LogLevel::NONE);            // don't log anything

InputValidator

To validate data and check the value of an object there is a InputValidator class:, (*11)

ep6\InputValidator::isHost("www.test.de");
ep6\InputValidator::isJSON("{}");

You can find all InputValidator functions in the documentation, (*12)

Function reference

The complete reference is located here., (*13)

License

The code is available under the terms of the MIT License., (*14)

The Versions

04/03 2018

0.0.1

0.0.1.0

  Sources   Download

04/03 2018

0.0.3

0.0.3.0

  Sources   Download

04/03 2018

0.1.0

0.1.0.0

  Sources   Download

04/03 2018

0.0.0

0.0.0.0

  Sources   Download

22/11 2017

dev-master

9999999-dev https://developer.epages.com/

This is the REST SDK to connect to an epages shop. You can use it as a developer for develop epages apps.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

epages rest sdk

26/10 2016

0.2.1

0.2.1.0 https://developer.epages.com/

This is the REST SDK to connect to an epages shop. You can use it as a developer for develop epages apps.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

epages rest sdk

15/08 2016

0.2.0

0.2.0.0 https://developer.epages.com/

This is the REST SDK to connect to an epages shop. You can use it as a developer for develop epages apps.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

epages rest sdk

04/04 2016

0.1.2

0.1.2.0 https://developer.epages.com/

This is the REST SDK to connect to an epages shop. You can use it as a developer for develop epages apps.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

epages rest sdk

22/02 2016

0.1.1

0.1.1.0 https://developer.epages.com/

This is the REST SDK to connect to an epages shop. You can use it as a developer for develop epages apps.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

epages rest sdk