Templates
This interface provides customization of Voog ecommerce customer e-mails and PDF invoices via templates. A template is a Liquid-enhanced HTML document receiving information about the store and relevant order. If a template is missing or disabled, a built-in default is used.
Summary of template endpoints
- GET /admin/api/ecommerce/v1/templates - list all templates.
- GET /admin/api/ecommerce/v1/templates/1 - list attributes of a template.
- POST /admin/api/ecommerce/v1/templates - create a new template.
- PUT /admin/api/ecommerce/v1/templates/1 - update attributes of a template.
- DELETE /admin/api/ecommerce/v1/templates/1 - remove a template.
List all templates for the current site
Get list of templates.
GET /admin/api/ecommerce/v1/templates
Example response:
Status: 200 OK
[
{
"id": 1,
"enabled": true,
"content_type": "customer_invoice",
"component_name": null,
"subject": null,
"content": "<html><head></head><body>PDF invoice</body></html>",
"created_at": "2020-11-17T14:30:09.000Z",
"updated_at": "2020-11-17T14:30:09.000Z"
},
{
"id": 2,
"enabled": true,
"content_type": "customer_payment_notification",
"component_name": null,
"subject": "Payment notification",
"content": "<html><head></head><body>Payment notification</body></html>",
"created_at": "2020-11-17T14:31:09.000Z",
"updated_at": "2020-11-17T14:31:09.000Z"
}
]
Filter attributes
Read more about filters.
- Object
template
attributes:id
,enabled
,content_type
,component_name
,subject
,content
,created_at
,updated_at
.
List attributes of a template
GET /admin/api/ecommerce/v1/templates/1
Example request:
GET http://helloworld.voog.com/admin/api/ecommerce/v1/templates/1
Example response:
Status: 200 OK
{
"id": 1,
"enabled": true,
"content_type": "customer_invoice",
"component_name": null,
"subject": null,
"content": "<html><head></head><body>PDF invoice</body></html>",
"created_at": "2020-11-17T14:30:09.000Z",
"updated_at": "2020-11-17T14:30:09.000Z"
}
Create a new template for the current site
POST /admin/api/ecommerce/v1/templates
Example data:
{
"enabled": true,
"content_type": "component",
"component_name": "html_head",
"subject": null,
"content": "<head><style>.some-class { background: red; }</style></head>"
}
Example response:
Status: 201 Created
{
"id": 3,
"enabled": true,
"content_type": "component",
"component_name": "html_head",
"subject": null,
"content": "<head><style>.some-class { background: red; }</style></head>",
"created_at": "2020-11-17T14:30:09.000Z",
"updated_at": "2020-11-17T14:30:09.000Z"
}
Parameters
enabled
— Flag switching the template on or off,true
by default.content_type
— Template's content type, one ofcustomer_invoice
(PDF invoice),customer_payment_notification
(payment reception notification e-mail),customer_payment_status_notification
(offline invoice payment reception notification e-mail),customer_offline_invoice_notification
(offline invoice notification e-mail) orcomponent
(a code snippet that may be included in other templates).component_name
— Ifcontent_type
iscomponent
, a unique name identifying the component.subject
— If the template specifies an e-mail (i.e.content_type
other thancustomer_invoice
orcomponent
), the e-mail's subject line. Supports Liquid. If blank, a built-in default for the content type is used.content
— Liquid-enhanced HTML content of the template or component. If blank, a built-in default for the content type is used.
Update attributes of a template
PUT /admin/api/ecommerce/v1/templates/3
This request updates the template with the provided attributes.
Example request:
PUT http://helloworld.voog.com/admin/api/ecommerce/v1/templates/3
Example data:
{
"enabled": true,
"content_type": "component",
"component_name": "html_head",
"subject": null,
"content": "<head><style>.some-class { background: red; }</style></head>"
}
Example response:
Status: 200 OK
{
"id": 3,
"enabled": true,
"content_type": "component",
"component_name": "html_head",
"subject": null,
"content": "<head><style>.some-class { background: red; }</style></head>",
"created_at": "2020-11-17T14:30:09.000Z",
"updated_at": "2020-11-17T14:31:09.000Z"
}
Parameters
enabled
— Flag switching the template on or off,true
by default.content_type
— Template's content type, one ofcustomer_invoice
(PDF invoice),customer_payment_notification
(payment reception notification e-mail),customer_payment_status_notification
(offline invoice payment reception notification e-mail),customer_offline_invoice_notification
(offline invoice notification e-mail) orcomponent
(a code snippet that may be included in other templates).component_name
— Ifcontent_type
iscomponent
, a unique name identifying the component.subject
— If the template specifies an e-mail (i.e.content_type
other thancustomer_invoice
orcomponent
), the e-mail's subject line. Supports Liquid. If blank, a built-in default for the content type is used.content
— Liquid-enhanced HTML content of the template or component. If blank, a built-in default for the content type is used.
Remove a template
DELETE /admin/api/ecommerce/v1/templates/1
This request deletes the given template.
Example request:
DELETE http://helloworld.voog.com/admin/api/ecommerce/v1/templates/1
Example response:
Status: 204 No Content