Example APC API queries
The examples on this page show common ways to use the APC API — they’re not a complete API reference. For the full, interactive API documentation for your installation, including every available query, mutation, and type, go to https://houston.<your-base-domain>/v1, and click on the Docs tab. See Develop and test APC API queries for more on using the built-in GraphQL explorer.
You can retrieve common information for specific Astronomer objects by using the following sample queries.
Find the ID of a workspace you belong to
Use the workspaces query to find the ID of a Workspace that you belong to. Optionally, you can choose to filter by Deployment label.
Find the ID of all workspaces
System administrators can use the sysWorkspaces query to perform a bulk-fetch of all Workspaces and their respective IDs using the sysWorkspaces query. After retrieving the full list, you can filter the Workspaces within your application to locate the ID corresponding to the label of interest.
Query Deployment details
You can use the workspaceDeployment query to retrieve details about a Deployment in a given Workspace. It requires the following inputs:
-
Workspace ID: To retrieve this value, use the
sysWorkspacesorworkspacesquery, or runastro workspace list. Alternatively, open a Workspace in the Astro Private Cloud UI and copy the value after/w/in your Workspace URL, for example,https://app.basedomain/w/<workspace-id>. -
Deployment release name: To retrieve this value, run
astro deployment listin your Workspace. Alternatively, you can copy the Release name from your Deployment’s Settings tab in the Astro Private Cloud UI.The
workspaceDeploymentquery can return also any of the fields underType Details, such as: -
config -
uuid -
status -
createdAt -
updatedAt -
roleBindings
For example, you can run the following query to retrieve the Deployment’s:
- ID
- Health status
- Creation time
- Update time
- Users
Query user details
A common query is users, which lets you retrieve information about multiple users at once. To use this query, you must provide:
-
At least one of the following
userSearchvalues:userId(String): The user’s IDuserUuid(String): The user’s unique IDusername(String): The user’s usernameemail(String): The user’s emailfullName(String): The user’s full namecreatedAt(DateTime): When the user was createdupdatedAt(DateTime): When the user was updated
The query returns the requested details for all users who exactly match the values provided for the userSearch. For example, the following query would retrieve the requested values for any user accounts with the email name@mycompany.com:
Query a Deployment’s effective configuration
The Deployment type exposes the merged deployments object on effectiveConfig (the final value after the Platform through Deployment merge). It also exposes configOverrides for the deployment tier only, when you need the fourth layer in isolation.
For example, workspaceDeployment can return the merged result alongside deployment-level overrides:
For the full config governance model, see Config governance.
Query teams
Get single team
List teams with search
searchPhrase requires a minimum of three characters.
List workspace teams
List deployment teams
For the full teams model, roles, and error reference, see team management reference.
Query clusters
List clusters
The paginatedClusters query returns clusters the caller has access to. Pagination uses the take argument, plus either cursor (a cluster UUID) or pageNumber. The response object contains a clusters list and a total count.
Get a single cluster
The healthStatus field returns a JSON object containing the full health payload the APC API received from the deployment orchestrator, not a single string. The statusReason field is also a JSON object.
Filter by cloud provider and region
Other supported filter arguments include searchPhrase, k8sVersion, id, sortBy, and sortDirection.
For status values and troubleshooting, see Manage cluster status.
Force a cluster metadata reconciliation
Use the reconcileClusterMetadataJob query to make the APC API refetch metadata from the deployment orchestrator immediately, instead of waiting for the next CronJob run. The query accepts a list of cluster UUIDs; if you pass null or omit the argument, the APC API reconciles every cluster the caller is authorized to update.
A cluster appears in skippedClusterIds when it lacks a data plane URL or when the caller isn’t authorized to reconcile it.
See Manage cluster status for when to use this query.
Clean up Airflow metadata
The following examples show different queries you can use depending on your needs. For the full parameter reference, see Clean up and delete task metadata.
Clean up Deployments per Workspace
Query variables to clean up all Deployments older than 1 day within a Workspace that uses GCP as a cloud provider:
Clean up specific Deployments
Query variables to clean up specific Deployments older than 1 day within a Workspace:
Clean up using an Airflow connection ID
connectionId, from the Airflow UI or CLI.Query variables to clean up Deployments and export the cleanup logs to the storage provider configured in an Airflow Connection:
Configure custom Pod resources
If you don’t configure a default Pod CPU or memory resource amount, or want to override one, make a query that sets resourceSpec:
Query variables that configure resource requests and limits for the cleanup run:
For the full parameter reference, see Clean up and delete task metadata.
Trigger task usage data cleanup
Use the cleanupTaskUsageDataJob query to manually trigger a purge of task usage metrics and audit logs:
Minimum retention is 90 days and can’t be reduced.
For the full cleanup job reference, see Configure cleanup jobs.