Salt la conținut
Documentație

Caută în documentație

    English

    Prima alertă

    Definește o regulă de prag și urmărește alerta rezultată.

    Selectează un tag numeric. Stabilește pragul de deschidere și durata pentru care condiția de deschidere trebuie să se mențină. Aceste valori sunt setări operaționale alese pentru echipament.

    curl

    curl -X POST "$RDC_BASE_URL/iot/v1/rules" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "a1000000-0000-4000-8000-000000000003",
      "expectedRevision": 0,
      "path": "cold-room-2/temperature",
      "operator": "gt",
      "threshold": "7.00",
      "unit": "°C",
      "durationSeconds": 60
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/iot/v1/rules`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "a1000000-0000-4000-8000-000000000003",
        "expectedRevision": 0,
        "path": "cold-room-2/temperature",
        "operator": "gt",
        "threshold": "7.00",
        "unit": "°C",
        "durationSeconds": 60
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/iot/v1/rules',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': 'a1000000-0000-4000-8000-000000000003',
            'expectedRevision': 0,
            'path': 'cold-room-2/temperature',
            'operator': 'gt',
            'threshold': '7.00',
            'unit': '°C',
            'durationSeconds': 60,
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "a1000000-0000-4000-8000-000000000003",
      "expectedRevision": 0,
      "path": "cold-room-2/temperature",
      "operator": "gt",
      "threshold": "7.00",
      "unit": "°C",
      "durationSeconds": 60
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/iot/v1/rules');
    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")}/iot/v1/rules");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "a1000000-0000-4000-8000-000000000003",
      "expectedRevision": 0,
      "path": "cold-room-2/temperature",
      "operator": "gt",
      "threshold": "7.00",
      "unit": "°C",
      "durationSeconds": 60
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Răspuns 202

    {
      "operationId": "a1000000-0000-4000-8000-000000000003",
      "status": "accepted",
      "aggregateRevision": 1
    }

    Trimite citiri de bună calitate prin conexiunea configurată. Listează alertele echipamentului și verifică regula și ora deschiderii. Confirmă preluarea alertei folosind revizia ei curentă.

    curl

    curl "$RDC_BASE_URL/iot/v1/alerts?limit=20" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/iot/v1/alerts?limit=20`, {
      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"]}/iot/v1/alerts?limit=20',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/iot/v1/alerts?limit=20');
    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")}/iot/v1/alerts?limit=20");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Răspuns 200

    {
      "items": [
        {
          "id": "alert-1",
          "ruleId": "rule-1",
          "severity": "critical",
          "assetId": "cold-room-2",
          "opened": "2026-11-20T09:03:10Z",
          "state": "open",
          "assignee": null,
          "workOrderId": null,
          "revision": 1
        }
      ],
      "nextCursor": null
    }

    Confirmarea preluării arată că cineva și‑a asumat intervenția; nu elimină cauza alertei. Atribuie alerta unui membru al contului, apoi creează comanda de lucru în ERP. Comanda asociată nu se creează de două ori. Citește alerta după fiecare operație încheiată și folosește revizia nouă la acțiunea următoare; alege un operationId nou pentru fiecare acțiune.

    curl

    curl -X POST "$RDC_BASE_URL/iot/v1/alerts/alert-1/acknowledge" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "a1000000-0000-4000-8000-000000000010",
      "expectedRevision": 1
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/iot/v1/alerts/alert-1/acknowledge`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "a1000000-0000-4000-8000-000000000010",
        "expectedRevision": 1
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/iot/v1/alerts/alert-1/acknowledge',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': 'a1000000-0000-4000-8000-000000000010',
            'expectedRevision': 1,
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "a1000000-0000-4000-8000-000000000010",
      "expectedRevision": 1
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/iot/v1/alerts/alert-1/acknowledge');
    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")}/iot/v1/alerts/alert-1/acknowledge");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "a1000000-0000-4000-8000-000000000010",
      "expectedRevision": 1
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Răspuns 202

    {
      "operationId": "a1000000-0000-4000-8000-000000000010",
      "status": "accepted",
      "aggregateRevision": 2
    }

    curl

    curl -X POST "$RDC_BASE_URL/iot/v1/alerts/alert-1/assign" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "a1000000-0000-4000-8000-000000000011",
      "expectedRevision": 2,
      "assignee": "mihai-stan"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/iot/v1/alerts/alert-1/assign`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "a1000000-0000-4000-8000-000000000011",
        "expectedRevision": 2,
        "assignee": "mihai-stan"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/iot/v1/alerts/alert-1/assign',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': 'a1000000-0000-4000-8000-000000000011',
            'expectedRevision': 2,
            'assignee': 'mihai-stan',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "a1000000-0000-4000-8000-000000000011",
      "expectedRevision": 2,
      "assignee": "mihai-stan"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/iot/v1/alerts/alert-1/assign');
    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")}/iot/v1/alerts/alert-1/assign");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "a1000000-0000-4000-8000-000000000011",
      "expectedRevision": 2,
      "assignee": "mihai-stan"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Răspuns 202

    {
      "operationId": "a1000000-0000-4000-8000-000000000011",
      "status": "accepted",
      "aggregateRevision": 3
    }

    curl

    curl -X POST "$RDC_BASE_URL/iot/v1/alerts/alert-1/work-order" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "a1000000-0000-4000-8000-000000000012",
      "expectedRevision": 3
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/iot/v1/alerts/alert-1/work-order`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "a1000000-0000-4000-8000-000000000012",
        "expectedRevision": 3
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/iot/v1/alerts/alert-1/work-order',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': 'a1000000-0000-4000-8000-000000000012',
            'expectedRevision': 3,
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "a1000000-0000-4000-8000-000000000012",
      "expectedRevision": 3
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/iot/v1/alerts/alert-1/work-order');
    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")}/iot/v1/alerts/alert-1/work-order");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "a1000000-0000-4000-8000-000000000012",
      "expectedRevision": 3
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Răspuns 202

    {
      "operationId": "a1000000-0000-4000-8000-000000000012",
      "status": "accepted",
      "aggregateRevision": 4
    }