Items, units and prices
What an item is, how quantities and prices are written, and what the four stock figures count.
On this page
An item is anything you buy, make or sell. It has a code that is unique in the company, a name, a unit and a net sales price, unitPrice. A purchased item has a cost; a made item (made is true) has a bill of materials, and its cost is the cost of its components.
Get an item
curl
curl "$RDC_BASE_URL/erp/v1/items/1f30c60b-f896-443e-9086-2e72ab3dcc3c" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/items/1f30c60b-f896-443e-9086-2e72ab3dcc3c`, {
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"]}/erp/v1/items/1f30c60b-f896-443e-9086-2e72ab3dcc3c',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/items/1f30c60b-f896-443e-9086-2e72ab3dcc3c');
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")}/erp/v1/items/1f30c60b-f896-443e-9086-2e72ab3dcc3c");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"id": "1f30c60b-f896-443e-9086-2e72ab3dcc3c",
"code": "FA-0010",
"name": "White flour, 10 kg bag",
"unit": "bag",
"unitPrice": "38.90",
"vatClass": "reduced",
"vatRate": "11",
"cost": "32.50",
"made": false,
"onHand": "36",
"reserved": "0",
"available": "36",
"incoming": "0"
} Quantities and prices
- Quantities are whole units, from 1, written as decimal strings:
"24". A fraction is refused withinvalid_quantity. - Prices and amounts are decimal strings with at most two decimals, in RON:
"38.90". They are net, without VAT, unless the field is atotal. - A line takes the
unitPriceof its item when the line is added. A later change of the price of the item does not change the lines that exist.
The four stock figures
| Field | Counts |
|---|---|
onHand | Units in the warehouses. |
reserved | Units set aside for sales orders that are confirmed or reserved. A delivery releases them from the reservation and from onHand together. |
available | onHand less reserved: what can still be reserved, or used by a work order. |
incoming | Units on purchase orders that have not arrived, line by line, never below zero. |
Only the stored figure onHand is ever written: a receipt adds to it, a delivery and a work order take from it. The other three follow from the documents.
curl
curl "$RDC_BASE_URL/erp/v1/items?limit=20" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/items?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"]}/erp/v1/items?limit=20',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/items?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")}/erp/v1/items?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": "1f30c60b-f896-443e-9086-2e72ab3dcc3c",
"code": "FA-0010",
"name": "White flour, 10 kg bag",
"unit": "bag",
"unitPrice": "38.90",
"vatClass": "reduced",
"vatRate": "11",
"cost": "32.50",
"made": false,
"onHand": "36",
"reserved": "0",
"available": "36",
"incoming": "0"
},
{
"id": "42c7977f-e96f-4243-b6fe-f133d52b1f18",
"code": "UL-0101",
"name": "Sunflower oil, 1 l",
"unit": "bottle",
"unitPrice": "7.84",
"vatClass": "reduced",
"vatRate": "11",
"cost": "6.40",
"made": false,
"onHand": "140",
"reserved": "48",
"available": "92",
"incoming": "0"
},
{
"id": "4a929b04-42fc-4df8-9784-852fdd270787",
"code": "ZA-0201",
"name": "Sugar, 1 kg",
"unit": "bag",
"unitPrice": "4.29",
"vatClass": "reduced",
"vatRate": "11",
"cost": "3.50",
"made": false,
"onHand": "210",
"reserved": "0",
"available": "210",
"incoming": "0"
}
],
"nextCursor": null
} curl
curl -X POST "$RDC_BASE_URL/erp/v1/items" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "165ff430-37fd-46db-8215-bdb803f7fa8d",
"code": "DT-0450",
"name": "Floor cleaner, 5 l",
"unit": "canister",
"unitPrice": "21.50",
"vatClass": "standard"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/items`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "165ff430-37fd-46db-8215-bdb803f7fa8d",
"code": "DT-0450",
"name": "Floor cleaner, 5 l",
"unit": "canister",
"unitPrice": "21.50",
"vatClass": "standard"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/erp/v1/items',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '165ff430-37fd-46db-8215-bdb803f7fa8d',
'code': 'DT-0450',
'name': 'Floor cleaner, 5 l',
'unit': 'canister',
'unitPrice': '21.50',
'vatClass': 'standard',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "165ff430-37fd-46db-8215-bdb803f7fa8d",
"code": "DT-0450",
"name": "Floor cleaner, 5 l",
"unit": "canister",
"unitPrice": "21.50",
"vatClass": "standard"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/items');
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")}/erp/v1/items");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "165ff430-37fd-46db-8215-bdb803f7fa8d",
"code": "DT-0450",
"name": "Floor cleaner, 5 l",
"unit": "canister",
"unitPrice": "21.50",
"vatClass": "standard"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "165ff430-37fd-46db-8215-bdb803f7fa8d",
"status": "accepted",
"aggregateId": "99c92e8e-31cd-4090-ad40-ac0ad9e8f317",
"aggregateRevision": 1
}