Promotional
Plantilla llamativa para promociones de productos, ventas flash y campañas de e-commerce.
Dimensiones: 1200x630
Template ID: promotional
Propiedades
| Propiedad | Tipo | Requerido | Long. Máxima | Validación |
|---|---|---|---|---|
productNameNombre del producto | string | Sí | 60 | maxLength(60) |
discountEtiqueta de descuento | string | Sí | 20 | maxLength(20) |
originalPricePrecio original | string | Sí | 20 | maxLength(20) |
salePricePrecio de oferta | string | Sí | 20 | maxLength(20) |
imageUrlURL de la imagen del producto | string (URL) | Sí | - | url (HTTPS only) |
primaryColorColor principal | string (hex) | Sí | - | color (hex) |
accentColorColor de acento | string (hex) | Sí | - | color (hex) |
Ejemplo
{
"template": "promotional",
"productName": "Premium Wireless Headphones",
"discount": "50% OFF",
"originalPrice": "$199.99",
"salePrice": "$99.99",
"imageUrl": "https://example.com/product.jpg",
"primaryColor": "#ff3366",
"accentColor": "#ffd23f"
}Ejemplos de código
const response = await fetch("https://assets.qbacode.com/api/v1/generate-asset", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"template": "promotional",
"productName": "Premium Wireless Headphones",
"discount": "50% OFF",
"originalPrice": "$199.99",
"salePrice": "$99.99",
"imageUrl": "https://example.com/product.jpg",
"primaryColor": "#ff3366",
"accentColor": "#ffd23f"
})
});
if (response.ok) {
const blob = await response.blob();
const imageUrl = URL.createObjectURL(blob);
document.getElementById("preview").src = imageUrl;
} else {
const error = await response.json();
console.error("Error:", error);
}