Validations
The catalogue of the checks that run on a declaration before it is sent.
List the validation rules
GET /etransport/v1/validation-rules
Returns the catalogue of the checks, each with the rule of the authority behind it where it has one.
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 rules. | ValidationRulePage |
401 | The token is missing, has expired or is not ours. | Error |
403 | The token does not give access to this company 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/etransport/v1/validation-rules?limit=20" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/etransport/v1/validation-rules?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"]}/etransport/v1/validation-rules?limit=20',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/etransport/v1/validation-rules?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")}/etransport/v1/validation-rules?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": "partner_country",
"rule": "BR-004 BR-005 BR-006",
"severity": "error",
"description": "The partner of a transport within Romania is in Romania; of an import or an export, outside the Union; of any other operation, in another member state."
},
{
"id": "partner_code",
"rule": "BR-007",
"severity": "error",
"description": "For a transport within Romania the partner has a valid tax code, or PF."
},
{
"id": "partner_name",
"rule": "XSD",
"severity": "error",
"description": "The partner has a name, required, of at most 200 characters."
},
{
"id": "transporter_country",
"rule": "XSD",
"severity": "error",
"description": "The transporter has a country, as a two-letter code."
}
],
"nextCursor": "rules-4"
}