Create a message-template draft
curl --request POST \
--url https://api.polymorfa.com/v1/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"definition": {},
"draftId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sampleValues": {}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
projectId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
definition: {},
draftId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
sampleValues: {}
})
};
fetch('https://api.polymorfa.com/v1/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/v1/templates"
payload = {
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"definition": {},
"draftId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sampleValues": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.polymorfa.com/v1/templates"
payload := strings.NewReader("{\n \"projectId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"definition\": {},\n \"draftId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"sampleValues\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.polymorfa.com/v1/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([
'projectId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'definition' => [
],
'draftId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'sampleValues' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}templates
Create a message-template draft
Creates an incomplete or complete message-template draft in one project.
Requires a verified dashboard bearer and current organization authorization. The signed-in member must be an organization owner or admin. Organization keys and project tokens are not accepted.
POST
/
v1
/
templates
Create a message-template draft
curl --request POST \
--url https://api.polymorfa.com/v1/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"definition": {},
"draftId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sampleValues": {}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
projectId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
definition: {},
draftId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
sampleValues: {}
})
};
fetch('https://api.polymorfa.com/v1/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/v1/templates"
payload = {
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"definition": {},
"draftId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sampleValues": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.polymorfa.com/v1/templates"
payload := strings.NewReader("{\n \"projectId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"definition\": {},\n \"draftId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"sampleValues\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.polymorfa.com/v1/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([
'projectId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'definition' => [
],
'draftId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'sampleValues' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Authorizations
Verified dashboard JWT for signed-in Console requests. This is not a server credential.
Body
application/json
Project UUID. Optional where an operation can infer or search organization scope; required where the operation creates a project-owned resource.
Required string length:
1 - 512Message-template draft UUID.
Show child attributes
Show child attributes
Response
Success
Message-template draft UUID.