Typescript (SDK)
import { SDK } from "@meetkai/mka1";
const sdk = new SDK();
async function run() {
const result = await sdk.analytics.capture({
analyticsCaptureKey: "<YOUR_API_KEY_HERE>",
}, {
analyticsCaptureRequest: {
idempotencyKey: "<value>",
events: [],
},
});
console.log(result);
}
run();using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
using MeetKai.MKA1.Types.Requests;
using System.Collections.Generic;
var sdk = new SDK();
var res = await sdk.Analytics.CaptureAsync(
security: new AnalyticsCaptureSecurity() {
AnalyticsCaptureKey = "<YOUR_API_KEY_HERE>",
},
body: new MeetKai.MKA1.Types.Components.AnalyticsCaptureRequest() {
IdempotencyKey = "<value>",
Events = new List<AnalyticsEvent>() {},
}
);
// handle responsefrom meetkai_mka1 import SDK, models
with SDK() as sdk:
res = sdk.analytics.capture(security=models.AnalyticsCaptureSecurity(
analytics_capture_key="<YOUR_API_KEY_HERE>",
), idempotency_key="<value>", events=[])
# Handle response
print(res)curl --request POST \
--url https://apigw.mka1.com/api/v1/analytics/capture \
--header 'Content-Type: application/json' \
--header 'X-Analytics-Key: <api-key>' \
--data '
{
"idempotency_key": "<string>",
"events": [
{
"event_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"event_name": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"distinct_id": "<string>",
"properties": {}
}
]
}
'const options = {
method: 'POST',
headers: {'X-Analytics-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
idempotency_key: '<string>',
events: [
{
event_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
event_name: '<string>',
timestamp: '2023-11-07T05:31:56Z',
distinct_id: '<string>',
properties: {}
}
]
})
};
fetch('https://apigw.mka1.com/api/v1/analytics/capture', 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://apigw.mka1.com/api/v1/analytics/capture",
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([
'idempotency_key' => '<string>',
'events' => [
[
'event_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'event_name' => '<string>',
'timestamp' => '2023-11-07T05:31:56Z',
'distinct_id' => '<string>',
'properties' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Analytics-Key: <api-key>"
],
]);
$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://apigw.mka1.com/api/v1/analytics/capture"
payload := strings.NewReader("{\n \"idempotency_key\": \"<string>\",\n \"events\": [\n {\n \"event_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"event_name\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"distinct_id\": \"<string>\",\n \"properties\": {}\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Analytics-Key", "<api-key>")
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://apigw.mka1.com/api/v1/analytics/capture")
.header("X-Analytics-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"idempotency_key\": \"<string>\",\n \"events\": [\n {\n \"event_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"event_name\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"distinct_id\": \"<string>\",\n \"properties\": {}\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/analytics/capture")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Analytics-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"<string>\",\n \"events\": [\n {\n \"event_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"event_name\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"distinct_id\": \"<string>\",\n \"properties\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"batch_id": "<string>",
"duplicate": true,
"event_count": 0
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}Events
Aceitar permanentemente um lote de eventos
POST
/
api
/
v1
/
analytics
/
capture
Typescript (SDK)
import { SDK } from "@meetkai/mka1";
const sdk = new SDK();
async function run() {
const result = await sdk.analytics.capture({
analyticsCaptureKey: "<YOUR_API_KEY_HERE>",
}, {
analyticsCaptureRequest: {
idempotencyKey: "<value>",
events: [],
},
});
console.log(result);
}
run();using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
using MeetKai.MKA1.Types.Requests;
using System.Collections.Generic;
var sdk = new SDK();
var res = await sdk.Analytics.CaptureAsync(
security: new AnalyticsCaptureSecurity() {
AnalyticsCaptureKey = "<YOUR_API_KEY_HERE>",
},
body: new MeetKai.MKA1.Types.Components.AnalyticsCaptureRequest() {
IdempotencyKey = "<value>",
Events = new List<AnalyticsEvent>() {},
}
);
// handle responsefrom meetkai_mka1 import SDK, models
with SDK() as sdk:
res = sdk.analytics.capture(security=models.AnalyticsCaptureSecurity(
analytics_capture_key="<YOUR_API_KEY_HERE>",
), idempotency_key="<value>", events=[])
# Handle response
print(res)curl --request POST \
--url https://apigw.mka1.com/api/v1/analytics/capture \
--header 'Content-Type: application/json' \
--header 'X-Analytics-Key: <api-key>' \
--data '
{
"idempotency_key": "<string>",
"events": [
{
"event_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"event_name": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"distinct_id": "<string>",
"properties": {}
}
]
}
'const options = {
method: 'POST',
headers: {'X-Analytics-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
idempotency_key: '<string>',
events: [
{
event_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
event_name: '<string>',
timestamp: '2023-11-07T05:31:56Z',
distinct_id: '<string>',
properties: {}
}
]
})
};
fetch('https://apigw.mka1.com/api/v1/analytics/capture', 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://apigw.mka1.com/api/v1/analytics/capture",
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([
'idempotency_key' => '<string>',
'events' => [
[
'event_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'event_name' => '<string>',
'timestamp' => '2023-11-07T05:31:56Z',
'distinct_id' => '<string>',
'properties' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Analytics-Key: <api-key>"
],
]);
$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://apigw.mka1.com/api/v1/analytics/capture"
payload := strings.NewReader("{\n \"idempotency_key\": \"<string>\",\n \"events\": [\n {\n \"event_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"event_name\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"distinct_id\": \"<string>\",\n \"properties\": {}\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Analytics-Key", "<api-key>")
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://apigw.mka1.com/api/v1/analytics/capture")
.header("X-Analytics-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"idempotency_key\": \"<string>\",\n \"events\": [\n {\n \"event_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"event_name\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"distinct_id\": \"<string>\",\n \"properties\": {}\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/analytics/capture")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Analytics-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"<string>\",\n \"events\": [\n {\n \"event_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"event_name\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"distinct_id\": \"<string>\",\n \"properties\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"batch_id": "<string>",
"duplicate": true,
"event_count": 0
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}Autorizações
Public project capture credential. Use a separate capture-only MKA1 client without privileged credentials.
Cabeçalhos
Optional external end-user identifier forwarded by the API gateway.
Corpo
application/json
Esta página foi útil?
⌘I