whitehall: Link Checker API Integrations
Links on an edition are checked using the LinkChecker API. Links are checked when the Check Links
button is clicked on the edition show page. This fires off a request to the Link Checker API using the /create_batch
endpoint. Once this has checked all the links present in the edition it makes a callback with a batch_report
that gets saved as a LinkCheckerApiReport
.
Models
LinkCheckerApiReports
The LinkCheckerApiReports
are returned by the API contain a report of all the links present in an edition.
LinkCheckerApiReportLinks
These are saved as LinkCheckerApiReportLinks
. These contain information on the warnings or errors on the links, including a suggested_fix
.
The LinkCheckerApiReport
is displayed on the admin page with a list of the broken links found on the edition.
Workers
The CheckAllOrganisationsLinksWorker
is a scheduled worker that runs nightly at 2 a.m. it queues up individual link checking tasks for each organisation using CheckOrganisationLinksWorker
CheckOrganisationLinksWorker
uses the LinkCheckerApiService#check_links calls the create batch endpoint
in the LinkCheckerApi. The callback and the subsequent link check report creation happen as per the on-demand check.