Skip to main content

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
Important note! When sending images of a product you should always send ALL of the images on the product. Any image ommitted from the request of the product will be assumed should be deleted in TRAEDE. If TRAEDE has received an URL before the image will not be downloaded again but the version that is already downloaded will just be kept

POST /products/images/sync

Endpoint: POST /products/images/sync

Limit: You can only send images of 10 products at a time

ParameterRequiredDefaultDescription
product_images.*YesAn array of products to update

Products

ParameterData typeRequiredDefaultDescription
item_numberstringYesThe item number of the product the images belong to
use_sort_b2cbooleanActivate/deactivate B2C sorting on the product
imagesarray<Image>YesAn array of images

Image

ParameterData typeRequiredDefaultDescription
urlstringYesThe URL of the image. Note this needs to be a publicly available URL
sortintegerYesA number giving the sort of the image
sort_b2cintegerNULLIf you want the image to have a special sort for B2C systems (like Shopify)
existance_keystringBy 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
altstringNULLAn alt description of your image
filenamestringNULLIf you want to customize the filename of the image
attach_to_variants_matching_attribute_codeArray<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_codebooleanfalseIf 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"
}
}
]
}
]
}