Product Image - mobly/sellercenter-sdk GitHub Wiki

Product / Image

Request

try {
	// factory returning instance of Product client
	$client = \SellerCenter\SDK\Sdk::getProduct(['store' => 'mobly-br', 'environment' => 'staging',]);
	
	$image = new \SellerCenter\SDK\Product\ProductImage();
	$image->setSellerSku('ABC123MOB');
	$image->setImages(new \SellerCenter\SDK\Product\ImageUriCollection());
	$image->getImages()->add(new \SellerCenter\SDK\Product\ImageUri('http://www.mobly.com.br/prod-1.jpg'));
	$image->getImages()->add(new \SellerCenter\SDK\Product\ImageUri('http://www.mobly.com.br/prod-2.jpg'));
	$image->getImages()->add(new \SellerCenter\SDK\Product\ImageUri('http://www.mobly.com.br/prod-3.jpg'));
	
	$result = $client->image($image);
} catch (\SellerCenter\SDK\Common\Exception\SdkException $e) {
    header('Content-Type: text/plain');
    echo $e->getTraceAsString();
}

Serialized request

<Request>
    <ProductImage>
        <SellerSku>ABC123MOB</SellerSku>
        <Images>
            <Image>http://www.mobly.com.br/prod-1.jpg</Image>
            <Image>http://www.mobly.com.br/prod-2.jpg</Image>
            <Image>http://www.mobly.com.br/prod-3.jpg</Image>
        </Images>
    </ProductImage>
</Request>

Response

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

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

$result->getHead()->getRequestId()
// returns the Feed ID that you can use to check result of the queue processing by SellerCenter

Reference

⚠️ **GitHub.com Fallback** ⚠️