Returns the product images that meet the given conditions.
Admin SDKAdmin.api('commerce.product-images.find', request, function(response) { … });
HTTP POST/api/v10/commerce.product-images.find
{
"conditions" : { // returns only the images …
"products" : [ 281, 903, … ], // … that belong to these products, no more than 100, (id) - int(1…)
"option" : 56, // … that belong to this option (id) (can be null) - int(1…)
"after" : "281-56-54615163" // … with identifier after this value - string(0…19)
},
"fields" : [ "id", "product", … ], // fields to return - string
"sizes" : [ "Thumbnail", "Small", … ], // sizes to return, can be "Thumbnail", "Small", "Medium", "Large" and "Zoom" - string
"limit" : 10, // maximum number of images to return - int(1…1000)
"first" : 30, // index of the first image to return - int(0…)
}
{
"status" : "ok",
"images" : [ {
"id" : "281-56-f2c9636a", // identifier - string(10…19)
"product" : 281, // product (id) - int(1…)
"option" : 56, // option (id) (can be null) - int(1…)
"position" : 5, // position - int(0…20)
"original" : "https://…/…/56-f2c9636a.jpg", // orignal image url - string(14…255)
"resized" : { // resized images
"thumbnail" : { // thumbnail main image
"url" : "https://…", // url - string(10…)
"url2x" : "https://…", // double resolution url (can be null) - string(10…)
"width" : 40, // width in pixel - int(30…50)
"height" : 40 // height in pixel - int(30…50)
},
"small" : { // small main image
"url" : "https://…", // url - string(10…)
"url2x" : "https://…", // double resolution url (can be null) - string(10…)
"width" : 70, // width in pixel - int(50…250)
"height" : 70 // height in pixel - int(50…250)
},
"medium" : { // medium main image
"url" : "https://…", // url - string(10…)
"url2x" : "https://…", // double resolution url (can be null) - string(10…)
"width" : 150, // width in pixel - int(50…250)
"height" : 150 // height in pixel - int(50…250)
},
"large" : { // large main image
"url" : "https://…", // url - string(10…)
"url2x" : "https://…", // double resolution url (can be null) - string(10…)
"width" : 300, // width in pixel - int(250…800)
"height" : 300 // height in pixel - int(250…800)
},
"zoom" : { // zoom main image (can be null)
"url" : "https://…", // url - string(10…)
"url2x" : "https://…", // double resolution url (can be null) - string(10…)
"width" : 1200, // width in pixel - int(250…)
"height" : 1200 // height in pixel - int(250…)
},
}
}, … ]
}
find
sono ordinate per product
, option
e position
.Field | Type | Description |
---|---|---|
products | Malformed | Are not permitted more than 100 products |
sizes | Malformed | '<size> ' is not a valid image size |
Creates a new product image.
Admin SDKAdmin.api('commerce.product-images.create', request, function(response) { … });
HTTP POST/api/v10/commerce.product-images.create
{
"image" : { // image to create (required)
"product" : 281, // product (id) (required) - int(1…)
"option" : 53, // option (id) (can be null) - int(1…)
"file" : { // file (required)
"name" : "tshirt.jpg", // name (required) - string(1…255)
"content" : "Y810D…B031M==" // content Base64 encoded (required) - string
},
"position" : 5 // position, if it is not indicated it will be added to the end - int(0…20)
}
}
{
"status" : "ok",
"id" : "281-56-f2c9636a" // identifier of the new product image - string(10…19)
}
Field | Type | Description |
---|---|---|
file | AlreadyExists | Image already exists |
file | InvalidValue | Image width and height must be greater or equal to <pixels> pixels |
file | Malformed | File content format '<format> ' is not supported |
file | Malformed | File content is corrupted or is not an image |
file | Malformed | File size can not be greater than 2 MB |
option | InvalidValue | Option <option> does not belong to product <product> |
product | NotFound | Product <product> does not exist |
option
position
Deletes one or more images of the same product.
Admin SDKAdmin.api('commerce.product-images.delete', request, function(response) { … });
HTTP POST/api/v10/commerce.product-images.delete
{
"ids" : [ "281-56-f2c9636a", "281-32-a7nve8sc", … ] // identifiers of the images to delete (required) - string(10…19)
}
{
"status" : "ok"
}
Field | Type | Description |
---|---|---|
ids | Malformed | '<id> ' is not an image identifier |
ids | InvalidValue | Images do not belong to the same product |
Reorders the images of the same product changing their order.
Admin SDKAdmin.api('commerce.product-images.reorder', request, function(response) { … });
HTTP POST/api/v10/commerce.product-images.reorder
{
"ids" : [ "281-56-f2c9636a", "281-32-a7nve8sc", … ] // identifiers of the images in the desired order (required) - string(10…19)
}
{
"status" : "ok"
}
Field | Type | Description |
---|---|---|
ids | InvalidValue | Images do not belong to the same product |
ids | Malformed | '<id> ' is not an image identifier |
ids | Malformed | An image identifier is repeated |
Resizes the images to the standard sizes.
Admin SDKAdmin.api('commerce.product-images.resize', request, function(response) { … });
HTTP POST/api/v10/commerce.product-images.resize
{
"ids" : [ "281-56-f2c9636a", "281-32-a7nve8sc", … ] // identifiers of the images to resize (required) - string(10…19)
}
{
"status" : "ok"
}
Field | Type | Description |
---|---|---|
ids | Malformed | '<id> ' is not an image identifier |
ids | Malformed | An image identifier is repeated |
ids | Malformed | Are not permitted more than 100 images |