hitmeister / api-sdk
Kaufland.de 在线商店 API SDK for PHP
1.54.0
2023-04-25 11:19 UTC
Requires
- php: >=5.4.0
- ext-curl: *
- ext-json: *
- guzzlehttp/ringphp: ^1.1
- psr/log: ^1.0
Requires (Dev)
- memio/memio: ^1.1
- mockery/mockery: ^0.9.4
- php-coveralls/php-coveralls: ^1.1
- phpunit/phpunit: ^4.8
Suggests
- monolog/monolog: Allows more advanced logging of the application flow
- dev-develop
- 1.54.0
- 1.51.0
- 1.50.0
- 1.49.0
- 1.48.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.40.0
- 1.39.0
- 1.38.0
- 1.37.0
- 1.36.0
- 1.35.1
- 1.35.0
- 1.34.1
- 1.33.1
- 1.33.0
- 1.32.0
- 1.31.1
- 1.30.1
- 1.28.0
- 1.26.1
- 1.26.0
- 1.25.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.19.2
- 1.19.1
- 1.19.0
- 1.17.3
- 1.17.2
- 1.17.1
- 1.17.0
- 1.16.0
- 1.15.0
- 1.13.4
- 1.13.3
- 1.13.2
- 1.13.1
- 1.13.0
- 1.11.1
- 1.11.0
- 1.7.0
- 1.6.0
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1
- dev-PTA-45-remove-bookings-report-for-old-business-model
- dev-COL-3032-update-sdk
- dev-SLD-803-add-new-carrier-constants
- dev-SLM-664_accept_custom_user_agent
- dev-SLD-711-add-new-carriers
- dev-SLD-343-change-real-to-kaufland
- dev-sld-427-add-postnl-3s-and-other-carriers
- dev-PD-2145-fix-type-of-ean-uri-param-to-be-string
- dev-DLV-322_add_new_carriers
- dev-abdul-jabbar01_DLV-321_Fix-mimio-object-issue
- dev-update-item-fields
- dev-INV-170-api-sdk
- dev-add-ShipmentInformationTransfer-to-OrderUnitShipmentTransfer
- dev-master
- dev-PD-780-change-shop-api-for-zombies
- dev-add-delivery_time_min-to-order-units
- dev-revert-56-develop
- dev-rename-delivery-time-expires
This package is auto-updated.
Last update: 2024-09-25 14:09:00 UTC
README
PHP 客户端用于 Kaufland.de 在线商店 API。
安装
通过 Composer
$ composer require hitmeister/api-sdk
通过 GitHub
$ git clone git@github.com:hitmeister/api-sdk-php.git
快速入门
本节将为您快速概述客户端及其主要功能的工作方式。
创建客户端
开始之前,您需要从您的 API 设置页面 获取 API 密钥。同时,请将您的合作伙伴解决方案名称提供给 setUserAgent() 字段。
在您的主项目中包含自动加载器(如果您还没有这样做),并实例化一个新的客户端。
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();
命名空间概述
客户端有几个 "命名空间",通常暴露 API 功能。命名空间对应于各种 API 端点。这是命名空间的完整列表
检索类别数据
您可以搜索类别
$categories = $client->categories()->find('handy'); foreach ($categories as $category) { echo "Category ID: {$category->id_category}\n"; echo "Category Name: {$category->name}\n"; }
或者获取其中一个的信息
$category = $client->categories()->get(1); echo "Category ID: {$category->id_category}\n"; echo "Category Name: {$category->name}\n";
检索产品数据
搜索项目
$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"; }
您还可以通过 EAN 查找项目
$items = $client->items()->findByEan('0885909781652');
发送库存数据
根据 API 文档,您有两种选择
上传您的产品数据作为 CSV 文件
// 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
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件。