JSON API: Create a New Ledger
It is only possible to create a new ledger if none currently exists.
Refer to the create schema for a formal definition of the request and the create response schema for a definition of the response.
Route: /root/create
A minimal create request looks like this
{
"name": "New Business Inc.",
"currencies": [
{
"code": "CAD",
"decimals": 2
}
]
}
This creates a ledger with no accounts. The application can add accounts as required.
Returns
time is always present. If the errors attribute is present, the remaining attributes are not.
{
"time": "ISO DateTime",
"errors": [
{
"text": "some informative error message",
"arguments": []
}
],
"ledger": {
"uuid": "root account UUID",
"revision": "hashed time with microseconds",
"createdAt": "ISO DateTime",
"updatedAt": "ISO DateTime"
}
}
A more comprehensive create request
{
"language": "en-CA",
"date": "2021-01-01",
"domains": [
{
"code": "Corp",
"names": [
{
"name": "General Corporate",
"language": "en-CA"
},
{
"name": "G\u00e9n\u00e9ral Corporatif",
"language": "fr-CA"
}
]
}
],
"currencies": [
{
"code": "CAD",
"decimals": 2
},
{
"code": "ZZZ",
"decimals": 4
}
],
"names": [
{
"name": "General Ledger Test",
"language": "en-CA"
},
{
"name": "Tester le grand livre",
"language": "fr-CA"
}
],
"rules": {
"account": {
"codeFormat": "\/^[a-z0-9\\-]+$\/i"
},
"pageSize": 25,
"_myAppRule": [
1,
2,
3
]
},
"extra": "arbitrary string",
"accounts": [
{
"code": "1000",
"name": "Assets",
"category": true,
"debit": true
},
{
"code": "1100",
"name": "Chequing Account",
"parent": "1000",
"debit": true
}
]
}