Companies and warehouses
Which company a call acts for, and where stock is kept.
On this page
The company
Every document belongs to one legal company. The client credentials you receive are issued for one company, and every request acts for it: you never name the company in a request, and you cannot read or change the documents of another one. A group of companies has one set of credentials per company.
Events carry the company as legalCompanyId and the account as customerOrgId, so one endpoint can serve several companies and still tell them apart. See Event envelope.
Customers and suppliers
Customers and suppliers are partners of the company. A partner has roles: a customer has terms of payment (paymentTermsDays) and a creditLimit, a supplier has neither. Orders name their partner by customerId or supplierId, the id of the partner.
Warehouses
Stock is kept in the warehouses of the company. GET /warehouses lists them. A receipt names the warehouse the goods go into and a delivery the one the units leave, both with warehouseId; a company with one warehouse can leave it out.
The stock fields of an item (onHand, reserved, available, incoming) are totals over the warehouses. See Items, units and prices for what each one counts.
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(); {
"items": [
{
"id": "418d35c2-d9c8-4021-917a-04c8ebe593a7",
"name": "Central warehouse"
}
],
"nextCursor": null
}