Быстрый старт
Итак, давайте начнём!
Last updated
Итак, давайте начнём!
Last updated
curl --location --request POST 'https://api.getloglee.ru/rest/v1/events' \
--header 'apikey: <PUBLIC_TOKEN>'\
--header 'Authorization: Bearer <PERSONAL_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "New payment",
"project_id": "1234-1234",
"channel_id":"1234-1234",
"description": "First user-123 payment",
"notify": true,
"properties": {
"amount": 123,
"currency": "RUB"
}
}'const fetch = require('node-fetch');
const url = 'https://api.getloglee.ru/rest/v1/events';
const apiKey = 'PUBLIC_TOKEN';
const personal_key = 'PERSONAL_TOKEN',
const data = {
"name": "New payment",
"project_id": "1234-1234",
"channel_id":"1234-1234",
"description": "First user-123 payment",
"notify": true,
"properties": {
"amount": 123,
"currency": "RUB"
}
};
fetch(url, {
method: 'POST',
headers: {
'apikey': apiKey,
'Authorization': `Bearer ${personal_key}`,
'Content-Type': 'application/json',
'Prefer': 'return=minimal'
},
body: JSON.stringify(data)
})
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
})
.then(result => {
console.log(result);
})
.catch(error => {
console.error('There was an error:', error);
});
require 'net/http'
require 'uri'
require 'json'
url = URI.parse('https://api.getloglee.ru/rest/v1/events')
api_key = 'PUBLIC_TOKEN'
personal_key = 'PERSONAL_TOKEN'
data = {
"name": "New payment",
"project_id": "1234-1234",
"channel_id":"1234-1234",
"description": "First user-123 payment",
"notify": true,
"properties": {
"amount": 123,
"currency": "RUB"
}
}
headers = {
'apikey': api_key,
'Authorization': "Bearer #{personal_key}",
'Content-Type': 'application/json',
'Prefer': 'return=minimal'
}
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url.path, headers)
request.body = data.to_json
response = http.request(request)
puts response.body
<?php
$url = 'https://api.getloglee.ru/rest/v1/events';
$apiKey = 'PUBLIC_TOKEN';
$personal_key = 'PERSONAL_TOKEN'
$data = array(
"name" => "project_name",
"project_id" => "project_id",
"channel_id" => "channel_id",
"object_name" => "object_name",
"properties" => 'properties_json',
"description" => "description",
"notify" => true
);
$headers = array(
'apikey: ' . $apiKey,
'Authorization: Bearer ' . $personal_key,
'Content-Type: application/json',
'Prefer: return=minimal'
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
if(curl_errno($ch)){
throw new Exception(curl_error($ch));
}
curl_close($ch);
echo $response;
?>