Properties and classes
Change the properties of a draft and read the classes: their approvers by amount, whether they are signed, how long they are kept and who opens them.
On this page
Change the properties of a draft
POST /documents/v1/documents/{documentId}/properties
Changes the name, the counterparty, the project, the date or the amount of a draft. Send only what changes.
Parameters
| Name | In | Type | Required | Meaning |
|---|---|---|---|---|
documentId | path | string (uuid) | Yesrequired | The document. |
Request body
| Field | Type | Required | Meaning |
|---|---|---|---|
operationId | string (uuid) | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
expectedRevision | integer | Yesrequired | The revision of the document you read. |
name | string | Nooptional | The name of the document. |
counterpartyId | string (uuid) | Nooptional | The customer, supplier or carrier the document is with. |
project | string | Nooptional | The project the document belongs to. |
date | string (date) | Nooptional | The date on the document, YYYY-MM-DD. The keep-until date counts from the end of its year. |
amount | string | Nooptional | The gross amount as a decimal string, in RON. A class that is routed by amount needs one before it is submitted. |
by | string | Yesrequired | Who makes the change. |
Responses
| Status | Meaning | Body |
|---|---|---|
202 | The change was accepted. The body is the operation result. | OperationResult |
400 | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. fields names each one. | Error |
401 | The token is missing, expired or not ours. | Error |
403 | The token does not give access to this company or operation. | Error |
404 | The request was refused. The code is document_not_found, person_not_found or counterparty_not_found. | Error |
409 | The request was refused. The code is document_archived, revision_conflict, operation_reused or document_not_draft. | Error |
422 | The request was refused. The code is name_required, date_not_valid, amount_not_valid or nothing_to_change. | Error |
429 | The request was refused and not processed: the code is rate_limited. Wait the seconds in the header Retry-After, then send it again with the same operationId. | Error |
503 | The service cannot answer now: the code is unavailable. Send the request again with the same operationId. | Error |
Request
curl
curl -X POST "$RDC_BASE_URL/documents/v1/documents/417fc646-2924-483f-b1d7-b2c07692e924/properties" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "66a3c447-ac92-4bec-8056-4be113f4de08",
"expectedRevision": 1,
"by": "sorin-avram",
"name": "Transport agreement 2027, Transbistrița Logistic",
"amount": "64500.00"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/documents/417fc646-2924-483f-b1d7-b2c07692e924/properties`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "66a3c447-ac92-4bec-8056-4be113f4de08",
"expectedRevision": 1,
"by": "sorin-avram",
"name": "Transport agreement 2027, Transbistrița Logistic",
"amount": "64500.00"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/documents/v1/documents/417fc646-2924-483f-b1d7-b2c07692e924/properties',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '66a3c447-ac92-4bec-8056-4be113f4de08',
'expectedRevision': 1,
'by': 'sorin-avram',
'name': 'Transport agreement 2027, Transbistrița Logistic',
'amount': '64500.00',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "66a3c447-ac92-4bec-8056-4be113f4de08",
"expectedRevision": 1,
"by": "sorin-avram",
"name": "Transport agreement 2027, Transbistrița Logistic",
"amount": "64500.00"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/documents/417fc646-2924-483f-b1d7-b2c07692e924/properties');
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")}/documents/v1/documents/417fc646-2924-483f-b1d7-b2c07692e924/properties");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "66a3c447-ac92-4bec-8056-4be113f4de08",
"expectedRevision": 1,
"by": "sorin-avram",
"name": "Transport agreement 2027, Transbistrița Logistic",
"amount": "64500.00"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); Response 202
{
"operationId": "66a3c447-ac92-4bec-8056-4be113f4de08",
"status": "accepted",
"aggregateRevision": 2
} List classes
GET /documents/v1/classes
Returns the classes of document: their approvers by amount, whether they are signed, the years they are kept and the groups that open them.
Parameters
| Name | In | Type | Required | Meaning |
|---|---|---|---|---|
limit | query | integer | Nooptional | Records per page. Default 100 Range 1 – 500 |
cursor | query | string | Nooptional | The nextCursor of the previous page. |
Responses
| Status | Meaning | Body |
|---|---|---|
200 | A page of records. | ClassPage |
400 | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. fields names each one. | Error |
401 | The token is missing, expired or not ours. | Error |
403 | The token does not give access to this company or operation. | Error |
429 | The request was refused and not processed: the code is rate_limited. Wait the seconds in the header Retry-After, then send it again with the same operationId. | Error |
503 | The service cannot answer now: the code is unavailable. Send the request again with the same operationId. | Error |
Request
curl
curl "$RDC_BASE_URL/documents/v1/classes?limit=20" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/documents/v1/classes?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"]}/documents/v1/classes?limit=20',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/documents/v1/classes?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")}/documents/v1/classes?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": "contract",
"signed": true,
"keepYears": 10,
"readers": [
"finance",
"sales",
"purchasing"
],
"approval": {
"limit": "100000.00",
"approvers": [
"ioana-marin",
"ana-rusu"
]
}
},
{
"id": "invoice",
"signed": false,
"keepYears": 10,
"readers": [
"finance",
"purchasing"
],
"approval": {
"limit": "25000.00",
"approvers": [
"ioana-marin",
"ana-rusu"
]
}
},
{
"id": "offer",
"signed": true,
"keepYears": 3,
"readers": [
"finance",
"sales"
],
"approval": {
"limit": "50000.00",
"approvers": [
"ioana-marin",
"ana-rusu"
]
}
},
{
"id": "report",
"signed": false,
"keepYears": 5,
"readers": [
"finance",
"warehouse"
],
"approval": {
"limit": null,
"approvers": [
"ana-rusu"
]
}
}
],
"nextCursor": null
}