PHP code example of datacue / client

1. Go to this page and download the library: Download datacue/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/ */

    

datacue / client example snippets



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
);