Class ByProjectKeyProductsByIDImagesPost

All Implemented Interfaces:
ClientRequestCommand<Product>, CreateHttpRequestCommand, HttpRequestCommand<Product>, RequestCommand<Product>

public class ByProjectKeyProductsByIDImagesPost extends TypeBodyApiMethod<ByProjectKeyProductsByIDImagesPost,Product,File>

Uploads a JPEG, PNG, or a GIF image file to a ProductVariant. The maximum file size of the image is 10MB. Either variant or sku is required to update a specific ProductVariant. If neither is provided, the image is uploaded to the Master Variant of the Product.

The response status code depends on the size of the original image. If the image is small, the API responds with 200 OK, and if the image is larger, it responds with 202 Accepted. The Product returned with a 202 Accepted status code contains a warnings field with an ImageProcessingOngoing Warning.

Produces the ProductImageAdded Message.



   CompletableFuture<ApiHttpResponse<com.commercetools.api.models.product.Product>> result = apiRoot
            .withProjectKey("{projectKey}")
            .products()
            .withId("{ID}")
            .images()
            .post(file)
            .execute()