Events

Events is the key to telling Aikey what the user is doing on the site. The events are predefined and can be found on this page.


Show Event

curl https://api.aikey.io/v1/event/show \
--header 'X-CLIENTID: ClientId' \
--header 'X-SECRET: ClientSecret' \
--header "content-type: application/json" \
--data-raw '{
 "userId": "UserId returned from init session",
"sessionId": "SessionId returned from init session",
 "sku": "ID of Product shown"
}'

Add to Cart

 

curl --location --request POST 'https://api.aikey.io/v1/event/cart' \
--header 'X-CLIENTID: ClientId' \
--header 'X-SECRET: ClientSecret' \
--data-raw '{
	"userId": "User id",
        "sessionId": "Session id",
	"sku" : "123-monki-w",
	"quantity": 2
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.aikey.io/v1/event/cart",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS =>"{\n\t\"userId\": \"U.5dce535fdafa85.72034206\",\n\t\"sku\" : \"123-monki-w\",\n\t\"quantity\": 2\n}",
  CURLOPT_HTTPHEADER => array(
    "X-CLIENTID: ClientId",
    "X-SECRET: ClientSecret"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var client = new RestClient("https://api.aikey.io/v1/event/cart");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("X-CLIENTID", "ClientId");
request.AddHeader("X-SECRET", "ClientSecret");
request.AddParameter("text/plain", "{\n\t\"userId\": \"U.5dce535fdafa85.72034206\",\n\t\"sku\" : \"123-monki-w\",\n\t\"quantity\": 2\n}",  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Purchase

curl --location --request POST 'https://api.aikey.io/v1/event/purchase' \
--header 'X-CLIENTID: ClientId' \
--header 'X-SECRET: ClientSecret' \
--data-raw '{
	"userId": "U.5dce535fdafa85.72034206",
	"sessionId": "S.5dec3716c598e2.76826788",
	"orderId": "web-123",
	"orderTotal": 124.23,
	"currency": "EUR"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.aikey.io/v1/event/purchase",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS =>"{\n\t\"userId\": \"U.5dce535fdafa85.72034206\",\n\t\"sessionId\": \"S.5dec3716c598e2.76826788\",\n\t\"orderId\": \"web-123\",\n\t\"orderTotal\": 124.23,\n\t\"currency\": \"EUR\"\n}",
  CURLOPT_HTTPHEADER => array(
    "X-CLIENTID: 1asdrt42qd45f",
    "X-SECRET: sk_79bd7d7648f04f4a9a72b372b59fc68a"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var client = new RestClient("https://api.aikey.io/v1/event/purchase");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("X-CLIENTID", "ClientId");
request.AddHeader("X-SECRET", "ClientSecret");
request.AddParameter("text/plain", "{\"userId\": \"U.5dce535fdafa85.72034206\", \"sessionId\": \"S.5dec3716c598e2.76826788\", \"orderId\": \"web-123\", \"orderTotal\": 1.23, \"currency\": \"EUR\"}",  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);