Templates

get
Get Templates By Project

https://app.fuchsiacms.com/api/templates/project/:projectId
This endpoint allows you to query templates by in a project
Request
Response
Request
Path Parameters
projectId
required
string
The ID of the project
Query Parameters
skip
optional
integer
How many templates to skip in response. Used with take query parameter to create pagination. Default: 0
take
optional
integer
How many templates to return. Default: 20
search
optional
string
Filter templates by their name
includeDrafts
optional
boolean
If set to true, will return unpublished templates. Default: false
key
required
string
The project API key
Response
200: OK
List of templates
[
{
id: "string",
projectId: "string",
name: "string",
published: "boolean",
template: "string",
requiredVars: ["string"],
createdAt: "int64",
updatedAt: "int64"
}
]
400: Bad Request
Malformed Request
"message"
401: Unauthorized
Invalid API key
"Invalid API key"

get
Get Template

https://app.fuchsiacms.com/api/templates/template/:templateId
Get one Template object
Request
Response
Request
Path Parameters
templateId
required
string
The ID of the template
Query Parameters
key
required
string
The project API key
Response
200: OK
One Template Object
{
id: "string",
projectId: "string",
name: "string",
published: "boolean",
template: "string",
requiredVars: ["string"],
createdAt: "int64",
updatedAt: "int64"
}
400: Bad Request
Malformed Request
"message"
401: Unauthorized
Invalid API key
"Invalid API key"

get
Run Template

https://app.fuchsiacms.com/api/templates/template/:templateId/run
Render a template into static HTML. Inject live records into it.
Request
Response
Request
Path Parameters
templateId
required
string
The ID of the template to render
Query Parameters
includes
optional
array
Records to load into the template with their aliases. Ex: ?includes[<id>]=Person. <-- Person will be available within the template if it's a required variable.
key
required
string
The project API key
Response
200: OK
Returns the static HTML of the template with the injected record data.
<div>Your rendered template here</div>
400: Bad Request
Malformed request
"message"
401: Unauthorized
Invalid API key
"Invalid API key"

post
Create Template

https://app.fuchsiacms.com/api/templates/template
Create a Template object
Request
Response
Request
Query Parameters
key
required
string
The project API key
Body Parameters
requiredVars
optional
array
List of strings of required variables that the template expects to have injected at runtime.
template
required
string
The actual HTML template
published
required
boolean
If the template is published right away or not.
name
required
string
The display name of the Template
Response
200: OK
The new template object
{
id: "string",
projectId: "string",
name: "string",
published: "boolean",
template: "string",
requiredVars: ["string"],
createdAt: "int64",
updatedAt: "int64"
}
400: Bad Request
Malformed request
"message"
401: Unauthorized
Invalid API key
"Invalid API key"

patch
Modify Template

https://app.fuchsiacms.com/api/templates/template
Change a template object
Request
Response
Request
Query Parameters
key
required
string
The project API key
Body Parameters
requiredVars
optional
array
List of strings of variables that the template expects to be injected at runtime.
template
required
string
The actual HTML template
published
required
boolean
If the template should be published
name
required
string
The display name of the template
id
required
string
The ID of the template
Response
200: OK
The count of modified template objects
1
400: Bad Request
Malformed Request
"message"
401: Unauthorized
Invalid API key
"Invalid API key"

delete
Delete Template

https://app.fuchsiacms.com/api/templates/template/:templateId
Delete a template. Warning: This is a destructive operation that is unrecoverable.
Request
Response
Request
Path Parameters
templateId
required
string
The ID of the template to delete
Query Parameters
key
required
string
The project API key
Response
200: OK
The ID of the successfully deleted template
"<Template ID>"
400: Bad Request
Malformed Request
"message"
401: Unauthorized
Invalid API key
"Invalid API key"