Salt la conținut
Documentație

Caută în documentație

    English

    Declanșatoare

    Pornește rulări dintr‑un webhook primit, ca comenzile magazinului să ajungă în flux fără ca programul tău să apeleze API‑ul.

    Pe această pagină

    Listează declanșatoare

    GET /integrations/v1/triggers

    Parametri

    NumeÎnTipObligatoriuDescriere
    limit query integer Nuopțional Mărimea paginii. Implicit 100 Interval 1 – 500
    cursor query string Nuopțional Cursor opac din pagina precedentă.

    Răspunsuri

    StareDescriereCorp
    200 Înregistrarea curentă. TriggerPage
    400 Cerere refuzată: invalid_request. Error
    401 Cerere refuzată: unauthorized. Error
    403 Cerere refuzată: forbidden. Error
    404 Cerere refuzată: resource_not_found. Error
    409 Cerere refuzată: revision_conflict. Error
    422 Cerere refuzată: invalid‑settings. Error
    429 Cerere refuzată: rate_limited. Error
    503 Cerere refuzată: unavailable. Error

    Cerere

    curl

    curl "$RDC_BASE_URL/integrations/v1/triggers?limit=100" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

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

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/integrations/v1/triggers?limit=100');
    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")}/integrations/v1/triggers?limit=100");
    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

    JSON

    {
      "items": [
        {
          "id": "trigger-order",
          "flowId": "flow-order",
          "version": 1,
          "kind": "webhook",
          "enabled": true,
          "revision": 1
        }
      ],
      "nextCursor": null
    }

    Creează un declanșator

    POST /integrations/v1/triggers

    Păstrează comanda și returnează confirmarea operației. Citește rezultatul operației înainte de a o considera încheiată. Refolosirea unui operationId cu alt conținut returnează operation_reused.

    Corpul cererii

    CâmpTipObligatoriuDescriere
    operationId string (uuid) Daobligatoriu UUID ales de client; refolosește‑l numai cu aceeași cerere.
    expectedRevision integer Daobligatoriu Revizia citită înaintea modificării; zero pentru o resursă nouă.
    flowId string Daobligatoriu Fluxul vizat.
    version integer Daobligatoriu Versiune publicată.
    kind string Daobligatoriu Sursă. Una dintre webhook, event
    enabled boolean Daobligatoriu Permite rulări noi.

    Răspunsuri

    StareDescriereCorp
    202 Operație acceptată. OperationResult
    400 Cerere refuzată: invalid_request. Error
    401 Cerere refuzată: unauthorized. Error
    403 Cerere refuzată: forbidden. Error
    404 Cerere refuzată: resource_not_found. Error
    409 Cerere refuzată: revision_conflict. Error
    422 Cerere refuzată: invalid‑settings. Error
    429 Cerere refuzată: rate_limited. Error
    503 Cerere refuzată: unavailable. Error

    Cerere

    curl

    curl -X POST "$RDC_BASE_URL/integrations/v1/triggers" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "flowId": "flow-order",
      "version": 1,
      "kind": "webhook",
      "enabled": true,
      "operationId": "33a22ec0-f0af-4498-a388-123456789abc",
      "expectedRevision": 0
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/integrations/v1/triggers`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "flowId": "flow-order",
        "version": 1,
        "kind": "webhook",
        "enabled": true,
        "operationId": "33a22ec0-f0af-4498-a388-123456789abc",
        "expectedRevision": 0
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/integrations/v1/triggers',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'flowId': 'flow-order',
            'version': 1,
            'kind': 'webhook',
            'enabled': True,
            'operationId': '33a22ec0-f0af-4498-a388-123456789abc',
            'expectedRevision': 0,
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "flowId": "flow-order",
      "version": 1,
      "kind": "webhook",
      "enabled": true,
      "operationId": "33a22ec0-f0af-4498-a388-123456789abc",
      "expectedRevision": 0
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/integrations/v1/triggers');
    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")}/integrations/v1/triggers");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "flowId": "flow-order",
      "version": 1,
      "kind": "webhook",
      "enabled": true,
      "operationId": "33a22ec0-f0af-4498-a388-123456789abc",
      "expectedRevision": 0
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Răspuns 202

    JSON

    {
      "operationId": "33a22ec0-f0af-4498-a388-123456789abc",
      "status": "accepted",
      "aggregateRevision": 1,
      "aggregateId": "trigger-order"
    }

    Citește declanșatorul

    GET /integrations/v1/triggers/{id}

    Parametri

    NumeÎnTipObligatoriuDescriere
    id path string Daobligatoriu Identificator: id.

    Răspunsuri

    StareDescriereCorp
    200 Înregistrarea curentă. Trigger
    400 Cerere refuzată: invalid_request. Error
    401 Cerere refuzată: unauthorized. Error
    403 Cerere refuzată: forbidden. Error
    404 Cerere refuzată: resource_not_found. Error
    409 Cerere refuzată: revision_conflict. Error
    422 Cerere refuzată: invalid‑settings. Error
    429 Cerere refuzată: rate_limited. Error
    503 Cerere refuzată: unavailable. Error

    Cerere

    curl

    curl "$RDC_BASE_URL/integrations/v1/triggers/trigger-order" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

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

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/integrations/v1/triggers/trigger-order');
    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")}/integrations/v1/triggers/trigger-order");
    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

    JSON

    {
      "id": "trigger-order",
      "flowId": "flow-order",
      "version": 1,
      "kind": "webhook",
      "enabled": true,
      "revision": 1
    }