Add product images

Images are important parts of a product library. You can attach images to product library items to provide a visual representation. This can be done from the Zettle user interface, or programmatically through the Product Library API.

All images used in the product library have to be uploaded or imported into Zettle first, using the Image API. Images can be either imported from existing URLs, or uploaded as image files.

The Image API returns a server URL, which is then used by the Product Library API to associate the image with a product.

Note: A product can only have one single associated image. You cannot share images across products.

Prerequisites

  • Authorisation setup with the correct scope, and a valid authorisation token. See Product library concept.
  • Required access right: READ:PRODUCT, WRITE:PRODUCT.
  • The product ID when adding an image to an existing product. See Fetch products.

Step 1: Upload images to Zettle

Use the Image API to upload one or multiple product images to Zettle. There are multiple ways to upload images. In this example a single image is uploaded from a URL. For more details, see Upload product images.

1
POST /v2/images/organizations/self/products
2
{
3
"imageFormat": "{JPEG,PNG,GIF}",
4
"imageUrl": "https://example.com/image.png"
5
}

Upon successful upload, the image service returns an imageLookupKey and one or more imageUrls which are used when associating the image with a product.

Example response

1
{
2
"imageLookupKey": "SOuNiq6PSUCD6UhdgPIaoA-LBSCiJlfEeySah17rP0KvA",
3
"imageUrls": [
4
"https://image.izettle.com/product/SOuNiq6PSUCD6UhdgPIaoA-LBSCiJlfEeySah17rP0KvA.png"
5
]
6
}

Step 2: Associate image with product

Make a POST request to create a new product with an image. Alternatively, make a PUT request to update an image for an existing product with a known uuid.

1
PUT /organizations/self/products/v2/{{productUUID}}

The following example shows how to associate an image URL with a product, for display in the product library.

Example request body

1
{
2
"uuid": "89f9d200-fb8a-11ea-adc1-0242ac120002",
3
"name": "T-shirt",
4
"description": "Basic t-shirt model.",
5
"presentation": {
6
"imageUrl": "https://image.izettletest.com/product/sTop9DEqEemOix6FMP9b9Q-JsvDJPuJEequ57W3cjPOlg.png"
7
},
8
...

Note: The Image API may provide the image in one or multiple resolutions. To apply an uploaded image to a product, use the first URL provided in the imageUrls array.