C# · Track 7 · Tutorial 1 of 5
Ask for the overnight consolidation
Ask BrizoConsol to consolidate tonight, once, after the last thing you send today.
1Why ask
The months you send are recalculated by the overnight run. Asking for a consolidation tells that run to consolidate the company, whether or not you sent anything new - after a correction made on screen, for example. Ask once, after your last write of the day.
2Ask for tonight's consolidation
Create Consolidate.cs:
Consolidate.cs
// Consolidate.cs - asks for tonight's consolidation.
public static class Consolidate
{
public static async Task Run(string[] args)
{
var answer = Brizo.Written(await Brizo.Call("POST", $"/organisations/{Brizo.CompanyId}/consolidation-requests"));
var request = answer["data"]!;
Console.WriteLine($"Consolidation request {request["id"]}: {request["status"]}"
+ ((bool)answer["meta"]!["deduplicated"]! ? " (one was already waiting)" : ""));
}
}dotnet run -- ConsolidateCheck
Consolidation request 12: pending3Ask twice, get one
A company has at most one request waiting. Run the script again while it waits, and you get the same request back, marked deduplicated:
dotnet run -- ConsolidateCheck
Consolidation request 12: pending (one was already waiting)4What to keep
Keep the request's ID: the next tutorial reads what became of it. Each request is also written to the group's System Audit Trail, naming the credential that asked.
5Good to know
- It runs overnight only, at 01:40. Nothing is consolidated while your code waits.
- It's asked for a company, or for the group when the group is ticked on the credential.
- It needs the Consolidation (trigger overnight run) box on the credential.
Want more detail? See the documentation