Product GetProducts - mobly/sellercenter-sdk GitHub Wiki

Product / GetProducts

Request

try {
	// factory returning instance of Product client
	$client = \SellerCenter\SDK\Sdk::getProduct(['store' => 'mobly-br', 'environment' => 'staging']);
    $result = $client->getProducts();
} catch (\Exception $e) {
    // check exception
}

Response

The result of ->getProducts() will be an instance of SellerCenter\SDK\Product\Api\GetProducts\Response which is a representation of a SuccessResponse from SellerCenter API.

With that response you can get head with ->getHead() and body with ->getBody() methods, and iterate through product collection on body with ->getProducts() method.

$result->getHead()
// returns a representation of response's Head

$result->getBody()
// returns a representation of response's Body

$result->getBody()->getProducts()
// returns a representation of Products collection where you can iterate over

$result->getBody()->getProducts()->first()
// returns a representation of Product where you can access all it's properties

Reference