Salt la conținut
Documentație

Caută în documentație

    English

    Ghid rapid

    Pune o întrebare în compania de test și deschide sursa citată.

    Pe această pagină

    Folosește adresa de bază și datele de acces primite la deschiderea contului, pentru compania de test. Urmează pașii din Autentificare și setează RDC_BASE_URL și RDC_TOKEN în terminal. Clientul trebuie să aibă acces la colecția în care cauți.

    Trimite întrebarea

    Alege un UUID nou pentru operationId și un conversationId nefolosit. Păstrează ambii identificatori. Pentru o conversație nouă, trimite expectedRevision: 0.

    Pentru un răspuns în română, setează language la ro. Răspunsul, title și passage vin atunci în română.

    curl

    curl -X POST "$RDC_BASE_URL/ai/v1/conversations" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "question": "What payment term did we agree with Hanul Ozana?",
      "scope": "all",
      "language": "en",
      "operationId": "86c4fe37-99d4-4bfc-a8f1-347afc902a56",
      "expectedRevision": 0,
      "conversationId": "review-1042"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/ai/v1/conversations`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "question": "What payment term did we agree with Hanul Ozana?",
        "scope": "all",
        "language": "en",
        "operationId": "86c4fe37-99d4-4bfc-a8f1-347afc902a56",
        "expectedRevision": 0,
        "conversationId": "review-1042"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/ai/v1/conversations',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'question': 'What payment term did we agree with Hanul Ozana?',
            'scope': 'all',
            'language': 'en',
            'operationId': '86c4fe37-99d4-4bfc-a8f1-347afc902a56',
            'expectedRevision': 0,
            'conversationId': 'review-1042',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "question": "What payment term did we agree with Hanul Ozana?",
      "scope": "all",
      "language": "en",
      "operationId": "86c4fe37-99d4-4bfc-a8f1-347afc902a56",
      "expectedRevision": 0,
      "conversationId": "review-1042"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/ai/v1/conversations');
    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")}/ai/v1/conversations");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "question": "What payment term did we agree with Hanul Ozana?",
      "scope": "all",
      "language": "en",
      "operationId": "86c4fe37-99d4-4bfc-a8f1-347afc902a56",
      "expectedRevision": 0,
      "conversationId": "review-1042"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Răspuns 202

    {
      "operationId": "86c4fe37-99d4-4bfc-a8f1-347afc902a56",
      "status": "accepted",
      "aggregateRevision": 1
    }

    Citește rezultatul

    Caută operația după identificatorul trimis. Când ajunge în starea completed, citește conversația după identificatorul ei. O operație respinsă are un cod de eroare. Dacă nu primești răspuns la timp, retrimite același corp al cererii, cu același UUID.

    curl

    curl "$RDC_BASE_URL/ai/v1/operations/86c4fe37-99d4-4bfc-a8f1-347afc902a56" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/ai/v1/operations/86c4fe37-99d4-4bfc-a8f1-347afc902a56`, {
      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"]}/ai/v1/operations/86c4fe37-99d4-4bfc-a8f1-347afc902a56',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/ai/v1/operations/86c4fe37-99d4-4bfc-a8f1-347afc902a56');
    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")}/ai/v1/operations/86c4fe37-99d4-4bfc-a8f1-347afc902a56");
    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

    {
      "operationId": "86c4fe37-99d4-4bfc-a8f1-347afc902a56",
      "status": "completed",
      "aggregateRevision": 1
    }

    curl

    curl "$RDC_BASE_URL/ai/v1/conversations/review-1042" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

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

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/ai/v1/conversations/review-1042');
    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")}/ai/v1/conversations/review-1042");
    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

    {
      "id": "review-1042",
      "revision": 1,
      "status": "answered",
      "answer": "Hanul Ozana pays by bank transfer at the end of the month after delivery. [1] Clause 6.2 of the contract sets the last day of the month after delivery as the due date. [2] On orders delivered in parts, the period starts with the last delivery. [3]",
      "citations": [
        {
          "id": "account",
          "system": "CRM",
          "title": "Hanul Ozana account notes",
          "owner": "Andrei Pop",
          "changed": "2026-11-17T15:40:00Z",
          "path": "/sales/hanul-ozana",
          "scope": "sales",
          "passage": "Hanul Ozana pays by bank transfer at the end of the month after delivery.",
          "number": 1,
          "canRead": true
        },
        {
          "id": "contract",
          "system": "DMS",
          "title": "Payment terms",
          "owner": "Ioana Marin",
          "changed": "2026-09-03T10:30:00Z",
          "path": "/contracts/payment",
          "scope": "contracts",
          "passage": "Clause 6.2 of the contract sets the last day of the month after delivery as the due date.",
          "number": 2,
          "canRead": true
        },
        {
          "id": "annex",
          "system": "DMS",
          "title": "Payment annex",
          "owner": "Ana Rusu",
          "changed": "2026-10-21T13:10:00Z",
          "path": "/contracts/payment-annex",
          "scope": "contracts",
          "passage": "On orders delivered in parts, the period starts with the last delivery.",
          "number": 3,
          "canRead": true
        }
      ],
      "hiddenCount": 0
    }

    Deschide pasajul citat

    Preia citations[].id din conversație. Dacă starea este no_answer, verifică mai întâi colecția și drepturile clientului.

    curl

    curl "$RDC_BASE_URL/ai/v1/documents/account" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

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

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/ai/v1/documents/account');
    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")}/ai/v1/documents/account");
    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

    {
      "id": "account",
      "system": "CRM",
      "title": "Hanul Ozana account notes",
      "owner": "Andrei Pop",
      "changed": "2026-11-17T15:40:00Z",
      "path": "/sales/hanul-ozana",
      "scope": "sales",
      "passage": "Hanul Ozana pays by bank transfer at the end of the month after delivery."
    }