Record an event
curl --request POST \
--url https://api.scribe-mail.com/v1/analytics/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event": {
"name": "<string>",
"value": 123,
"currency": "<string>",
"click_id": "<string>",
"event_id": "<string>",
"properties": {},
"anonymous_id": "<string>",
"user_id": "<string>",
"traits": {}
}
}
'import requests
url = "https://api.scribe-mail.com/v1/analytics/events"
payload = { "event": {
"name": "<string>",
"value": 123,
"currency": "<string>",
"click_id": "<string>",
"event_id": "<string>",
"properties": {},
"anonymous_id": "<string>",
"user_id": "<string>",
"traits": {}
} }
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: {
name: '<string>',
value: 123,
currency: '<string>',
click_id: '<string>',
event_id: '<string>',
properties: {},
anonymous_id: '<string>',
user_id: '<string>',
traits: {}
}
})
};
fetch('https://api.scribe-mail.com/v1/analytics/events', 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.scribe-mail.com/v1/analytics/events",
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' => [
'name' => '<string>',
'value' => 123,
'currency' => '<string>',
'click_id' => '<string>',
'event_id' => '<string>',
'properties' => [
],
'anonymous_id' => '<string>',
'user_id' => '<string>',
'traits' => [
]
]
]),
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.scribe-mail.com/v1/analytics/events"
payload := strings.NewReader("{\n \"event\": {\n \"name\": \"<string>\",\n \"value\": 123,\n \"currency\": \"<string>\",\n \"click_id\": \"<string>\",\n \"event_id\": \"<string>\",\n \"properties\": {},\n \"anonymous_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"traits\": {}\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.scribe-mail.com/v1/analytics/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event\": {\n \"name\": \"<string>\",\n \"value\": 123,\n \"currency\": \"<string>\",\n \"click_id\": \"<string>\",\n \"event_id\": \"<string>\",\n \"properties\": {},\n \"anonymous_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"traits\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scribe-mail.com/v1/analytics/events")
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 \"name\": \"<string>\",\n \"value\": 123,\n \"currency\": \"<string>\",\n \"click_id\": \"<string>\",\n \"event_id\": \"<string>\",\n \"properties\": {},\n \"anonymous_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"traits\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"name": "<string>",
"value": 123,
"currency": "<string>",
"click_id": "<string>",
"source": "api",
"status": "accepted"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>"
},
"remediation": {
"dashboard_url": "<string>",
"message": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>"
},
"remediation": {
"dashboard_url": "<string>",
"message": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>"
},
"details": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>",
"allowed": [
"<unknown>"
],
"missing": [
"<string>"
]
}
]
}Events
Record an event
POST
/
v1
/
analytics
/
events
Record an event
curl --request POST \
--url https://api.scribe-mail.com/v1/analytics/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event": {
"name": "<string>",
"value": 123,
"currency": "<string>",
"click_id": "<string>",
"event_id": "<string>",
"properties": {},
"anonymous_id": "<string>",
"user_id": "<string>",
"traits": {}
}
}
'import requests
url = "https://api.scribe-mail.com/v1/analytics/events"
payload = { "event": {
"name": "<string>",
"value": 123,
"currency": "<string>",
"click_id": "<string>",
"event_id": "<string>",
"properties": {},
"anonymous_id": "<string>",
"user_id": "<string>",
"traits": {}
} }
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: {
name: '<string>',
value: 123,
currency: '<string>',
click_id: '<string>',
event_id: '<string>',
properties: {},
anonymous_id: '<string>',
user_id: '<string>',
traits: {}
}
})
};
fetch('https://api.scribe-mail.com/v1/analytics/events', 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.scribe-mail.com/v1/analytics/events",
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' => [
'name' => '<string>',
'value' => 123,
'currency' => '<string>',
'click_id' => '<string>',
'event_id' => '<string>',
'properties' => [
],
'anonymous_id' => '<string>',
'user_id' => '<string>',
'traits' => [
]
]
]),
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.scribe-mail.com/v1/analytics/events"
payload := strings.NewReader("{\n \"event\": {\n \"name\": \"<string>\",\n \"value\": 123,\n \"currency\": \"<string>\",\n \"click_id\": \"<string>\",\n \"event_id\": \"<string>\",\n \"properties\": {},\n \"anonymous_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"traits\": {}\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.scribe-mail.com/v1/analytics/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event\": {\n \"name\": \"<string>\",\n \"value\": 123,\n \"currency\": \"<string>\",\n \"click_id\": \"<string>\",\n \"event_id\": \"<string>\",\n \"properties\": {},\n \"anonymous_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"traits\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scribe-mail.com/v1/analytics/events")
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 \"name\": \"<string>\",\n \"value\": 123,\n \"currency\": \"<string>\",\n \"click_id\": \"<string>\",\n \"event_id\": \"<string>\",\n \"properties\": {},\n \"anonymous_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"traits\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"name": "<string>",
"value": 123,
"currency": "<string>",
"click_id": "<string>",
"source": "api",
"status": "accepted"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>"
},
"remediation": {
"dashboard_url": "<string>",
"message": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>"
},
"remediation": {
"dashboard_url": "<string>",
"message": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>"
},
"details": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>",
"allowed": [
"<unknown>"
],
"missing": [
"<string>"
]
}
]
}Was this page helpful?
⌘I