auditReport for today’s date and wait until no check is left at notRun.
The request
report.tenant.timeZone). Do not leave date out here: until the audit’s scheduled time, a blank date returns yesterday’s finished report, which looks ready.
Read the answer
health.checks counts the audit’s configured checks for that morning:
As each check finishes, it moves from
notRun to ran or partial. The API cannot tell a check that has not started from one that failed: both are notRun. So pick a cutoff, a time by which every check has always finished on a normal morning. Before the cutoff, notRun means wait. After it, notRun means a real miss, and health.summary names the checks that did not run.
Once notRun is 0, the morning is done. Then read health.complete: true means every read was complete; false means some counts may be short, as Check this morning’s audit explains.
A complete script
Run it from your scheduler a little after the audit’s scheduled time. It polls every five minutes and exits0 when the morning is done, or 1 at the cutoff.
ran + partial > 0. An audit with no configured check hasnotRunat0from the start. The script treats that as not ready;health.summarysays “No check is configured yet.”- Cost. Each poll costs about 35 points, far below the throttle. Polling more often than every few minutes does not get the answer sooner.
Next
When the script exits0, run what depends on the morning: Post new findings to chat, Sync findings every day, or read the counts with Check this morning’s audit.