Skip to content

Adding modifications

Once you have the template ready, you can render copies or modified versions of it.

Modifiable objects

All objects listed in the API Reference are modifieable.

You can supply a list of modifications using the Modification object.

Modification object

The modification object is used to identify the canvas element that will be modified with the new value provided.

Attributes

Name Type Description
name str Search the template for this element by name.
attribute str Attribute to modify (See API Reference for full list of object attributes).
value Any[str,int,float] Set the new value for the attribute.

Identifying design elements

You must provide either the name parameter in order to identify the canvas element. Names are displayed in the Elements modal:

Where to find names of nodes

In the example above, the names are: device_name and text_1.

Multiple modifications

When rendering a template, you might want to provide multiple modifications at once. Our API expects a list of modifications to be provided (List[Modification]).

Validation

We will validate the value of Modification, according to the object attribute that you are trying to modify.

Please refer to the API reference to see the type of value attribute that is accepted by the object.

Example: Device modification

For example, if you are modifying a Device to display a different image, you would need to change the image attribute, where the value needs to be a valid URL string:

{
    "name": "device_name",
    "attribute": "screenshot",
    "value": "https://example.com/path-to-image.png"
}

Example: Text modification

If you are modifying a Text object, the modification object would expect a valid string:

{
    "name": "text_1",
    "attribute": "text",
    "value": "New text value"
}
Back to top