Templates

List all templates

GET /api/templates
<?xml version="1.0" encoding="UTF-8"?>
<templates type="array" page="1" per_page="100" total="2">
    <template>
        ...
    </template>
    <template>
        ...
    </template>
</templates>

The list can be filtered with parameters:

GET /api/templates?type=INVOICE

Shows all invoice templates. It doesn’t matter if you use upper– or lowercase.
The following parameters can be used:

ParameterDescription
typeDocument type of the template (INVOICE, OFFER, CONFIRMATION, REMINDER, DELIVERY_NOTE, CREDIT_NOTE, LETTER). More than one types could be given as a comma separated list. Theses types will be logically OR-connected.
template_typeType of the template (DEFINED = configured template via editor, UPLOADED = uploaded template).
is_defaultDefault template (1 = yes, 0 = no)

Show a specific template

GET /api/templates/{id}
<?xml version="1.0" encoding="UTF-8"?>
<template>
    <id type="integer">1</id>
    <created type="datetime">2007-12-13T12:12:00+01:00</created>
    <type>INVOICE</type>
    <template_type>UPLOADED</template_type>
    <name>My frist template</name>
    <format>doc</format>
    <base64file>{base64 encoded file}</base64file>
    <is_default>1</is_default>
</template>

Note: Due to performance issues, format und base64file are only available by showing a single template. Furthermore, this attributes are only returned if template_type is UPLOADED.

Create template

POST /api/templates
XML elementDescriptionTypeDefault valueMandatory
nameName of the templateALNUM
typeDocument type (INVOICE, OFFER, CONFIRMATION, REMINDER, DELIVERY_NOTE, CREDIT_NOTE, LETTER)ENUMyes
formatFormat (doc, docx or rtf)ENUM
base64filebase64 coded template fileALNUM
is_defaultSpecifies whether this is the default template (1 = yes, 0 = no)BOOL0

Note: template_type is allocated automatically. If format and base64file are transmitted, template_type gets the value UPLOADED, else it is DEFINED.

<template>
    <name>My first template</name>
    <type>INVOICE</type>
    <format>doc</format>
    <base64file>{base64 encoded file}</base64file>
</template>
<?xml version="1.0" encoding="UTF-8"?>
<template>
    <id type="integer">1234</id>
    <created type="datetime">2007-12-13T12:12:00+01:00</created>
    <type>INVOICE</type>
    <template_type>UPLOADED</template_type>
    <name>My first template</name>
    <format>doc</format>
    <base64file>{base64 encoded file}</base64file>
    <is_default>0</is_default>
</template>

Edit template

PUT /api/templates/{id}
<template>
    <name>Special template</name>
</template>

Delete template

DELETE /api/templates/{id}

Deletes a template.

Preview of a template

GET /api/templates/{id}/thumb

Returns the first page of the template.
The desired image format can be specified via the parameter format.

ParameterDescription
formatImage format (png, gif or jpg). The default format is png.