Employers
The employers of your account: add one and read it.
On this page
List employers
GET /reges/v1/employers
Returns the employers of your account in pages.
Parameters
| Name | In | Type | Required | Meaning |
|---|---|---|---|---|
limit | query | integer | Nooptional | Records per page, from 1 to 500. Default 100 Range 1 – 500 |
cursor | query | string | Nooptional | The nextCursor of the previous page. |
Responses
| Status | Meaning | Body |
|---|---|---|
200 | A page of employers. | EmployerPage |
401 | The token is missing, has expired or is not ours. | Error |
403 | The token does not give access to this employer or operation. | Error |
429 | There were too many requests. Nothing was processed. The header Retry-After gives the seconds to wait. | Error |
503 | The gateway cannot answer now. | Error |
Request
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(); Response 200
{
"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
} Add an employer
POST /reges/v1/employers
Adds an employer to your account by its CUI. Access permissions for the employer are added afterwards.
Request body
| Field | Type | Required | Meaning |
|---|---|---|---|
operationId | string (uuid) | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
cui | string | Yesrequired | The tax code of the employer, digits only. |
name | string | Yesrequired | Name of the employer. |
Responses
| Status | Meaning | Body |
|---|---|---|
202 | The change was accepted. The body is the operation result: aggregateId is the record that was created or changed. | OperationResult |
400 | The request cannot be read or breaks the contract: the JSON is malformed, a field is missing or unknown, or a type is wrong. fields names each one. | Error |
401 | The token is missing, has expired or is not ours. | Error |
403 | The token does not give access to this employer or operation. | Error |
409 | operation_reused: The operationId was already used with a different request. employer_exists: An employer with this CUI is already in your account. | Error |
429 | There were too many requests. Nothing was processed. The header Retry-After gives the seconds to wait. | Error |
503 | The gateway cannot answer now. | Error |
Request
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(); Response 202
{
"operationId": "b4c34456-bb2e-4236-b9f4-0b4fa754e1fd",
"status": "accepted",
"aggregateId": "a113262e-61fd-426c-ae7e-44e13d8ec508",
"aggregateRevision": 1
} Get an employer
GET /reges/v1/employers/{employerId}
Parameters
| Name | In | Type | Required | Meaning |
|---|---|---|---|---|
employerId | path | string (uuid) | Yesrequired | The employer. |
Responses
| Status | Meaning | Body |
|---|---|---|
200 | The employer at its current revision. | Employer |
401 | The token is missing, has expired or is not ours. | Error |
403 | The token does not give access to this employer or operation. | Error |
404 | The employer does not exist in your account. | Error |
429 | There were too many requests. Nothing was processed. The header Retry-After gives the seconds to wait. | Error |
503 | The gateway cannot answer now. | Error |
Request
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(); Response 200
{
"id": "6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0",
"name": "Brumar Distribuție SRL",
"cui": "48290619",
"revision": 1
}