1. Go to this page and download the library: Download jtl-scx/channel-api-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jtl-scx / channel-api-client example snippets
use JTL\SCX\Client\Api\AuthAwareApiClient;
use JTL\SCX\Client\Api\Configuration;
use JTL\SCX\Client\Channel\Api\Attribute\AttributesApi;
use JTL\SCX\Client\Channel\Api\Category\CategoryApi;
use JTL\SCX\Client\Channel\Api\Event\EventApi;
use JTL\SCX\Client\Channel\Api\Notification\NotificationApi;
use JTL\SCX\Client\Channel\Api\Offer\OfferApi;
use JTL\SCX\Client\Channel\Api\Order\OrderApi;
use JTL\SCX\Client\Channel\Api\Price\PriceApi;
use JTL\SCX\Client\Channel\Api\Report\ReportApi;
use JTL\SCX\Client\Channel\Api\Seller\SellerApi;
$configuration = new Configuration(
Configuration::HOST_PRODUCTION,
$_ENV['refreshToken']
);
// create a AuthAwareApiClient to handle authentication
$client = new AuthAwareApiClient($configuration);
// read and acknowledge seller events
$eventApi = new EventApi($client);
// manage sellers (create)
$sellerApi = new SellerApi($client);
// manage meta data such as Categories, Attributes or Price
$attributesApi = new AttributesApi($client);
$categoryApi = new CategoryApi($client);
$priceApi = new PriceApi($client);
// manage orders (send new orders, update order status or address information)
$orderApi = new OrderApi($client);
// manage offers (mark in progress, mark as listed, mark as listing failed)
$offerApi = new OfferApi($client);
// Send a notification message back to SCX Channel API.
$notificationApi = new NotificationApi($client);
// Send requested Report back to SCX
$reportingApi = new ReportApi($client);
// Send SELLER_INVENTORY Report
// see tests/Api/Report/Request/SendReportRequestTest.php
use JTL\SCX\Client\Channel\Api\Event\EventApi;
use JTL\SCX\Client\Channel\Api\Event\Request\GetEventListRequest;
$eventApi = new EventApi($authAwareApiClient);
// read a bulk of unacknowledged events from SCX Channel Api
$sellerEventList = $eventApi->get();
foreach ($sellerEventList->getEventList() as $eventContainer) {
// The Id of the event use this id to acknowledge event after processing
$id = $eventContainer->getId();
// Datetime when the event was created
$createdAt = $eventContainer->getCreatedAt();
// The Event Type
$type = $eventContainer->getType();
// The Event itself
$eventModel = $eventContainer->getEvent();
// processEvent($eventContainer)
// finally acknowledge event after processing
$eventApi->ack(new AcknowledgeEventIdListRequest([$id]));
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.