Create a new template
Create a new template with given parameters
curl --request POST \
--url https://api.kameleoon.com/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"siteId": 123,
"config": "<string>",
"cssCode": "<string>",
"description": "<string>",
"htmlCode": "<string>",
"isCustomTemplate": true,
"name": "<string>",
"tags": [
"<string>"
],
"templateCssCode": "<string>",
"templateHtmlCode": "<string>",
"templateJavaScriptCode": "<string>",
"themeId": 123,
"url": "<string>",
"useCustomData": true,
"widgetEditorTemplate": "<string>"
}
'import requests
url = "https://api.kameleoon.com/templates"
payload = {
"siteId": 123,
"config": "<string>",
"cssCode": "<string>",
"description": "<string>",
"htmlCode": "<string>",
"isCustomTemplate": True,
"name": "<string>",
"tags": ["<string>"],
"templateCssCode": "<string>",
"templateHtmlCode": "<string>",
"templateJavaScriptCode": "<string>",
"themeId": 123,
"url": "<string>",
"useCustomData": True,
"widgetEditorTemplate": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
siteId: 123,
config: '<string>',
cssCode: '<string>',
description: '<string>',
htmlCode: '<string>',
isCustomTemplate: true,
name: '<string>',
tags: ['<string>'],
templateCssCode: '<string>',
templateHtmlCode: '<string>',
templateJavaScriptCode: '<string>',
themeId: 123,
url: '<string>',
useCustomData: true,
widgetEditorTemplate: '<string>'
})
};
fetch('https://api.kameleoon.com/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.kameleoon.com/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([
'siteId' => 123,
'config' => '<string>',
'cssCode' => '<string>',
'description' => '<string>',
'htmlCode' => '<string>',
'isCustomTemplate' => true,
'name' => '<string>',
'tags' => [
'<string>'
],
'templateCssCode' => '<string>',
'templateHtmlCode' => '<string>',
'templateJavaScriptCode' => '<string>',
'themeId' => 123,
'url' => '<string>',
'useCustomData' => true,
'widgetEditorTemplate' => '<string>'
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kameleoon.com/templates"
payload := strings.NewReader("{\n \"siteId\": 123,\n \"config\": \"<string>\",\n \"cssCode\": \"<string>\",\n \"description\": \"<string>\",\n \"htmlCode\": \"<string>\",\n \"isCustomTemplate\": true,\n \"name\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"templateCssCode\": \"<string>\",\n \"templateHtmlCode\": \"<string>\",\n \"templateJavaScriptCode\": \"<string>\",\n \"themeId\": 123,\n \"url\": \"<string>\",\n \"useCustomData\": true,\n \"widgetEditorTemplate\": \"<string>\"\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))
}HttpResponse<String> response = Unirest.post("https://api.kameleoon.com/templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"siteId\": 123,\n \"config\": \"<string>\",\n \"cssCode\": \"<string>\",\n \"description\": \"<string>\",\n \"htmlCode\": \"<string>\",\n \"isCustomTemplate\": true,\n \"name\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"templateCssCode\": \"<string>\",\n \"templateHtmlCode\": \"<string>\",\n \"templateJavaScriptCode\": \"<string>\",\n \"themeId\": 123,\n \"url\": \"<string>\",\n \"useCustomData\": true,\n \"widgetEditorTemplate\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kameleoon.com/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"siteId\": 123,\n \"config\": \"<string>\",\n \"cssCode\": \"<string>\",\n \"description\": \"<string>\",\n \"htmlCode\": \"<string>\",\n \"isCustomTemplate\": true,\n \"name\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"templateCssCode\": \"<string>\",\n \"templateHtmlCode\": \"<string>\",\n \"templateJavaScriptCode\": \"<string>\",\n \"themeId\": 123,\n \"url\": \"<string>\",\n \"useCustomData\": true,\n \"widgetEditorTemplate\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"siteId": 123,
"config": "<string>",
"cssCode": "<string>",
"dateActivated": "2023-11-07T05:31:56Z",
"dateCreated": "2023-11-07T05:31:56Z",
"dateModified": "2023-11-07T05:31:56Z",
"description": "<string>",
"htmlCode": "<string>",
"id": 123,
"isCustomTemplate": true,
"name": "<string>",
"status": "DRAFT",
"tags": [
"<string>"
],
"templateCssCode": "<string>",
"templateHtmlCode": "<string>",
"templateJavaScriptCode": "<string>",
"themeId": 123,
"type": "TEMPLATE",
"url": "<string>",
"useCustomData": true,
"widgetEditorTemplate": "<string>",
"surveyDataConfig": {
"fields": [
{
"elementId": "<string>",
"id": "<string>",
"name": "<string>",
"valueType": "BOOLEAN",
"isDeprecated": true,
"parentId": "<string>"
}
],
"isCollectData": true,
"methodTypes": [
"KAMELEOON"
],
"triggerSettings": {
"type": "CLICK",
"value": "<string>"
},
"requestSettings": {
"type": "GET",
"url": "<string>",
"headers": [
{
"id": "<string>",
"name": "<string>",
"type": "CUSTOM_DATA",
"value": "<string>",
"customData": {
"method": "ADOBE_ANALYTICS",
"name": "<string>",
"siteId": 123,
"adobeAnalyticsVariableName": "<string>",
"advancedProposedValues": "<string>",
"createdById": 123,
"customEvalCode": "<string>",
"dateCreated": "2023-11-07T05:31:56Z",
"dateModified": "2023-11-07T05:31:56Z",
"description": "<string>",
"format": "BOOLEAN",
"gtmVariableName": "<string>",
"id": 123,
"index": 123,
"isConstant": true,
"isFiltrableVentilable": true,
"isLearnable": true,
"isLocalOnly": true,
"modificationDate": "2023-11-07T05:31:56Z",
"siteCode": "<string>",
"tags": "<string>",
"tcVariableName": "<string>",
"tealiumVariableName": "<string>",
"type": "COUNT_LIST"
}
}
]
}
}
}{
"code": "<string>",
"impersonator": "<string>",
"message": "<string>",
"name": "<string>",
"status": "SUCCESS",
"sub": "<string>",
"time": 123,
"timestamp": "2023-11-07T05:31:56Z"
}{
"code": "<string>",
"impersonator": "<string>",
"message": "<string>",
"name": "<string>",
"status": "SUCCESS",
"sub": "<string>",
"time": 123,
"timestamp": "2023-11-07T05:31:56Z"
}{
"code": "<string>",
"impersonator": "<string>",
"message": "<string>",
"name": "<string>",
"status": "SUCCESS",
"sub": "<string>",
"time": 123,
"timestamp": "2023-11-07T05:31:56Z"
}{
"code": "<string>",
"impersonator": "<string>",
"message": "<string>",
"name": "<string>",
"status": "SUCCESS",
"sub": "<string>",
"time": 123,
"timestamp": "2023-11-07T05:31:56Z"
}{
"code": "<string>",
"impersonator": "<string>",
"message": "<string>",
"name": "<string>",
"status": "SUCCESS",
"sub": "<string>",
"time": 123,
"timestamp": "2023-11-07T05:31:56Z"
}{
"code": "<string>",
"impersonator": "<string>",
"message": "<string>",
"name": "<string>",
"status": "SUCCESS",
"sub": "<string>",
"time": 123,
"timestamp": "2023-11-07T05:31:56Z"
}{
"code": "<string>",
"impersonator": "<string>",
"message": "<string>",
"name": "<string>",
"status": "SUCCESS",
"sub": "<string>",
"time": 123,
"timestamp": "2023-11-07T05:31:56Z"
}{
"code": "<string>",
"impersonator": "<string>",
"message": "<string>",
"name": "<string>",
"status": "SUCCESS",
"sub": "<string>",
"time": 123,
"timestamp": "2023-11-07T05:31:56Z"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Web ID of the studio template.
Widget editor configuration field linked to the translation locales field in JSON format.
CSS that belongs to this template.
Description of the template.
UI text that belongs to this template.
Indicates if this is a custom template.
Name of the template.
Template status.
DRAFT, ACTIVE, PAUSED Tags that belong to this template.
CSS code that belongs to this template.
HTML code that belongs to this template.
JavaScript code that belongs to this template.
ID of the theme linked to the widget.
Type of template.
TEMPLATE, EDITOR, PBX URL associated with this template.
Indicates if custom data is in use.
Widget editor code that belongs to this template.
Configuration settings for survey data collection.
Show child attributes
Show child attributes
Response
Created
Web ID of the studio template.
Widget editor configuration field linked to the translation locales field in JSON format.
CSS that belongs to this template.
Date of widget activation.
Date of widget creation
Date of widget modification
Description of the template.
UI text that belongs to this template.
Unique ID of the template
Indicates if this is a custom template.
Name of the template.
Template status.
DRAFT, ACTIVE, PAUSED Tags that belong to this template.
CSS code that belongs to this template.
HTML code that belongs to this template.
JavaScript code that belongs to this template.
ID of the theme linked to the widget.
Type of template.
TEMPLATE, EDITOR, PBX URL associated with this template.
Indicates if custom data is in use.
Widget editor code that belongs to this template.
Configuration settings for survey data collection.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://api.kameleoon.com/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"siteId": 123,
"config": "<string>",
"cssCode": "<string>",
"description": "<string>",
"htmlCode": "<string>",
"isCustomTemplate": true,
"name": "<string>",
"tags": [
"<string>"
],
"templateCssCode": "<string>",
"templateHtmlCode": "<string>",
"templateJavaScriptCode": "<string>",
"themeId": 123,
"url": "<string>",
"useCustomData": true,
"widgetEditorTemplate": "<string>"
}
'import requests
url = "https://api.kameleoon.com/templates"
payload = {
"siteId": 123,
"config": "<string>",
"cssCode": "<string>",
"description": "<string>",
"htmlCode": "<string>",
"isCustomTemplate": True,
"name": "<string>",
"tags": ["<string>"],
"templateCssCode": "<string>",
"templateHtmlCode": "<string>",
"templateJavaScriptCode": "<string>",
"themeId": 123,
"url": "<string>",
"useCustomData": True,
"widgetEditorTemplate": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
siteId: 123,
config: '<string>',
cssCode: '<string>',
description: '<string>',
htmlCode: '<string>',
isCustomTemplate: true,
name: '<string>',
tags: ['<string>'],
templateCssCode: '<string>',
templateHtmlCode: '<string>',
templateJavaScriptCode: '<string>',
themeId: 123,
url: '<string>',
useCustomData: true,
widgetEditorTemplate: '<string>'
})
};
fetch('https://api.kameleoon.com/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.kameleoon.com/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([
'siteId' => 123,
'config' => '<string>',
'cssCode' => '<string>',
'description' => '<string>',
'htmlCode' => '<string>',
'isCustomTemplate' => true,
'name' => '<string>',
'tags' => [
'<string>'
],
'templateCssCode' => '<string>',
'templateHtmlCode' => '<string>',
'templateJavaScriptCode' => '<string>',
'themeId' => 123,
'url' => '<string>',
'useCustomData' => true,
'widgetEditorTemplate' => '<string>'
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kameleoon.com/templates"
payload := strings.NewReader("{\n \"siteId\": 123,\n \"config\": \"<string>\",\n \"cssCode\": \"<string>\",\n \"description\": \"<string>\",\n \"htmlCode\": \"<string>\",\n \"isCustomTemplate\": true,\n \"name\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"templateCssCode\": \"<string>\",\n \"templateHtmlCode\": \"<string>\",\n \"templateJavaScriptCode\": \"<string>\",\n \"themeId\": 123,\n \"url\": \"<string>\",\n \"useCustomData\": true,\n \"widgetEditorTemplate\": \"<string>\"\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))
}HttpResponse<String> response = Unirest.post("https://api.kameleoon.com/templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"siteId\": 123,\n \"config\": \"<string>\",\n \"cssCode\": \"<string>\",\n \"description\": \"<string>\",\n \"htmlCode\": \"<string>\",\n \"isCustomTemplate\": true,\n \"name\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"templateCssCode\": \"<string>\",\n \"templateHtmlCode\": \"<string>\",\n \"templateJavaScriptCode\": \"<string>\",\n \"themeId\": 123,\n \"url\": \"<string>\",\n \"useCustomData\": true,\n \"widgetEditorTemplate\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kameleoon.com/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"siteId\": 123,\n \"config\": \"<string>\",\n \"cssCode\": \"<string>\",\n \"description\": \"<string>\",\n \"htmlCode\": \"<string>\",\n \"isCustomTemplate\": true,\n \"name\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"templateCssCode\": \"<string>\",\n \"templateHtmlCode\": \"<string>\",\n \"templateJavaScriptCode\": \"<string>\",\n \"themeId\": 123,\n \"url\": \"<string>\",\n \"useCustomData\": true,\n \"widgetEditorTemplate\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"siteId": 123,
"config": "<string>",
"cssCode": "<string>",
"dateActivated": "2023-11-07T05:31:56Z",
"dateCreated": "2023-11-07T05:31:56Z",
"dateModified": "2023-11-07T05:31:56Z",
"description": "<string>",
"htmlCode": "<string>",
"id": 123,
"isCustomTemplate": true,
"name": "<string>",
"status": "DRAFT",
"tags": [
"<string>"
],
"templateCssCode": "<string>",
"templateHtmlCode": "<string>",
"templateJavaScriptCode": "<string>",
"themeId": 123,
"type": "TEMPLATE",
"url": "<string>",
"useCustomData": true,
"widgetEditorTemplate": "<string>",
"surveyDataConfig": {
"fields": [
{
"elementId": "<string>",
"id": "<string>",
"name": "<string>",
"valueType": "BOOLEAN",
"isDeprecated": true,
"parentId": "<string>"
}
],
"isCollectData": true,
"methodTypes": [
"KAMELEOON"
],
"triggerSettings": {
"type": "CLICK",
"value": "<string>"
},
"requestSettings": {
"type": "GET",
"url": "<string>",
"headers": [
{
"id": "<string>",
"name": "<string>",
"type": "CUSTOM_DATA",
"value": "<string>",
"customData": {
"method": "ADOBE_ANALYTICS",
"name": "<string>",
"siteId": 123,
"adobeAnalyticsVariableName": "<string>",
"advancedProposedValues": "<string>",
"createdById": 123,
"customEvalCode": "<string>",
"dateCreated": "2023-11-07T05:31:56Z",
"dateModified": "2023-11-07T05:31:56Z",
"description": "<string>",
"format": "BOOLEAN",
"gtmVariableName": "<string>",
"id": 123,
"index": 123,
"isConstant": true,
"isFiltrableVentilable": true,
"isLearnable": true,
"isLocalOnly": true,
"modificationDate": "2023-11-07T05:31:56Z",
"siteCode": "<string>",
"tags": "<string>",
"tcVariableName": "<string>",
"tealiumVariableName": "<string>",
"type": "COUNT_LIST"
}
}
]
}
}
}{
"code": "<string>",
"impersonator": "<string>",
"message": "<string>",
"name": "<string>",
"status": "SUCCESS",
"sub": "<string>",
"time": 123,
"timestamp": "2023-11-07T05:31:56Z"
}{
"code": "<string>",
"impersonator": "<string>",
"message": "<string>",
"name": "<string>",
"status": "SUCCESS",
"sub": "<string>",
"time": 123,
"timestamp": "2023-11-07T05:31:56Z"
}{
"code": "<string>",
"impersonator": "<string>",
"message": "<string>",
"name": "<string>",
"status": "SUCCESS",
"sub": "<string>",
"time": 123,
"timestamp": "2023-11-07T05:31:56Z"
}{
"code": "<string>",
"impersonator": "<string>",
"message": "<string>",
"name": "<string>",
"status": "SUCCESS",
"sub": "<string>",
"time": 123,
"timestamp": "2023-11-07T05:31:56Z"
}{
"code": "<string>",
"impersonator": "<string>",
"message": "<string>",
"name": "<string>",
"status": "SUCCESS",
"sub": "<string>",
"time": 123,
"timestamp": "2023-11-07T05:31:56Z"
}{
"code": "<string>",
"impersonator": "<string>",
"message": "<string>",
"name": "<string>",
"status": "SUCCESS",
"sub": "<string>",
"time": 123,
"timestamp": "2023-11-07T05:31:56Z"
}{
"code": "<string>",
"impersonator": "<string>",
"message": "<string>",
"name": "<string>",
"status": "SUCCESS",
"sub": "<string>",
"time": 123,
"timestamp": "2023-11-07T05:31:56Z"
}{
"code": "<string>",
"impersonator": "<string>",
"message": "<string>",
"name": "<string>",
"status": "SUCCESS",
"sub": "<string>",
"time": 123,
"timestamp": "2023-11-07T05:31:56Z"
}