datacue / client
DataCue 客户端
1.0.13
2020-08-12 09:14 UTC
Requires
- php: >=5.5
This package is auto-updated.
Last update: 2024-09-12 18:48:57 UTC
README
一个库,可在基于 PHP 的电子商务店中使用 DataCue 实现内容个性化
安装
使用 composer 管理您的依赖并下载 DataCue 客户端
composer require datacue/client
用法
请参阅我们的 开发者文档,切换到 PHP 标签以查看所有示例。
基本用法
<?php use DataCue\Client; $apikey = "your-api-key"; $apisecret = "your-api-secret"; $datacue = new Client( $apiKey, $apiSecret ); $data = [ "product_id" => "p1", "variant_id" => "v1", "main_category" => "jeans", "categories" => ["men","summer","jeans"], "name" => "cool jeans", "brand" => "zara", "description" => "very fashionable jeans", "color" => "blue", "size" => "M", "price" => 25000, "full_price" => 30000, "available" => True, "stock" => 5, "extra" => [ "extra_feature" => "details" ], "photo_url" => "https://s3.amazon.com/image.png", "link" => "/product/p1", "owner_id" => "user_id_3" ]; $res = $datacue->products->create($data);
高级用法
$apikey = "your-api-key"; $apisecret = "your-api-secret"; $env = "staging"; //use our test servers to try your code, default is production $options = [ 'max_try_times' => 10, //number of times to try resending if there was a failure 'pow_base' => 2, //used to adjust exponential backoff, best to leave this setting untouched 'debug' => true, // If true, additional debug info is printed to the console ]; $client = new Client( $apiKey, $apiSecret, $options, $env );
获取您的凭证
您可以在您的 仪表板 中找到您的 API 密钥和密钥。
还没有账户? 在此处注册
异常
ExceedBodySizeLimitationException
请确保每个负载的大小不超过 5MB。如果您收到此异常,请将您的请求分成小于 5MB 的块,然后再次尝试。
ExceedListDataSizeLimitationException
请确保您在单个批量请求中看不到超过 500 项。如果您收到此异常,请将您的请求分成至少每项 500 的请求,然后再次尝试。