Java · Track 7 · Tutorial 2 of 5
Check it ran
The morning after, check that last night's run recalculated your month and took your consolidation request - before anyone reads the reports.
You will needA month and a consolidation request from the earlier tutorials, and a night since.
By the endA script that tells you, each morning, whether the figures are ready.
1What to check, the morning after
Two things say whether last night's run took your work: the month's request - is it recalculated? - and the consolidation request - did the run take it?
2Write the check
Create CheckRun.java. It takes the two IDs your scripts printed:
CheckRun.java
// CheckRun.java - checks, the morning after, whether last night's run took your work.
// gradle -q run -Pmain=CheckRun --args="<trial balance request id> <consolidation request id>"
import com.fasterxml.jackson.databind.JsonNode;
public class CheckRun {
public static void main(String[] args) throws Exception {
if (args.length < 2) {
System.out.println("Usage: gradle -q run -Pmain=CheckRun --args=\"<trial balance request id> <consolidation request id>\"");
return;
}
String monthRequest = args[0];
String consolidationRequest = args[1];
JsonNode month = Brizo.call("GET", "/organisations/" + Brizo.COMPANY_ID + "/requests/" + monthRequest).body();
System.out.println("Trial balance request " + monthRequest + ": recalculation " + month.path("recalculation").asText());
if (month.path("recalculation").asText().equals("failed")) {
System.out.println(" failed at " + month.path("recalculation_step").asText());
}
JsonNode run = Brizo.call("GET", "/organisations/" + Brizo.COMPANY_ID + "/consolidation-requests/" + consolidationRequest).body().path("data");
System.out.println("Consolidation request " + consolidationRequest + ": " + run.path("status").asText()
+ (run.path("dispatched_at").isNull() ? "" : " at " + run.path("dispatched_at").asText()));
}
}
3Run it
gradle -q run -Pmain=CheckRun --args="91 12"Check
Trial balance request 91: recalculation done
Consolidation request 12: dispatched at 2026-10-03T01:40:03+08:00Use your own IDs. done means the month is in the reports.
4If something failed
- A month's
recalculationoffailednames the step it failed at. Send the month again with a new key to try again. - A consolidation request of
failedisn't tried again. Ask for a new one. - Still
pendingin the morning means the run hasn't taken it yet.
Want more detail? See the documentation