Operations
A request that changes data is accepted once and answered with an operation result you can read again.
On this page
Every request that changes data carries an operationId, a UUID you choose. The API answers 202 with the result of the operation. Idempotency and concurrency explains how to repeat a request safely.
Send the change
Put a new
operationIdin the body of the request.Read the result
The answer holds
operationId,status,aggregateIdandaggregateRevision.Look it up if the answer is lost
Ask for the operation by its
operationId. You get the first outcome, whenever you ask.
Status of an operation
| Status | Meaning |
|---|---|
| The request was recorded and is being applied. | |
| The change was applied. | |
| The request was understood and refused. Nothing was changed. |
aggregateId is the record the change concerns: the postingRequestId for a posting request, the reversed entry for a reversal, the subscription for a subscription and the delivery for a replay. aggregateRevision is the revision of that record after the change.
The status of an operation is not the status of a posting request. An operation is completed when the request has been dealt with, even when the posting request it created is still accepted or ends rejected. Read the posting request for that: see Operational facts and postings.
Get an operation
GET /accounting/v1/operations/{operationId}
Returns the first outcome of a change, by the operationId you sent.
Parameters
| Name | In | Type | Required | Meaning |
|---|---|---|---|---|
operationId | path | string (uuid) | Yesrequired | The operationId of the change. |
Responses
| Status | Meaning | Body |
|---|---|---|
200 | The operation result. | OperationResult |
401 | The token is missing, has expired or is not ours. | Error |
403 | The token does not give access to this account or company, or customerOrgId or legalCompanyId in the body is not the one of the token. | Error |
404 | No change was sent with this operationId. | Error |
429 | There were too many requests. Nothing was processed. The header Retry-After gives the seconds to wait. | Error |
503 | The service cannot answer now. | Error |
Request
curl
curl "$RDC_BASE_URL/accounting/v1/operations/32a34b30-2203-436d-897c-707b3c3770bd" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/accounting/v1/operations/32a34b30-2203-436d-897c-707b3c3770bd`, {
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"]}/accounting/v1/operations/32a34b30-2203-436d-897c-707b3c3770bd',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/accounting/v1/operations/32a34b30-2203-436d-897c-707b3c3770bd');
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")}/accounting/v1/operations/32a34b30-2203-436d-897c-707b3c3770bd");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); Response 200
{
"operationId": "32a34b30-2203-436d-897c-707b3c3770bd",
"status": "completed",
"aggregateId": "b7007a22-a9ea-4fcb-b535-e0570cdd1f2e",
"aggregateRevision": 2
} The full rule: Developer guide