Use the following example Houston API requests as the basis for the applications you develop for Astronomer Software.
You can retrieve common information for specific Astronomer objects by using the following sample queries.
Use the workspaces query to find the ID of a Workspace that you belong to. Optionally, you can choose to filter by Deployment label.
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.
You can use the workspaceDeployment query to retrieve details about a Deployment in a given Workspace. It requires the following inputs:
sysWorkspaces or workspaces query, or run astro workspace list. Alternatively, open a Workspace in the Software UI and copy the value after /w/ in your Workspace URL, for example, https://app.basedomain/w/<workspace-id>.astro deployment list in your Workspace. Alternatively, you can copy the Release name from your Deployment’s Settings tab in the Software UI.The workspaceDeployment query can return also any of the fields under Type Details, such as:
configuuidstatuscreatedAtupdatedAtroleBindingsFor example, you can run the following query to retrieve the Deployment’s:
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 userSearch values:
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 updatedWorkspace ID: To retrieve this value, run astro workspace list. Alternatively, open a Workspace in the Software UI and copy the value after /w/ in your Workspace URL, for example https://app.basedomain/w/<workspace-id>.
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:
Mutations make a change to your platform’s underlying database. The following sections describe some common examples.
To create a Deployment, you need Workspace Admin permissions and a Workspace ID. To retrieve this value, run astro workspace list. Alternatively, open a Workspace in the Software UI and copy the value after /w/ in your Workspace URL, for example https://app.basedomain/w/<workspace-id>.
This example mutation creates a Deployment with the Celery executor and the latest Runtime version. It then returns the Deployment’s ID and configuration to confirm that it was successfully created.
The upsertDeployment mutation is behind a feature flag. To enable this feature, set the following configuration in your config.yaml file:
Then push the configuration change to your cluster. See Apply a config change.
You can use the upsertDeployment mutation to both create and update Deployments with all possible Deployment configurations. If you query upsertDeployment without a deploymentUuid, the Houston API creates a new Deployment according to your specifications. If you specify an existing deploymentUuid, the Houston API updates the Deployment with that ID. All queries to create a Deployment require specifying a workspaceUuid.
The following query creates a new Deployment in a custom namespace test-new-dep and configures a Deployment environment variable AIRFLOW__CORE__COLORED_LOG_FORMAT.
To delete a Deployment, you need:
astro deployment list or request the id value in the workspaceDeployment query.The following example mutation deletes a Deployment, then returns the ID of the Deployment to confirm that it was successfully deleted.
To add an existing Astronomer Software user to a Deployment, you need:
astro deployment list or request the id value in the workspaceDeployment query.id value in a users query or run astro workspace user list.DEPLOYMENT_ADMIN, DEPLOYMENT_EDITOR, or DEPLOYMENT_VIEWER.The following query adds a user to a Deployment as a Deployment viewer, then returns the user and Deployment information back to the requester.
To delete a user from Astronomer Software, you need:
id value in a users query or run astro workspace user list.The following query removes a user, then returns information about the deleted user.
If a user on the platform has trouble verifying their email address, you can use the Houston API to manually verify it for them.
To run this mutation, you’ll need:
The following request verifies the email and returns true or false based on whether the mutation was successful.
If you don’t need certain users to verify their email before they join a Workspace, you can configure a bypass when you add them to a Workspace. This can be useful for minimizing friction when programmatically inviting many users to your platform.
To run this mutation, you need:
astro workspace list. Alternatively, open a Workspace in the Software UI and copy the value after /w/ in your Workspace URL (for example https://app.basedomain/w/<workspace-id>).WORKSPACE_VIEWER, WORKSPACE_EDITOR, WORKSPACE_ADMIN).The following example mutation can be run to add a user to a Workspace as a WORKSPACE_VIEWER.
To add a user as a System Admin through the Houston API, you need the following values:
id value in a users query or run astro workspace user list.You can then run the following query to add the user as a System Admin.
To programmatically update environment variables, you need:
astro deployment list or request the id value in the workspaceDeployment query.astro deployment list in your Workspace. Alternatively, you can copy the Release name from your Deployment’s Settings tab in the Software UI.Then, in your GraphQL Playground, run the following: