Items and warehouses
The items you buy, make and sell, with their stock, and the warehouses that hold it.
On this page
List items
GET /erp/v1/items
Returns items in pages, by code. The stock fields are totals over the warehouses.
Parameters
| Name | In | Type | Required | Meaning |
|---|---|---|---|---|
made | query | boolean | Nooptional | true keeps the items that are made, false the ones that are bought. |
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 items. | ItemPage |
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 service cannot answer now. | Error |
Request
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(); Response 200
{
"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
} Create an item
POST /erp/v1/items
Adds an item with its sales price and VAT class. The VAT rate follows the class.
Request body
| Field | Type | Required | Meaning |
|---|---|---|---|
operationId | string (uuid) | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
code | string | Yesrequired | Code of the item. |
name | string | Yesrequired | Name of the item. |
unit | string | Yesrequired | Unit of the item. |
unitPrice | string | Yesrequired | Net sales price of one unit. |
vatClass | string | Yesrequired | standard or reduced. One of standard, reduced |
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 and says what is wrong with it. | Error |
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 |
409 | operation_reused: The operationId was used before with a different request. item_code_taken: An item with this code already exists. | 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 -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(); Response 202
{
"operationId": "165ff430-37fd-46db-8215-bdb803f7fa8d",
"status": "accepted",
"aggregateId": "99c92e8e-31cd-4090-ad40-ac0ad9e8f317",
"aggregateRevision": 1
} Get an item
GET /erp/v1/items/{itemId}
Parameters
| Name | In | Type | Required | Meaning |
|---|---|---|---|---|
itemId | path | string (uuid) | Yesrequired | The item. |
Responses
| Status | Meaning | Body |
|---|---|---|
200 | The item with its stock. | Item |
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 |
404 | The item does not exist. | 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/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(); Response 200
{
"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"
} List warehouses
GET /erp/v1/warehouses
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 warehouses. | WarehousePage |
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 service cannot answer now. | Error |
Request
curl
curl "$RDC_BASE_URL/erp/v1/warehouses?limit=20" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/warehouses?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/warehouses?limit=20',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/warehouses?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/warehouses?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": "418d35c2-d9c8-4021-917a-04c8ebe593a7",
"name": "Central warehouse"
}
],
"nextCursor": null
}