Add an employer
Add an employer to your account by its CUI, read it and see what it holds.
On this page
An account holds the employers you prepare register operations for. Each employer is identified by its CUI and has its own access permissions, contracts, register operations and event endpoint. The id of an employer is the employerId of every request about its records and the legalCompanyId of its events.
Add the employer
Send the CUI, digits only, and the name of the employer. The answer is an operation result, and aggregateId is the id of the new employer. Adding the same CUI twice is refused with employer_exists.
curl
curl -X POST "$RDC_BASE_URL/reges/v1/employers" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "b4c34456-bb2e-4236-b9f4-0b4fa754e1fd",
"cui": "62049137",
"name": "Transbistrița Logistic SRL"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/reges/v1/employers`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "b4c34456-bb2e-4236-b9f4-0b4fa754e1fd",
"cui": "62049137",
"name": "Transbistrița Logistic SRL"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/reges/v1/employers',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': 'b4c34456-bb2e-4236-b9f4-0b4fa754e1fd',
'cui': '62049137',
'name': 'Transbistrița Logistic SRL',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "b4c34456-bb2e-4236-b9f4-0b4fa754e1fd",
"cui": "62049137",
"name": "Transbistrița Logistic SRL"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/reges/v1/employers');
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")}/reges/v1/employers");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "b4c34456-bb2e-4236-b9f4-0b4fa754e1fd",
"cui": "62049137",
"name": "Transbistrița Logistic SRL"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "b4c34456-bb2e-4236-b9f4-0b4fa754e1fd",
"status": "accepted",
"aggregateId": "a113262e-61fd-426c-ae7e-44e13d8ec508",
"aggregateRevision": 1
} Read the employer
| Field | Meaning |
|---|---|
id | The identifier of the employer. Send it as employerId. |
name | The name of the employer. |
cui | The tax code of the employer, digits only. |
revision | The revision of the employer. |
curl
curl "$RDC_BASE_URL/reges/v1/employers/6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/reges/v1/employers/6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0`, {
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"]}/reges/v1/employers/6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/reges/v1/employers/6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0');
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")}/reges/v1/employers/6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"id": "6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0",
"name": "Brumar Distribuție SRL",
"cui": "48290619",
"revision": 1
} listEmployers returns every employer of the account in pages. See Pagination.
curl
curl "$RDC_BASE_URL/reges/v1/employers?limit=20" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/reges/v1/employers?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"]}/reges/v1/employers?limit=20',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/reges/v1/employers?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")}/reges/v1/employers?limit=20");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"items": [
{
"id": "6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0",
"name": "Brumar Distribuție SRL",
"cui": "48290619",
"revision": 1
},
{
"id": "6f90be8d-78b7-4a97-9b06-7cc6db931f53",
"name": "Brumar Retail SRL",
"cui": "48290783",
"revision": 1
}
],
"nextCursor": null
} What an employer holds
| Record | Read it with |
|---|---|
| Access permissions of its designated persons and providers | listPermissions |
| Individual employment contracts, with their state | listContracts |
| Register operations | listRegisterOperations |
| Subscriptions to its events | listSubscriptions |
listPermissions takes the id of the employer in its path; listContracts and listRegisterOperations take it as employerId; a subscription names its employer in employerId. See Employers for every call.