Stored templates
GET /v1/aliases
Section titled “GET /v1/aliases”Lists this caller’s aliases by name, each with the template it names now.
Needs credentials, if any are configured.
Parameters
Section titled “Parameters”| Name | In | Required | Description |
|---|---|---|---|
limit |
query | No | How many to return, up to 200. Default 50. |
cursor |
query | No | nextCursor from the page before. |
Responses
Section titled “Responses”| Status | Meaning | Body |
|---|---|---|
| 200 | A page of aliases | AliasList |
| 501 | RUSTICDOC_STORE is not set | ErrorBody |
| 503 | The store cannot be reached | ErrorBody |
GET /v1/aliases/{name}
Section titled “GET /v1/aliases/{name}”An alias, the template it names now, and its history: every version since it was last deleted, oldest first.
Needs credentials, if any are configured.
Parameters
Section titled “Parameters”| Name | In | Required | Description |
|---|---|---|---|
name |
path | Yes | The alias |
Responses
Section titled “Responses”| Status | Meaning | Body |
|---|---|---|
| 200 | The alias and its versions | AliasHistorySchema |
| 404 | This caller has no such alias | ErrorBody |
| 501 | RUSTICDOC_STORE is not set | ErrorBody |
| 503 | The store cannot be reached | ErrorBody |
PUT /v1/aliases/{name}
Section titled “PUT /v1/aliases/{name}”Points an alias at a template. A new alias starts at version 1; pointing an existing one elsewhere adds a version, and the earlier ones stay. Every replica sees the change at once.
Needs credentials, if any are configured.
Parameters
Section titled “Parameters”| Name | In | Required | Description |
|---|---|---|---|
name |
path | Yes | The alias, such as invoice |
Request
Section titled “Request”application/json
| Field | Type | Required | Description |
|---|---|---|---|
templateId |
string | Yes | The template the alias names from now on: an id, or another alias. |
Responses
Section titled “Responses”| Status | Meaning | Body |
|---|---|---|
| 200 | A new version of an alias | AliasSchema |
| 201 | A new alias | AliasSchema |
| 400 | Not a usable name, or no template named | ErrorBody |
| 403 | Too many aliases, or versions of this one | ErrorBody |
| 404 | This caller has no such template | ErrorBody |
| 501 | RUSTICDOC_STORE is not set | ErrorBody |
| 503 | The store cannot be reached | ErrorBody |
DELETE /v1/aliases/{name}
Section titled “DELETE /v1/aliases/{name}”Deletes an alias and its history. The templates it named stay. Setting it again starts at version 1.
Needs credentials, if any are configured.
Parameters
Section titled “Parameters”| Name | In | Required | Description |
|---|---|---|---|
name |
path | Yes | The alias |
Responses
Section titled “Responses”| Status | Meaning | Body |
|---|---|---|
| 204 | Deleted | |
| 404 | This caller has no such alias | ErrorBody |
| 501 | RUSTICDOC_STORE is not set | ErrorBody |
| 503 | The store cannot be reached | ErrorBody |
GET /v1/templates
Section titled “GET /v1/templates”Lists this caller’s templates, oldest first.
Needs credentials, if any are configured.
Parameters
Section titled “Parameters”| Name | In | Required | Description |
|---|---|---|---|
limit |
query | No | How many to return, up to 200. Default 50. |
cursor |
query | No | nextCursor from the page before. |
Responses
Section titled “Responses”| Status | Meaning | Body |
|---|---|---|
| 200 | A page of templates | TemplateList |
| 501 | RUSTICDOC_STORE is not set | ErrorBody |
| 503 | The store cannot be reached | ErrorBody |
POST /v1/templates
Section titled “POST /v1/templates”Stores a template and returns its id. Syntax is checked now, without data, so a broken template is refused here rather than at its first render. The content never changes: to change a template, store the new one and use its id.
Needs credentials, if any are configured.
Request
Section titled “Request”multipart/form-data
| Field | Type | Required | Description |
|---|---|---|---|
template |
file | Yes | The template: DOCX, XLSX, PPTX, ODT, ODS, ODP, PDF or a text format. |
name |
string | No | A name for it, in place of the file’s. The extension stays the file’s. |
Responses
Section titled “Responses”| Status | Meaning | Body |
|---|---|---|
| 201 | Stored | TemplateSchema |
| 400 | Not a template format | ErrorBody |
| 403 | This caller’s quota is used up | ErrorBody |
| 413 | Too large | ErrorBody |
| 422 | The template has syntax errors | ErrorBody |
| 501 | RUSTICDOC_STORE is not set | ErrorBody |
| 503 | The store cannot be reached | ErrorBody |
GET /v1/templates/{id}
Section titled “GET /v1/templates/{id}”One template’s details.
Needs credentials, if any are configured.
Parameters
Section titled “Parameters”| Name | In | Required | Description |
|---|---|---|---|
id |
path | Yes | The template’s id, or an alias as name or name@version |
Responses
Section titled “Responses”| Status | Meaning | Body |
|---|---|---|
| 200 | The template | TemplateSchema |
| 404 | This caller has no such template | ErrorBody |
| 501 | RUSTICDOC_STORE is not set | ErrorBody |
| 503 | The store cannot be reached | ErrorBody |
DELETE /v1/templates/{id}
Section titled “DELETE /v1/templates/{id}”Deletes a template. Every replica stops serving it at once.
Needs credentials, if any are configured.
Parameters
Section titled “Parameters”| Name | In | Required | Description |
|---|---|---|---|
id |
path | Yes | The template’s id |
Responses
Section titled “Responses”| Status | Meaning | Body |
|---|---|---|
| 204 | Deleted | |
| 404 | This caller has no such template | ErrorBody |
| 501 | RUSTICDOC_STORE is not set | ErrorBody |
| 503 | The store cannot be reached | ErrorBody |
GET /v1/templates/{id}/content
Section titled “GET /v1/templates/{id}/content”Downloads a template as it was uploaded.
Needs credentials, if any are configured.
Parameters
Section titled “Parameters”| Name | In | Required | Description |
|---|---|---|---|
id |
path | Yes | The template’s id, or an alias as name or name@version |
Responses
Section titled “Responses”| Status | Meaning | Body |
|---|---|---|
| 200 | The file | File |
| 404 | This caller has no such template | ErrorBody |
| 501 | RUSTICDOC_STORE is not set | ErrorBody |
| 503 | The store cannot be reached | ErrorBody |
POST /v1/templates/{id}/preview
Section titled “POST /v1/templates/{id}/preview”Renders a stored template with sample data and draws one page as a PNG,
for checking a template without opening the document. Office templates
convert with LibreOffice, HTML with its HTML engine, and PDF forms are filled;
poppler’s pdftoppm draws the page. The page count is in X-Page-Count.
Needs credentials, if any are configured.
Parameters
Section titled “Parameters”| Name | In | Required | Description |
|---|---|---|---|
id |
path | Yes | The template’s id, or an alias as name or name@version |
Request
Section titled “Request”application/json
| Field | Type | Required | Description |
|---|---|---|---|
ctx |
JSON | No | Visible as ctx. |
data |
JSON | No | Sample data the template sees as its root. |
dpi |
integer | No | Draw at this resolution, from 18 to 300, as large as the page is. An image may not pass 4000 pixels on a side. |
htmlEngine |
string | No | What turns HTML into PDF: fulgur (default) or libreoffice. |
page |
integer | No | The page to draw, from 1. Default 1. |
width |
integer | No | The image’s width in pixels, from 16 to 2000; the height follows the page. Default 800. Send this or dpi. |
Responses
Section titled “Responses”| Status | Meaning | Body |
|---|---|---|
| 200 | The page as a PNG | File |
| 400 | The request is wrong, or the page does not exist | ErrorBody |
| 404 | This caller has no such template | ErrorBody |
| 422 | The template failed to render | ErrorBody |
| 501 | RUSTICDOC_STORE is not set | ErrorBody |
| 503 | pdftoppm or LibreOffice is unavailable, or the request timed out | ErrorBody |
GET /v1/templates/{id}/variables
Section titled “GET /v1/templates/{id}/variables”Lists the data a template reads: each path, which paths are arrays it loops
over, and the fields it reads from their items, with a skeleton of data.
Read from the template’s tags, so a path built at render time, such as
row[column], is listed only as far as it is written.
Needs credentials, if any are configured.
Parameters
Section titled “Parameters”| Name | In | Required | Description |
|---|---|---|---|
id |
path | Yes | The template’s id, or an alias as name or name@version |
Responses
Section titled “Responses”| Status | Meaning | Body |
|---|---|---|
| 200 | What the template reads | TemplateVariables |
| 404 | This caller has no such template | ErrorBody |
| 422 | The template has syntax errors | ErrorBody |
| 501 | RUSTICDOC_STORE is not set | ErrorBody |
| 503 | The store cannot be reached | ErrorBody |