Create Canvas Template
curl --request POST \
--url https://api.example.com/canvas-templates \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"template": "<string>",
"schema": {},
"themeId": "<string>"
}
'import requests
url = "https://api.example.com/canvas-templates"
payload = {
"name": "<string>",
"template": "<string>",
"schema": {},
"themeId": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', template: '<string>', schema: {}, themeId: '<string>'})
};
fetch('https://api.example.com/canvas-templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/canvas-templates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'template' => '<string>',
'schema' => [
],
'themeId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/canvas-templates"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"template\": \"<string>\",\n \"schema\": {},\n \"themeId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/canvas-templates")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"template\": \"<string>\",\n \"schema\": {},\n \"themeId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/canvas-templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"template\": \"<string>\",\n \"schema\": {},\n \"themeId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174000",
"template": "<h1>Hello {{name}}!</h1>",
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
},
"createdAt": "2024-03-20T15:30:00.000Z",
"updatedAt": "2024-03-20T15:30:00.000Z",
"name": "Welcome Email Template"
}Canvas Template
Create Canvas Template
Create a Canvas Template.
POST
/
canvas-templates
Create Canvas Template
curl --request POST \
--url https://api.example.com/canvas-templates \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"template": "<string>",
"schema": {},
"themeId": "<string>"
}
'import requests
url = "https://api.example.com/canvas-templates"
payload = {
"name": "<string>",
"template": "<string>",
"schema": {},
"themeId": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', template: '<string>', schema: {}, themeId: '<string>'})
};
fetch('https://api.example.com/canvas-templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/canvas-templates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'template' => '<string>',
'schema' => [
],
'themeId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/canvas-templates"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"template\": \"<string>\",\n \"schema\": {},\n \"themeId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/canvas-templates")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"template\": \"<string>\",\n \"schema\": {},\n \"themeId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/canvas-templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"template\": \"<string>\",\n \"schema\": {},\n \"themeId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174000",
"template": "<h1>Hello {{name}}!</h1>",
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
},
"createdAt": "2024-03-20T15:30:00.000Z",
"updatedAt": "2024-03-20T15:30:00.000Z",
"name": "Welcome Email Template"
}Response
200 - application/json
The Canvas Template that was created.
The unique identifier of the canvas template
Example:
"123e4567-e89b-12d3-a456-426614174000"
The Handlebars template string
Example:
"<h1>Hello {{name}}!</h1>"
JSON schema defining the template variables
Example:
{
"type": "object",
"properties": { "name": { "type": "string" } }
}When the template was created
Example:
"2024-03-20T15:30:00.000Z"
When the template was last updated
Example:
"2024-03-20T15:30:00.000Z"
The name of the template
Example:
"Welcome Email Template"
⌘I