Introduction
ImageTemplate Model
Example
{
"width": 600,
"height": 800,
"background_url": "https://cdn-files.placewise.com/files/uuUHXAoLdRIX3Am4SHaR1iGyv8yK6-G_a845txA7HUqYhETqgo9",
"rectangles": [], // List of rectangles - see 'ImageTemplate Rectangle'
}
Definition
Attribute | Type | Description |
---|---|---|
width | integer | Defines width of the image in pixels, between 1 and 2000 |
height | integer | Defines height of the image in pixels, between 1 and 2000 |
background_url | string | URL of background image. |
rectangles | TemplateRectangle[] | See ImageTemplate Rectangle |
ImageTemplate Record
ImageTemplate
model (see above) for re-usage. Managed with ImageTemplates API.Example
{
"id": 2,
"name": "Majadada3",
"width": 600,
"height": 800,
"background_url": "https://cdn-files.placewise.com/files/uuUHXAoLdRIX3Am4SHaR1iGyv8yK6-G_a845txA7HUqYhETqgo9",
"default": false,
"rectangles": [], // List of rectangles - see 'ImageTemplate Rectangle'
"created_at": "2020-09-04T14:55:44.385Z",
"updated_at": "2020-09-04T14:55:44.385Z"
}
Definition
Attribute | Type | Description |
---|---|---|
id | integer | |
name | string | |
width | integer | Part of ImageTemplate model |
height | integer | Part of ImageTemplate model |
background_url | string | Part of ImageTemplate model. See below. |
rectangles | TemplateRectangle[] | Part of ImageTemplate model |
default | boolean | See below |
created_at | Date | When template has been created |
updated_at | Date | Last time the template has been updated |
background_url
attribute
offer_template_background
and with identifier of givenImageTemplate
record.default
attribute
ImageTemplate payload
Example
{
"name": "Majadada3",
"width": 600,
"height": 800,
"default": false,
"rectangles": [] // List of rectangles - see 'ImageTemplate Rectangle'
}
Definition
Attribute | Type | Required? | Comment |
---|---|---|---|
name | string | yes | See ImageTemplate record |
default | boolean | no | See ImageTemplate record |
width | string | yes | See ImageTemplate model |
height | string | yes | See ImageTemplate model |
rectangles | TemplateRectangle[] | yes | See ImageTemplate model |
ImageTemplate Rectangle
Example
{
"name": "Title",
"width": 100,
"height": 200,
"padding": 5,
"offset_top": 5,
"offset_left": 15,
"text_align": "center",
"color": "#FF00FF",
"font_size": 15,
"font_family": "'Playfair Display', serif",
"font_url": "https://fonts.googleapis.com/css?family=Raleway:400,700&display=swap",
"content": "{{stores}}",
"background_url": "https://cdn-files.placewise.com/files/uuUHXAoLdRIX3Am4SHaR1iGyv8yK6-G_a845txA7HUqYhETqgo9"
}
Definition
Key | Type | Required? | Description |
---|---|---|---|
number | integer | yes | Number of the rectangle. Must be unique. |
name | string | yes | Identifier of rectangle for user |
width | integer | yes | Width of rendered rectangle |
height | integer | yes | Height of rendered rectangle |
padding | integer | yes | Padding inside of rendered rectangle |
offset_left | integer | yes | x position relative to the top left corner of image |
offset_top | integer | yes | y position relative to the top left corner of image |
text_align | enum: ['left', 'center', 'right'] | yes | Text alignment inside the rectangle |
text_decoration | enum: ['none', 'underline', 'overline', 'line-through'] | no | Default: 'none' |
color | hex (e.g. '#FF00EE' ) | yes | Color of the rectangle text |
font_size | integer | yes | Font size of the rectangle text |
font_family | string | yes | Family definition, related to included font_url |
font_url | URL | yes | URL of font face |
font_style | enum: ['normal', 'italic', 'oblique'] | no | Default: 'normal' |
font_weight | enum: ['normal', 'bold', 'bolder', 'lighter'] | no | Default: 'normal' |
content | string | no | Content to display, may contain merge fields |
background_url | string | no | Background of the rectangle. See below. |
background_url
attribute
offer_template_rectangle_background
."<image_template_id>:<number>"
.For example, ImageTemplate with id
1441
and with two rectangles with numbers 1
and 2
may have following backgroundson its rectangles:
"1441:1"
, "1441:2"
.ImageTemplate Merge-fields
Merge field | Description |
---|---|
{{name}} | Injects name of offer |
{{description}} | Injects description of offer |
{{collection}} | Injects name of first collection assigned to offer |
{{stores}} | When only one store is assigned to offer, injects it as it is. When more, it injects stores joined with comma |