Retrieve a page of divisions belonging to one business unit using an offset and requested item count.
Request
GET https://api.myzahara.net/api/{businessUnitApiKey}/BusinessDivision/Get/{skip}/{take}
Send Accept: application/json. No request body appears in the supplied definition.
Put skip and take in the URL path after BusinessDivision/Get. Set ZAHARA_SKIP and ZAHARA_TAKE; tests used 0 and 3, while samples default to 0 and 5.
Authentication and scope
| Parameter | Location | Meaning |
|---|---|---|
| businessUnitApiKey | URL path | API key for the owning business unit; not a tenancy key, numeric ID or user name. |
| skip | URL path | Integer ≥ 0; sample default 0. |
| take | URL path | Integer ≥ 1; sample default 5. |
Store the key in an environment variable or secret store. Because it appears in the URL path, redact request URLs in logs, proxies and monitoring. Do not put real keys in source examples, shared screenshots or coding-agent prompts. Response codes and names may also be confidential.
Working examples
The cURL, Node.js and Python programs were each executed successfully against the production API on 25 November 2026. Result shapes and item counts matched the direct request.
| Environment variable | Purpose |
|---|---|
| ZAHARA_BUSINESS_UNIT_API_KEY | Business-unit API key, kept private. |
| ZAHARA_SKIP | skip; default 0. Use a valid integer in the documented context. |
| ZAHARA_TAKE | take; default 5. Use a valid integer in the documented context. |
cURL
Requires cURL 7.76.0+ for --fail-with-body. It prints the full result; use a secure development terminal.
# cURL 7.76.0+. Set the environment variables documented below.
# Treat response data as confidential. Keep keys out of logs.
set -e
curl --fail-with-body --silent --show-error --max-time 30 \
--request GET \
--header 'Accept: application/json' \
"https://api.myzahara.net/api/${ZAHARA_BUSINESS_UNIT_API_KEY:?Set ZAHARA_BUSINESS_UNIT_API_KEY}/BusinessDivision/Get/${ZAHARA_SKIP:-0}/${ZAHARA_TAKE:-5}"
JavaScript (Node.js 22+)
Uses built-in fetch, a 30-second timeout and an HTTP status check. No extra packages are required.
// Node.js 22+. Standard library only.
function required(name) {
const value = process.env[name];
if (!value) throw new Error('Set ' + name);
return value;
}
const key = required('ZAHARA_BUSINESS_UNIT_API_KEY');
const base = 'https://api.myzahara.net';
let path = "BusinessDivision/Get/{skip}/{take}";
const skip = process.env.ZAHARA_SKIP || '0';
if (!/^\d+$/.test(skip) || !Number.isSafeInteger(Number(skip)) || Number(skip) < 0) throw new Error('Invalid ZAHARA_SKIP');
path = path.replace('{skip}', encodeURIComponent(skip));
const take = process.env.ZAHARA_TAKE || '5';
if (!/^\d+$/.test(take) || !Number.isSafeInteger(Number(take)) || Number(take) < 1) throw new Error('Invalid ZAHARA_TAKE');
path = path.replace('{take}', encodeURIComponent(take));
const url = new URL(base + '/api/' + encodeURIComponent(key) + '/' + path);
let response;
try {
response = await fetch(url, {
method: 'GET', headers: { Accept: 'application/json' },
signal: AbortSignal.timeout(30000), redirect: 'error'
});
} catch { throw new Error('Zahara request failed or timed out; URL omitted to protect the key'); }
if (!response.ok) throw new Error('Zahara returned HTTP ' + response.status);
const text = await response.text();
// Some methods may return an empty successful body. Do not assume a JSON shape.
const result = text.trim() ? JSON.parse(text) : null;
// Use a secure console; response fields may include financial or business data.
console.log(JSON.stringify(result, null, 2));
Python 3 (standard library)
Rejects redirects and reports HTTP/network errors without exposing the credential-bearing URL.
# Python 3. Standard library only.
import json
import os
from urllib.parse import quote, urlencode
from urllib.request import Request, build_opener, HTTPRedirectHandler
from urllib.error import HTTPError, URLError
class NoRedirect(HTTPRedirectHandler):
def redirect_request(self, req, fp, code, msg, headers, newurl):
return None
def required(name):
value = os.environ.get(name)
if not value:
raise SystemExit('Set ' + name)
return value
key = required('ZAHARA_BUSINESS_UNIT_API_KEY')
base = 'https://api.myzahara.net'
path = "BusinessDivision/Get/{skip}/{take}"
skip = os.environ.get('ZAHARA_SKIP', '0')
if not skip.isascii() or not skip.isdigit() or int(skip) < 0:
raise SystemExit('Invalid ZAHARA_SKIP')
path = path.replace('{skip}', quote(skip, safe=''))
take = os.environ.get('ZAHARA_TAKE', '5')
if not take.isascii() or not take.isdigit() or int(take) < 1:
raise SystemExit('Invalid ZAHARA_TAKE')
path = path.replace('{take}', quote(take, safe=''))
url = base + '/api/' + quote(key, safe='') + '/' + path
request = Request(url, method='GET',
headers={'Accept': 'application/json'})
try:
with build_opener(NoRedirect).open(request, timeout=30) as response:
text = response.read().decode('utf-8')
except HTTPError as error:
raise SystemExit('Zahara returned HTTP ' + str(error.code)) from None
except URLError:
raise SystemExit('Zahara request failed; URL omitted to protect the key') from None
result = json.loads(text) if text.strip() else None
# Use a secure console: the result may contain confidential data.
print(json.dumps(result, indent=2))
Successful response
The request returned HTTP 200 with an array of three divisions. An out-of-range offset returned HTTP 200 with []. No total-count or continuation field was observed.
Fictionalised response example
All identifiers, business labels and dates below are fictional. The example preserves an observed shape; array length is illustrative.
[
{
"BusinessDivisionId": 1001,
"BusinessUnitId": 100,
"BudgetId": null,
"BusinessBudgetId": null,
"Name": "Example Name",
"ContactTelephone": null,
"ContactEmail": null,
"VatReg": null,
"CountryCodeId": null,
"CountryCode": "gb",
"Description": null,
"Archived": false,
"LastUpdated": "2026-01-15T10:30:00Z",
"DateCreated": "2026-01-15T10:30:00Z",
"IconId": 1001,
"AvailableNominalCodes": null,
"RestrictNominalCodes": false,
"DepartmentId": null,
"Address": {
"AddressId": 1001,
"AddressLines": "Example AddressLines",
"Postcode": null,
"CountryCodeId": null,
"CountryCode": "gb",
"AddressType": 0,
"IsPrimary": false,
"Void": false,
"LastUpdated": "2026-01-15T10:30:00Z"
},
"DivisionSettings": [
{
"SettingsId": 1001,
"DefaultCostCodeId": null,
"DefaultPurchaseOrderProcessId": null,
"DefaultInvoiceProcessId": null,
"DefaultDeliveryNoteProcessId": null,
"PurchaseOrderNumberPrefix": null,
"DivisionHeadId": null,
"Sage200DepartmentId": null
}
]
}
]
Field reference
| Field | Observed JSON type | Meaning / integration use |
|---|---|---|
| BusinessDivisionId | number | Numeric division identifier. |
| BusinessUnitId | number | Business-unit identifier, not its API key. |
| BudgetId | number or null | Returned budget reference; do not infer equivalence with BusinessBudgetId. |
| BusinessBudgetId | number or null | Additional returned budget reference. Relationship and equality guarantees are unverified. |
| Name | string | Division display name. |
| ContactTelephone | null | Contact field. Only null was observed; the original article shows a string. Populated values need verification. |
| ContactEmail | null | Contact field. Only null was observed; the original article shows a string. Populated values need verification. |
| VatReg | null | Registration field. Only null was observed; the original article shows a string. Do not infer numeric conversion. |
| CountryCodeId | number or null | Returned field; full semantics are unverified. |
| CountryCode | string | Returned field; full semantics are unverified. |
| Description | string or null | Record description. Preserve any nulls reported by the API. |
| Archived | boolean | Archive flag; inspect before offering a division for selection. |
| LastUpdated | string | Observed UTC date-time string. |
| DateCreated | string | Observed UTC date-time string. |
| IconId | number | Returned field; full semantics are unverified. |
| AvailableNominalCodes | null or string | String of nominal-code values in observed responses; not a JSON array of numeric NominalCodeIds. |
| RestrictNominalCodes | boolean | Nominal selection restriction configuration flag. |
| DepartmentId | null or string | Department reference; string and null were observed. Preserve the original type. |
| Address | object | Address object or null, containing location data. |
| DivisionSettings | array | Array of division settings; do not assume one object or a permanent one-item length. |
These types combine the observed complete division list with the tested lookup. They do not establish requiredness, every possible null, populated relationship shapes or a complete formal schema.
Nested division data
Address can be null or contain address and country fields. DivisionSettings is an array in the observed response; its objects can include SettingsId, default cost-code/workflow references, number prefixes and division-head references. Preserve nullable references and do not assume those identifiers are valid in another business. The response alone does not establish workflow selection or fallback precedence.
Handling failures
The invalid-key test returned HTTP 401 with:
{
"ApiMessage": "The API key is missing or not recognised.",
"StatusCode": 401
}
The out-of-range page test returned HTTP 200 with:
[]
Check the HTTP status and then inspect the body before using it. Do not convert network failures into empty results. The supplied clients make one request and do not automatically retry it.
Integration notes
- Advance the offset while keeping the same business-unit key. Take is an item count rather than a page number.
- The observed relation between adjacent pages and GetAll is documented in Verification; permanent ordering is not guaranteed.
- Inspect Archived before selection. DivisionSettings is an array, and AvailableNominalCodes is an observed string.
- Concurrent configuration changes can move page boundaries. Maximum page size, negative offsets and snapshot consistency remain unverified.
- Case/format rules, permissions beyond the tested context, rate limits, complete nullability and undocumented variants remain unverified.
Verification
Verified on 25 November 2026 with an authorised business-unit key on the production API. cURL, JavaScript and Python each completed successfully. Invalid-key and documented empty/missing-result cases were exercised. Adjacent offsets showed the expected overlapping records. The tested page did not match the corresponding start of GetAll. These are observations, not ordering or snapshot guarantees.