Salt la conținut
Documentație

Caută în documentație

    English

    Ghid rapid

    Creează o companie și o oportunitate, verifică rezultatul și citește‑le pe amândouă, cu cinci cereri.

    Pe această pagină

    Ai nevoie de datele de acces ale clientului și de adresa de bază a companiei tale de test. Exemplele le citesc din variabilele de mediu: $RDC_BASE_URL și $RDC_TOKEN. Pentru token vezi Autentificare.

    Creează o companie

    Alege un operationId nou și dă companiei, ca externalId, numărul pe care îl are în sistemul tău. Vei găsi compania după acest număr mai jos.

    curl

    curl -X POST "$RDC_BASE_URL/crm/v1/companies" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "44a8eb19-bcfd-401a-b2b6-c411f3db86cb",
      "name": "Hanul Ozana SRL",
      "cif": "RO39172541",
      "owner": "andrei-pop",
      "industry": "Inn and restaurant",
      "employees": 18,
      "town": "Târgu Neamț",
      "county": "Neamț",
      "source": "form",
      "externalId": "cust-0231"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/companies`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "44a8eb19-bcfd-401a-b2b6-c411f3db86cb",
        "name": "Hanul Ozana SRL",
        "cif": "RO39172541",
        "owner": "andrei-pop",
        "industry": "Inn and restaurant",
        "employees": 18,
        "town": "Târgu Neamț",
        "county": "Neamț",
        "source": "form",
        "externalId": "cust-0231"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/crm/v1/companies',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '44a8eb19-bcfd-401a-b2b6-c411f3db86cb',
            'name': 'Hanul Ozana SRL',
            'cif': 'RO39172541',
            'owner': 'andrei-pop',
            'industry': 'Inn and restaurant',
            'employees': 18,
            'town': 'Târgu Neamț',
            'county': 'Neamț',
            'source': 'form',
            'externalId': 'cust-0231',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "44a8eb19-bcfd-401a-b2b6-c411f3db86cb",
      "name": "Hanul Ozana SRL",
      "cif": "RO39172541",
      "owner": "andrei-pop",
      "industry": "Inn and restaurant",
      "employees": 18,
      "town": "Târgu Neamț",
      "county": "Neamț",
      "source": "form",
      "externalId": "cust-0231"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/companies');
    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")}/crm/v1/companies");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "44a8eb19-bcfd-401a-b2b6-c411f3db86cb",
      "name": "Hanul Ozana SRL",
      "cif": "RO39172541",
      "owner": "andrei-pop",
      "industry": "Inn and restaurant",
      "employees": 18,
      "town": "Târgu Neamț",
      "county": "Neamț",
      "source": "form",
      "externalId": "cust-0231"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Răspuns 202

    {
      "operationId": "44a8eb19-bcfd-401a-b2b6-c411f3db86cb",
      "status": "accepted",
      "aggregateRevision": 1
    }

    Citește rezultatul

    Caută operația după operationId-ul pe care l‑ai trimis. Când status este completed, compania există.

    curl

    curl "$RDC_BASE_URL/crm/v1/operations/3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/operations/3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12`, {
      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"]}/crm/v1/operations/3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/operations/3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12');
    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")}/crm/v1/operations/3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12");
    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": "3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12",
      "status": "completed",
      "aggregateRevision": 1
    }

    StareSemnificație
    Cererea a fost înregistrată și urmează să fie aplicată.
    Modificarea a fost aplicată.
    Cererea a fost refuzată. Nimic nu a fost modificat.

    Găsește compania

    Răspunsul la o modificare nu conține identificatorul înregistrării noi. Cere compania după numărul tău. id din răspuns este companyId pentru oportunitățile create în continuare. Identificatorii tăi proprii explică de ce.

    curl

    curl "$RDC_BASE_URL/crm/v1/companies?externalId=cust-0231" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

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

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/companies?externalId=cust-0231');
    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")}/crm/v1/companies?externalId=cust-0231");
    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": "61d54dde-e1f3-43da-b2fc-a4a21540e5f3",
          "name": "Hanul Ozana SRL",
          "cif": "RO39172541",
          "owner": "andrei-pop",
          "status": "customer",
          "industry": "Inn and restaurant",
          "employees": 18,
          "town": "Târgu Neamț",
          "county": "Neamț",
          "source": "form",
          "summary": {
            "text": "Inn and restaurant on the road to Târgu Neamț. The kitchen orders every week; a second delivery point for the events hall is being agreed.",
            "by": "andrei-pop",
            "at": "2026-11-16"
          },
          "externalId": "cust-0231",
          "customFields": {},
          "revision": 1
        }
      ],
      "nextCursor": null
    }

    Creează o oportunitate

    Trimite oportunitatea cu companyId pe care tocmai l‑ai citit. Pornește ca lead, iar răspunsul spune că modificarea a fost acceptată.

    curl

    curl -X POST "$RDC_BASE_URL/crm/v1/deals" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12",
      "companyId": "61d54dde-e1f3-43da-b2fc-a4a21540e5f3",
      "name": "First order for the kitchen",
      "owner": "andrei-pop",
      "value": "2818.41",
      "expectedClose": "2026-12-18",
      "externalId": "cust-0231-first-order"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/deals`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12",
        "companyId": "61d54dde-e1f3-43da-b2fc-a4a21540e5f3",
        "name": "First order for the kitchen",
        "owner": "andrei-pop",
        "value": "2818.41",
        "expectedClose": "2026-12-18",
        "externalId": "cust-0231-first-order"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/crm/v1/deals',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12',
            'companyId': '61d54dde-e1f3-43da-b2fc-a4a21540e5f3',
            'name': 'First order for the kitchen',
            'owner': 'andrei-pop',
            'value': '2818.41',
            'expectedClose': '2026-12-18',
            'externalId': 'cust-0231-first-order',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12",
      "companyId": "61d54dde-e1f3-43da-b2fc-a4a21540e5f3",
      "name": "First order for the kitchen",
      "owner": "andrei-pop",
      "value": "2818.41",
      "expectedClose": "2026-12-18",
      "externalId": "cust-0231-first-order"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/deals');
    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")}/crm/v1/deals");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12",
      "companyId": "61d54dde-e1f3-43da-b2fc-a4a21540e5f3",
      "name": "First order for the kitchen",
      "owner": "andrei-pop",
      "value": "2818.41",
      "expectedClose": "2026-12-18",
      "externalId": "cust-0231-first-order"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Răspuns 202

    {
      "operationId": "3c9d2f6a-5b1e-4d7a-8f20-6a1b9c0e4d12",
      "status": "accepted",
      "aggregateRevision": 1
    }

    Citește oportunitatea

    Găsește oportunitatea după numărul ei. Notează‑i stage și revision: următoarea modificare a oportunității trimite revizia ca expectedRevision.

    curl

    curl "$RDC_BASE_URL/crm/v1/deals?externalId=cust-0231-first-order" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

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

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/deals?externalId=cust-0231-first-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")}/crm/v1/deals?externalId=cust-0231-first-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

    {
      "items": [
        {
          "id": "4b1c7a52-9e03-4d6f-8a17-c05e2d9b6f31",
          "number": "DL-1031",
          "companyId": "61d54dde-e1f3-43da-b2fc-a4a21540e5f3",
          "company": "Hanul Ozana SRL",
          "name": "First order for the kitchen",
          "owner": "andrei-pop",
          "value": "2818.41",
          "currency": "RON",
          "stage": "won",
          "reason": "range",
          "expectedClose": "2026-11-17",
          "order": "CV-1042",
          "externalId": "cust-0231-first-order",
          "customFields": {},
          "revision": 6
        }
      ],
      "nextCursor": null
    }

    Mai departe