PHP code example of mozu / api

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

    

mozu / api example snippets


$orderResource = new OrderResource($apiContext);
$filters = urlencode("submittedDate gt 2013-12-15T12:21:24z");
$promise = $orderResource->getOrdersAsync('0',100, null,$filters, null, null);
$mozuResult = $promise->wait();
$correlation = $mozuResult->correlationId;
$orders = $mozuResult->json()->items;

$productResource = new ProductResource($apiContext, DataViewMode::LIVE);
$promises = [
    "product1" => $this->object->getProductAsync("product1"),<br>
    "product2" => $this->object->getProductAsync("product2"),<br>
    "product3" => $this->object->getProductAsync("product3")<br>
];
$results = Promise\unwrap($promises);
printf($results["product1"]->json()->productCode);
printf($results["product2"]->json()->productCode);
printf($results["product3"]->json()->productCode);