Key moment
Create a new key moment
Create a new key moment with the given parameters. Please note that the Kameleoon app has now renamed keyMoment to Triggers.
POST
/
key-moments
Create a new key moment
curl --request POST \
--url https://api.kameleoon.com/key-moments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "My Key Moment",
"siteId": 8372,
"audienceTracking": true,
"conditionDataList": [
{
"id": 123,
"parentId": 123,
"targetingCondition": {
"weight": 1,
"count": 123,
"include": true
}
}
],
"conditionDataTree": {
"targetingType": "<string>"
},
"conditionsData": {
"firstLevel": [
{
"conditions": [
{
"weight": 1,
"count": 123,
"include": true
}
],
"orOperators": [
true
]
}
],
"firstLevelOrOperators": [
true
]
},
"description": "The key moment is for new A/B tests",
"isFavorite": true,
"userVisible": true
}
'import requests
url = "https://api.kameleoon.com/key-moments"
payload = {
"name": "My Key Moment",
"siteId": 8372,
"audienceTracking": True,
"conditionDataList": [
{
"id": 123,
"parentId": 123,
"targetingCondition": {
"weight": 1,
"count": 123,
"include": True
}
}
],
"conditionDataTree": { "targetingType": "<string>" },
"conditionsData": {
"firstLevel": [
{
"conditions": [
{
"weight": 1,
"count": 123,
"include": True
}
],
"orOperators": [True]
}
],
"firstLevelOrOperators": [True]
},
"description": "The key moment is for new A/B tests",
"isFavorite": True,
"userVisible": True
}
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({
name: 'My Key Moment',
siteId: 8372,
audienceTracking: true,
conditionDataList: [
{
id: 123,
parentId: 123,
targetingCondition: {weight: 1, count: 123, include: true}
}
],
conditionDataTree: {targetingType: '<string>'},
conditionsData: {
firstLevel: [{conditions: [{weight: 1, count: 123, include: true}], orOperators: [true]}],
firstLevelOrOperators: [true]
},
description: 'The key moment is for new A/B tests',
isFavorite: true,
userVisible: true
})
};
fetch('https://api.kameleoon.com/key-moments', 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/key-moments",
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' => 'My Key Moment',
'siteId' => 8372,
'audienceTracking' => true,
'conditionDataList' => [
[
'id' => 123,
'parentId' => 123,
'targetingCondition' => [
'weight' => 1,
'count' => 123,
'include' => true
]
]
],
'conditionDataTree' => [
'targetingType' => '<string>'
],
'conditionsData' => [
'firstLevel' => [
[
'conditions' => [
[
'weight' => 1,
'count' => 123,
'include' => true
]
],
'orOperators' => [
true
]
]
],
'firstLevelOrOperators' => [
true
]
],
'description' => 'The key moment is for new A/B tests',
'isFavorite' => true,
'userVisible' => true
]),
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/key-moments"
payload := strings.NewReader("{\n \"name\": \"My Key Moment\",\n \"siteId\": 8372,\n \"audienceTracking\": true,\n \"conditionDataList\": [\n {\n \"id\": 123,\n \"parentId\": 123,\n \"targetingCondition\": {\n \"weight\": 1,\n \"count\": 123,\n \"include\": true\n }\n }\n ],\n \"conditionDataTree\": {\n \"targetingType\": \"<string>\"\n },\n \"conditionsData\": {\n \"firstLevel\": [\n {\n \"conditions\": [\n {\n \"weight\": 1,\n \"count\": 123,\n \"include\": true\n }\n ],\n \"orOperators\": [\n true\n ]\n }\n ],\n \"firstLevelOrOperators\": [\n true\n ]\n },\n \"description\": \"The key moment is for new A/B tests\",\n \"isFavorite\": true,\n \"userVisible\": true\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/key-moments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My Key Moment\",\n \"siteId\": 8372,\n \"audienceTracking\": true,\n \"conditionDataList\": [\n {\n \"id\": 123,\n \"parentId\": 123,\n \"targetingCondition\": {\n \"weight\": 1,\n \"count\": 123,\n \"include\": true\n }\n }\n ],\n \"conditionDataTree\": {\n \"targetingType\": \"<string>\"\n },\n \"conditionsData\": {\n \"firstLevel\": [\n {\n \"conditions\": [\n {\n \"weight\": 1,\n \"count\": 123,\n \"include\": true\n }\n ],\n \"orOperators\": [\n true\n ]\n }\n ],\n \"firstLevelOrOperators\": [\n true\n ]\n },\n \"description\": \"The key moment is for new A/B tests\",\n \"isFavorite\": true,\n \"userVisible\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kameleoon.com/key-moments")
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 \"name\": \"My Key Moment\",\n \"siteId\": 8372,\n \"audienceTracking\": true,\n \"conditionDataList\": [\n {\n \"id\": 123,\n \"parentId\": 123,\n \"targetingCondition\": {\n \"weight\": 1,\n \"count\": 123,\n \"include\": true\n }\n }\n ],\n \"conditionDataTree\": {\n \"targetingType\": \"<string>\"\n },\n \"conditionsData\": {\n \"firstLevel\": [\n {\n \"conditions\": [\n {\n \"weight\": 1,\n \"count\": 123,\n \"include\": true\n }\n ],\n \"orOperators\": [\n true\n ]\n }\n ],\n \"firstLevelOrOperators\": [\n true\n ]\n },\n \"description\": \"The key moment is for new A/B tests\",\n \"isFavorite\": true,\n \"userVisible\": true\n}"
response = http.request(request)
puts response.read_body{
"name": "My Key Moment",
"siteId": 8372,
"audienceTracking": true,
"audienceTrackingEditable": true,
"campaignType": "ALL",
"conditionDataList": [
{
"id": 123,
"isConditionBlock": true,
"logicalOperator": "AND",
"parentId": 123,
"targetingCondition": {
"targetingType": "PAGE_URL",
"weight": 1,
"count": 123,
"include": true,
"matchType": "EQUAL",
"unitOfTime": "SECOND",
"htmlDescription": "<string>",
"id": 123
}
}
],
"conditionDataTree": {
"targetingType": "<string>",
"conditionData": [
{
"targetingType": "PAGE_URL",
"weight": 1,
"htmlDescription": "<string>",
"id": 123
}
],
"isConditionBlock": true,
"logicalOperator": "AND"
},
"conditionsData": {
"firstLevel": [
{
"conditions": [
{
"targetingType": "PAGE_URL",
"weight": 1,
"count": 123,
"include": true,
"matchType": "EQUAL",
"unitOfTime": "SECOND",
"htmlDescription": "<string>",
"id": 123
}
],
"orOperators": [
true
]
}
],
"firstLevelOrOperators": [
true
]
},
"createdBy": 123,
"dateCreated": "2023-11-07T05:31:56Z",
"dateModified": "2023-11-07T05:31:56Z",
"description": "The key moment is for new A/B tests",
"id": 123,
"isFavorite": true,
"links": [
{
"domainId": 123,
"domainStatus": "<string>",
"domainType": "EXPERIMENT",
"linkRole": "MAIN",
"linkType": "DIRECT"
}
],
"userVisible": true
}{
"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
Body
application/json
Conditions upon which the key moment includes visitors in tree form
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
- Option 17
- Option 18
- Option 19
- Option 20
- Option 21
- Option 22
- Option 23
- Option 24
- Option 25
- Option 26
- Option 27
- Option 28
- Option 29
- Option 30
- Option 31
- Option 32
- Option 33
- Option 34
- Option 35
- Option 36
- Option 37
- Option 38
- Option 39
- Option 40
- Option 41
- Option 42
- Option 43
- Option 44
- Option 45
- Option 46
- Option 47
- Option 48
- Option 49
- Option 50
- Option 51
- Option 52
- Option 53
- Option 54
- Option 55
- Option 56
- Option 57
- Option 58
- Option 59
- Option 60
- Option 61
- Option 62
Show child attributes
Show child attributes
Response
Created
Conditions upon which the key moment includes visitors in tree form
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
- Option 17
- Option 18
- Option 19
- Option 20
- Option 21
- Option 22
- Option 23
- Option 24
- Option 25
- Option 26
- Option 27
- Option 28
- Option 29
- Option 30
- Option 31
- Option 32
- Option 33
- Option 34
- Option 35
- Option 36
- Option 37
- Option 38
- Option 39
- Option 40
- Option 41
- Option 42
- Option 43
- Option 44
- Option 45
- Option 46
- Option 47
- Option 48
- Option 49
- Option 50
- Option 51
- Option 52
- Option 53
- Option 54
- Option 55
- Option 56
- Option 57
- Option 58
- Option 59
- Option 60
- Option 61
- Option 62
Show child attributes
Show child attributes
Was this page helpful?
⌘I
Create a new key moment
curl --request POST \
--url https://api.kameleoon.com/key-moments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "My Key Moment",
"siteId": 8372,
"audienceTracking": true,
"conditionDataList": [
{
"id": 123,
"parentId": 123,
"targetingCondition": {
"weight": 1,
"count": 123,
"include": true
}
}
],
"conditionDataTree": {
"targetingType": "<string>"
},
"conditionsData": {
"firstLevel": [
{
"conditions": [
{
"weight": 1,
"count": 123,
"include": true
}
],
"orOperators": [
true
]
}
],
"firstLevelOrOperators": [
true
]
},
"description": "The key moment is for new A/B tests",
"isFavorite": true,
"userVisible": true
}
'import requests
url = "https://api.kameleoon.com/key-moments"
payload = {
"name": "My Key Moment",
"siteId": 8372,
"audienceTracking": True,
"conditionDataList": [
{
"id": 123,
"parentId": 123,
"targetingCondition": {
"weight": 1,
"count": 123,
"include": True
}
}
],
"conditionDataTree": { "targetingType": "<string>" },
"conditionsData": {
"firstLevel": [
{
"conditions": [
{
"weight": 1,
"count": 123,
"include": True
}
],
"orOperators": [True]
}
],
"firstLevelOrOperators": [True]
},
"description": "The key moment is for new A/B tests",
"isFavorite": True,
"userVisible": True
}
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({
name: 'My Key Moment',
siteId: 8372,
audienceTracking: true,
conditionDataList: [
{
id: 123,
parentId: 123,
targetingCondition: {weight: 1, count: 123, include: true}
}
],
conditionDataTree: {targetingType: '<string>'},
conditionsData: {
firstLevel: [{conditions: [{weight: 1, count: 123, include: true}], orOperators: [true]}],
firstLevelOrOperators: [true]
},
description: 'The key moment is for new A/B tests',
isFavorite: true,
userVisible: true
})
};
fetch('https://api.kameleoon.com/key-moments', 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/key-moments",
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' => 'My Key Moment',
'siteId' => 8372,
'audienceTracking' => true,
'conditionDataList' => [
[
'id' => 123,
'parentId' => 123,
'targetingCondition' => [
'weight' => 1,
'count' => 123,
'include' => true
]
]
],
'conditionDataTree' => [
'targetingType' => '<string>'
],
'conditionsData' => [
'firstLevel' => [
[
'conditions' => [
[
'weight' => 1,
'count' => 123,
'include' => true
]
],
'orOperators' => [
true
]
]
],
'firstLevelOrOperators' => [
true
]
],
'description' => 'The key moment is for new A/B tests',
'isFavorite' => true,
'userVisible' => true
]),
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/key-moments"
payload := strings.NewReader("{\n \"name\": \"My Key Moment\",\n \"siteId\": 8372,\n \"audienceTracking\": true,\n \"conditionDataList\": [\n {\n \"id\": 123,\n \"parentId\": 123,\n \"targetingCondition\": {\n \"weight\": 1,\n \"count\": 123,\n \"include\": true\n }\n }\n ],\n \"conditionDataTree\": {\n \"targetingType\": \"<string>\"\n },\n \"conditionsData\": {\n \"firstLevel\": [\n {\n \"conditions\": [\n {\n \"weight\": 1,\n \"count\": 123,\n \"include\": true\n }\n ],\n \"orOperators\": [\n true\n ]\n }\n ],\n \"firstLevelOrOperators\": [\n true\n ]\n },\n \"description\": \"The key moment is for new A/B tests\",\n \"isFavorite\": true,\n \"userVisible\": true\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/key-moments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My Key Moment\",\n \"siteId\": 8372,\n \"audienceTracking\": true,\n \"conditionDataList\": [\n {\n \"id\": 123,\n \"parentId\": 123,\n \"targetingCondition\": {\n \"weight\": 1,\n \"count\": 123,\n \"include\": true\n }\n }\n ],\n \"conditionDataTree\": {\n \"targetingType\": \"<string>\"\n },\n \"conditionsData\": {\n \"firstLevel\": [\n {\n \"conditions\": [\n {\n \"weight\": 1,\n \"count\": 123,\n \"include\": true\n }\n ],\n \"orOperators\": [\n true\n ]\n }\n ],\n \"firstLevelOrOperators\": [\n true\n ]\n },\n \"description\": \"The key moment is for new A/B tests\",\n \"isFavorite\": true,\n \"userVisible\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kameleoon.com/key-moments")
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 \"name\": \"My Key Moment\",\n \"siteId\": 8372,\n \"audienceTracking\": true,\n \"conditionDataList\": [\n {\n \"id\": 123,\n \"parentId\": 123,\n \"targetingCondition\": {\n \"weight\": 1,\n \"count\": 123,\n \"include\": true\n }\n }\n ],\n \"conditionDataTree\": {\n \"targetingType\": \"<string>\"\n },\n \"conditionsData\": {\n \"firstLevel\": [\n {\n \"conditions\": [\n {\n \"weight\": 1,\n \"count\": 123,\n \"include\": true\n }\n ],\n \"orOperators\": [\n true\n ]\n }\n ],\n \"firstLevelOrOperators\": [\n true\n ]\n },\n \"description\": \"The key moment is for new A/B tests\",\n \"isFavorite\": true,\n \"userVisible\": true\n}"
response = http.request(request)
puts response.read_body{
"name": "My Key Moment",
"siteId": 8372,
"audienceTracking": true,
"audienceTrackingEditable": true,
"campaignType": "ALL",
"conditionDataList": [
{
"id": 123,
"isConditionBlock": true,
"logicalOperator": "AND",
"parentId": 123,
"targetingCondition": {
"targetingType": "PAGE_URL",
"weight": 1,
"count": 123,
"include": true,
"matchType": "EQUAL",
"unitOfTime": "SECOND",
"htmlDescription": "<string>",
"id": 123
}
}
],
"conditionDataTree": {
"targetingType": "<string>",
"conditionData": [
{
"targetingType": "PAGE_URL",
"weight": 1,
"htmlDescription": "<string>",
"id": 123
}
],
"isConditionBlock": true,
"logicalOperator": "AND"
},
"conditionsData": {
"firstLevel": [
{
"conditions": [
{
"targetingType": "PAGE_URL",
"weight": 1,
"count": 123,
"include": true,
"matchType": "EQUAL",
"unitOfTime": "SECOND",
"htmlDescription": "<string>",
"id": 123
}
],
"orOperators": [
true
]
}
],
"firstLevelOrOperators": [
true
]
},
"createdBy": 123,
"dateCreated": "2023-11-07T05:31:56Z",
"dateModified": "2023-11-07T05:31:56Z",
"description": "The key moment is for new A/B tests",
"id": 123,
"isFavorite": true,
"links": [
{
"domainId": 123,
"domainStatus": "<string>",
"domainType": "EXPERIMENT",
"linkRole": "MAIN",
"linkType": "DIRECT"
}
],
"userVisible": true
}{
"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"
}