Catalogul evenimentelor
Primește un eveniment de finalizare și citește execuția confirmată.
Abonează‑te la com.rdcopilot.reports.run.completed.v1. Evenimentul se emite după înregistrarea rezultatului. Plicul identifică organizația, compania, revizia execuției, actorul și operația cauzală. Câmpul data conține runId, questionId și sourceRevision.
curl
curl -X POST "$RDC_BASE_URL/reports/v1/subscriptions" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "41800000-0000-4000-8000-000000000136",
"expectedRevision": 0,
"id": "management-events",
"endpoint": "https://receiver.example/events",
"eventTypes": [
"com.rdcopilot.reports.run.completed.v1"
]
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/reports/v1/subscriptions`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "41800000-0000-4000-8000-000000000136",
"expectedRevision": 0,
"id": "management-events",
"endpoint": "https://receiver.example/events",
"eventTypes": [
"com.rdcopilot.reports.run.completed.v1"
]
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/reports/v1/subscriptions',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '41800000-0000-4000-8000-000000000136',
'expectedRevision': 0,
'id': 'management-events',
'endpoint': 'https://receiver.example/events',
'eventTypes': [
'com.rdcopilot.reports.run.completed.v1',
],
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "41800000-0000-4000-8000-000000000136",
"expectedRevision": 0,
"id": "management-events",
"endpoint": "https://receiver.example/events",
"eventTypes": [
"com.rdcopilot.reports.run.completed.v1"
]
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/reports/v1/subscriptions');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/reports/v1/subscriptions");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "41800000-0000-4000-8000-000000000136",
"expectedRevision": 0,
"id": "management-events",
"endpoint": "https://receiver.example/events",
"eventTypes": [
"com.rdcopilot.reports.run.completed.v1"
]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "41800000-0000-4000-8000-000000000136",
"status": "completed",
"aggregateRevision": 1,
"secret": "whsec_dGVzdC1zaWduaW5nLXNlY3JldC1yZXBvcnRz"
} Verifică semnătura fiecărei livrări asupra corpului brut, folosind secretul abonamentului. Păstrează identificatorul evenimentului înainte de confirmare; duplicatele păstrează același identificator. Citește execuția cu tokenul contului înainte să actualizezi rapoarte dependente. Ordinea livrării nu garantează actualitatea datelor.
curl
curl "$RDC_BASE_URL/reports/v1/runs/41800000-0000-4000-8000-000000000002" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/reports/v1/runs/41800000-0000-4000-8000-000000000002`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/reports/v1/runs/41800000-0000-4000-8000-000000000002',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/reports/v1/runs/41800000-0000-4000-8000-000000000002');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/reports/v1/runs/41800000-0000-4000-8000-000000000002");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"id": "41800000-0000-4000-8000-000000000002",
"revision": 1,
"questionId": "revenue-by-product",
"questionRevision": 1,
"status": "completed",
"filters": {
"period": "2026-10",
"companyId": null,
"department": null
},
"sourceRevision": 1,
"refreshedAt": "2026-11-22T06:00:00Z",
"rows": [
{
"key": "food",
"netRevenue": "142063.00",
"invoiceIds": [
"FCT-2026-00418",
"BRR-2026-00127"
]
},
{
"key": "household",
"netRevenue": "60735.50",
"invoiceIds": [
"FCT-2026-00436"
]
}
],
"errorCode": null
} Vezi Livrare și reîncercări pentru comportamentul receptorului și Reluare pentru livrări parcate. Catalogul include numai tipul acceptat de acest contract.