Sync product images
The sync product images API can be used to easily sync images from an external source into TRAEDE. Typically this would be used to integrate file banks, DAM's or similar
caution
POST /products/images/sync
Endpoint: POST /products/images/sync
Limit: You can only send images of 10 products at a time
Parameter | Required | Default | Description |
---|---|---|---|
product_images.* | Yes | An array of products to update |
Products
Parameter | Data type | Required | Default | Description |
---|---|---|---|---|
item_number | string | Yes | The item number of the product the images belong to | |
use_sort_b2c | boolean | Activate/deactivate B2C sorting on the product | ||
images | array<Image> | Yes | An array of images |
Image
Parameter | Data type | Required | Default | Description |
---|---|---|---|---|
url | string | Yes | The URL of the image. Note this needs to be a publicly available URL | |
sort | integer | Yes | A number giving the sort of the image | |
sort_b2c | integer | NULL | If you want the image to have a special sort for B2C systems (like Shopify) | |
existance_key | string | By default TRAEDE will use the URL to determine if an image already exists in TRAEDE. You can choose to use existance_key instead although this is not recommended. This should only be used if your URLs expire over time | ||
alt | string | NULL | An alt description of your image | |
filename | string | NULL | If you want to customize the filename of the image | |
attach_to_variants_matching_attribute_code | Array<string, string> | Use this to get TRAEDE to attach your image to specific variants. Adding something like `{"Color": "100"} will attach the image to all variants that have a color with the 100 code | ||
skip_if_no_variant_matches_attribute_code | boolean | false | If true , then TRAEDE will not create an image of no variants matching attach_to_variants_matching_attribute_code was found. Note this only apply to new images. Existing images will not be deleted |
Example
The following fictive example will assume you have a T-shirt product with 2 colors: Black and White. The product comes in 5 sizes: XS, S, M, L, XL. So there is 10 variants in total (5 sizes x 2 colors).
In this example our Black color has a code of 100 and the White color has a code of 900 (This is defined in TRAEDE UI)
In our request we sync 4 images to the product - 2 of the Black variants and 2 of the White variants. By using attach_to_variants_matching_attribute_code
we make sure the image attaches to the correct variants
POST /products/images/sync
{
"products": [
{
"item_number": "cool-product-001",
"images": [
{
"url": "https://imageserver.com/black-product-01.jpg",
"sort": 1,
"alt": "A black t-shirt front",
"attach_to_variants_matching_attribute_code": {
"Color": "100"
}
},
{
"url": "https://imageserver.com/black-product-02.jpg",
"sort": 2,
"alt": "A black t-shirt back",
"attach_to_variants_matching_attribute_code": {
"Color": "100"
}
},
{
"url": "https://imageserver.com/white-product-01.jpg",
"sort": 3,
"alt": "A white t-shirt front",
"attach_to_variants_matching_attribute_code": {
"Color": "900"
}
},
{
"url": "https://imageserver.com/white-product-02.jpg",
"sort": 4,
"alt": "A white t-shirt back",
"attach_to_variants_matching_attribute_code": {
"Color": "900"
}
}
]
}
]
}