🔔Sending events
Start sending events to Minilog in 5 minutes
Last updated
Start sending events to Minilog in 5 minutes
Last updated
await fetch("https://api.minilog.dev/v1/events/<project-name>", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer <project-token>",
},
body: JSON.stringify({
channel: "cron-jobs",
title: "Cron Job Success",
description: "The daily backup job completed successfully",
icon: "⏰",
tags:{
job_name: "daily_backup",
duration: "15 minutes",
status: "success",
next_run: "2024-09-05 02:00 UTC"
}
}),
});import requests
import json
url = "https://api.minilog.dev/v1/events/<project-name>"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <project-token>",
}
data = {
channel: "cron-jobs",
title: "Cron Job Success",
description: "The daily backup job completed successfully",
icon: "⏰",
tags:{
job_name: "daily_backup",
duration: "15 minutes",
status: "success",
next_run: "2024-09-05 02:00 UTC"
}
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.status_code)
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var url = "https://api.minilog.dev/v1/events/<project-name>";
var token = "<project-token>";
var json = "{\"channel\": \"cron-jobs\",\"title\": \"Cron Job Success\",\"description\": \"The daily backup job completed successfully\",\"icon\":\"⏰\", \"tags\": {\"job_name\": \"daily_backup\"}}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(url, content);
Console.WriteLine(response.StatusCode);
}
}
}
<?php
$url = 'https://api.minilog.dev/v1/events/<project-name>';
$token = '<project-token>';
$data = array(
'channel' => 'cron-jobs',
'title' => 'Cron Job Success',
'description' => 'The daily backup job completed successfully',
'icon' => '⏰'
'tags' => array('job_name' => 'daily_backup')
);
$options = array(
'http' => array(
'header' => "Content-Type: application/json\r\n" .
"Authorization: Bearer " . $token . "\r\n",
'method' => 'POST',
'content' => json_encode($data),
),
);
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
if ($response === false) {
echo "Error fetching data";
} else {
echo $response;
}
?>curl -X POST https://api.minilog.dev/v1/events/<project-name> \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <project-token>" \
-d '{
"channel": "cron-jobs",
"title": "Cron Job Success",
"description":"The daily backup job completed successfully.",
"icon": "⏰",
"notify": true,
"tags":{
"job_name": "daily_backup",
"duration": "15 minutes",
"status": "success",
"next_run": "2024-09-05 02:00 UTC"
}
}'$uri = 'https://api.minilog.dev/v1/events/<project-name>'
$headers = @{
'Content-Type' = 'application/json'
'Authorization' = 'Bearer <project-token>'
}
$body = @{
channel = 'cron-jobs'
title = 'Cron Job Success'
description = 'The daily backup job completed successfully',
icon = '⏰',
tags = @{
hostname = 'vm-1'
}
}
Invoke-RestMethod -Uri $uri -Method Post -Headers $headers -Body ($body | ConvertTo-Json)