C# · Track 4 · Tutorial 4 of 4
Read invoices and bills back
Read back what BrizoConsol holds: the month's invoices and bills, with what's still owed on each.
You will needInvoices and bills sent in the earlier tutorials of this track.
By the endA script that reads any month's documents, and finds the ones you need.
1Read September's documents
Create ReadDocuments.cs:
ReadDocuments.cs
// ReadDocuments.cs - reads September's invoices and bills back.
public static class ReadDocuments
{
public static async Task Run(string[] args)
{
foreach (var kind in new[] { "invoices", "bills" })
{
var answer = await Brizo.Call("GET", $"/organisations/{Brizo.CompanyId}/{kind}?period=2026-09");
Console.WriteLine(char.ToUpper(kind[0]) + kind[1..] + ":");
foreach (var document in answer.Body!["data"]!.AsArray())
{
Console.WriteLine($" {document!["number"]} {document["party"]!["name"]} {document["currency"]} {Brizo.Money(document["total"])}"
+ $" due {Brizo.Money(document["amount_due"])} {document["status"]}");
}
}
}
}2Run it
dotnet run -- ReadDocumentsCheck
Invoices:
INV-1001 Harbour Trading Pte Ltd SGD 10,000.00 due 5,000.00 OVERDUE
INV-1002 Pacific Desk Co USD 1,000.00 due 1,000.00 OVERDUE
Bills:
BILL-501 Northwind Furniture Supply SGD 8,000.00 due 5,000.00 OVERDUEEach document as you sent it, with its status. Sent after their October due dates, with money still owed, all three read OVERDUE.
3Narrow it down
status=OVERDUE- only documents in that state.account_code=4000- documents with a line on that account.external_id=INV-1001- one document. An identity the company doesn't hold answers404.