With the Spectacles API, you can programmatically create runs and get their results. This is useful if you want to trigger Spectacles as part of a data pipeline managed in another tool like Airflow or Prefect.
Let's say you have data transformation jobs running in Airflow. With the Spectacles API, you can run Spectacles after each job completes to verify that nothing has been broken in your Looker instance.
This guide walks through the high-level steps to create and monitor a run using Python and the API. However, you should also check out the detailed reference documentation for the API here.
To use the Spectacles API, you will require an API key. You can generate or replace your API key in the Settings page for your Spectacles organisation.
Only one API key can be active at a time, so save your API key somewhere securely when generating it. If you lose it, you'll need to replace it with a new key.
Here's an example Python script that demonstrates authenticating, creating a run, and getting the results.