Ingest event if a user is entitled to a feature
curl --request POST \
--url https://api.togai.com/entitled \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event": {
"schemaName": "<string>",
"timestamp": "2022-06-15T07:30:35.123",
"accountId": 1,
"attributes": [
{
"name": "message",
"value": 100,
"unit": "characters"
}
],
"dimensions": {},
"id": "c0b1306d-f506-43a6-856b-69221efaee6b"
}
}
'import requests
url = "https://api.togai.com/entitled"
payload = { "event": {
"schemaName": "<string>",
"timestamp": "2022-06-15T07:30:35.123",
"accountId": 1,
"attributes": [
{
"name": "message",
"value": 100,
"unit": "characters"
}
],
"dimensions": {},
"id": "c0b1306d-f506-43a6-856b-69221efaee6b"
} }
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({
event: {
schemaName: '<string>',
timestamp: '2022-06-15T07:30:35.123',
accountId: 1,
attributes: [{name: 'message', value: 100, unit: 'characters'}],
dimensions: {},
id: 'c0b1306d-f506-43a6-856b-69221efaee6b'
}
})
};
fetch('https://api.togai.com/entitled', 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.togai.com/entitled",
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([
'event' => [
'schemaName' => '<string>',
'timestamp' => '2022-06-15T07:30:35.123',
'accountId' => 1,
'attributes' => [
[
'name' => 'message',
'value' => 100,
'unit' => 'characters'
]
],
'dimensions' => [
],
'id' => 'c0b1306d-f506-43a6-856b-69221efaee6b'
]
]),
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.togai.com/entitled"
payload := strings.NewReader("{\n \"event\": {\n \"schemaName\": \"<string>\",\n \"timestamp\": \"2022-06-15T07:30:35.123\",\n \"accountId\": 1,\n \"attributes\": [\n {\n \"name\": \"message\",\n \"value\": 100,\n \"unit\": \"characters\"\n }\n ],\n \"dimensions\": {},\n \"id\": \"c0b1306d-f506-43a6-856b-69221efaee6b\"\n }\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.togai.com/entitled")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event\": {\n \"schemaName\": \"<string>\",\n \"timestamp\": \"2022-06-15T07:30:35.123\",\n \"accountId\": 1,\n \"attributes\": [\n {\n \"name\": \"message\",\n \"value\": 100,\n \"unit\": \"characters\"\n }\n ],\n \"dimensions\": {},\n \"id\": \"c0b1306d-f506-43a6-856b-69221efaee6b\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/entitled")
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 \"event\": {\n \"schemaName\": \"<string>\",\n \"timestamp\": \"2022-06-15T07:30:35.123\",\n \"accountId\": 1,\n \"attributes\": [\n {\n \"name\": \"message\",\n \"value\": 100,\n \"unit\": \"characters\"\n }\n ],\n \"dimensions\": {},\n \"id\": \"c0b1306d-f506-43a6-856b-69221efaee6b\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<Reason message>"
}Entitlements
Ingest event if a user is entitled to a feature
This API let’s you to ingest an event if a user is entitled to a feature
POST
/
entitled
Ingest event if a user is entitled to a feature
curl --request POST \
--url https://api.togai.com/entitled \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event": {
"schemaName": "<string>",
"timestamp": "2022-06-15T07:30:35.123",
"accountId": 1,
"attributes": [
{
"name": "message",
"value": 100,
"unit": "characters"
}
],
"dimensions": {},
"id": "c0b1306d-f506-43a6-856b-69221efaee6b"
}
}
'import requests
url = "https://api.togai.com/entitled"
payload = { "event": {
"schemaName": "<string>",
"timestamp": "2022-06-15T07:30:35.123",
"accountId": 1,
"attributes": [
{
"name": "message",
"value": 100,
"unit": "characters"
}
],
"dimensions": {},
"id": "c0b1306d-f506-43a6-856b-69221efaee6b"
} }
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({
event: {
schemaName: '<string>',
timestamp: '2022-06-15T07:30:35.123',
accountId: 1,
attributes: [{name: 'message', value: 100, unit: 'characters'}],
dimensions: {},
id: 'c0b1306d-f506-43a6-856b-69221efaee6b'
}
})
};
fetch('https://api.togai.com/entitled', 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.togai.com/entitled",
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([
'event' => [
'schemaName' => '<string>',
'timestamp' => '2022-06-15T07:30:35.123',
'accountId' => 1,
'attributes' => [
[
'name' => 'message',
'value' => 100,
'unit' => 'characters'
]
],
'dimensions' => [
],
'id' => 'c0b1306d-f506-43a6-856b-69221efaee6b'
]
]),
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.togai.com/entitled"
payload := strings.NewReader("{\n \"event\": {\n \"schemaName\": \"<string>\",\n \"timestamp\": \"2022-06-15T07:30:35.123\",\n \"accountId\": 1,\n \"attributes\": [\n {\n \"name\": \"message\",\n \"value\": 100,\n \"unit\": \"characters\"\n }\n ],\n \"dimensions\": {},\n \"id\": \"c0b1306d-f506-43a6-856b-69221efaee6b\"\n }\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.togai.com/entitled")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event\": {\n \"schemaName\": \"<string>\",\n \"timestamp\": \"2022-06-15T07:30:35.123\",\n \"accountId\": 1,\n \"attributes\": [\n {\n \"name\": \"message\",\n \"value\": 100,\n \"unit\": \"characters\"\n }\n ],\n \"dimensions\": {},\n \"id\": \"c0b1306d-f506-43a6-856b-69221efaee6b\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/entitled")
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 \"event\": {\n \"schemaName\": \"<string>\",\n \"timestamp\": \"2022-06-15T07:30:35.123\",\n \"accountId\": 1,\n \"attributes\": [\n {\n \"name\": \"message\",\n \"value\": 100,\n \"unit\": \"characters\"\n }\n ],\n \"dimensions\": {},\n \"id\": \"c0b1306d-f506-43a6-856b-69221efaee6b\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<Reason message>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Payload for ingesting events
Contents of the event
Show child attributes
Show child attributes
Response
Success response
Example:
true
⌘I
