invoice.get
A document with its lines.
Returns one document with its lines, in GnuCash's order (by date, then date entered, description, action and GUID). A line has both an invoice side and a bill side, as in GnuCash; the side that applies depends on the document's kind. Amounts are exact; the totals are in invoice.totals.
Examples
Example: with a copy of the synthetic/business-editable example book open as book.gnucash.
JSON-RPC
Request:
{"jsonrpc":"2.0","id":1,"method":"invoice.get","params":{"invoice":"aa210b7131de44c48b8513cd27c00e95"}}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"guid": "aa210b7131de44c48b8513cd27c00e95",
"id": "000001",
"type": "invoice",
"posted": true,
"billingId": "CUST-REF-9",
"entryCount": 2,
"entries": [
{
"description": "Consulting",
"quantity": {
"num": "10",
"denom": "1"
},
"invoicePrice": {
"num": "12050",
"denom": "100"
},
"…": "…"
},
"…"
],
"…": "…"
}
}
Command line
red-ale exec --book book.gnucash invoice.get '{"invoice":"aa210b7131de44c48b8513cd27c00e95"}'
It prints:
{
"guid": "aa210b7131de44c48b8513cd27c00e95",
"id": "000001",
"type": "invoice",
"posted": true,
"billingId": "CUST-REF-9",
"entryCount": 2,
"entries": [
{
"description": "Consulting",
"quantity": {
"num": "10",
"denom": "1"
},
"invoicePrice": {
"num": "12050",
"denom": "100"
},
"…": "…"
},
"…"
],
"…": "…"
}
MCP tool call
Tool call:
{"name":"invoice.get","arguments":{"invoice":"aa210b7131de44c48b8513cd27c00e95"}}
Result:
{
"structuredContent": {
"guid": "aa210b7131de44c48b8513cd27c00e95",
"id": "000001",
"type": "invoice",
"posted": true,
"billingId": "CUST-REF-9",
"entryCount": 2,
"entries": [
{
"description": "Consulting",
"quantity": {
"num": "10",
"denom": "1"
},
"invoicePrice": {
"num": "12050",
"denom": "100"
},
"…": "…"
},
"…"
],
"…": "…"
}
}
Effect: read.
Params
Names one document.
invoice(Guid, required): The document.
Result
A document with its lines, in GnuCash's order (date, date entered, description, action, GUID).
guid(Guid, required): A GUID: 32 hexadecimal digits.id(string, required)type(DocumentKindWire or null): From the owner (through a job to its owner) and the credit-note flag.owner(OwnerInfo, required): An owner: a customer, vendor, employee or job.currency(CommodityId or null)dateOpened(Timestamp, required): An instant, RFC 3339; written in UTC with a Z suffix.posted(boolean, required)datePosted(Timestamp or null)terms(Guid or null)billingId(string, required)notes(string, required)docLink(string or null): The document link (assoc_urislot), as stored.active(boolean, required)billTo(OwnerInfo or null)chargeAmount(Amount, required): An exact amount. Read from a decimal string ("12.34"), a rational string ("1234/100") or {num, denom} with string members; written as {num, denom}. Never a JSON number.postedAccount(Guid or null)postedTransaction(Guid or null)postedLot(Guid or null)entryCount(integer (uint), required)entries(array of EntryInfo, required): Its lines.