Houston API

Example Houston API queries

You can retrieve common information for specific Astronomer objects by using the following sample queries.

Finding 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.

1query {
2 workspaces(label:"example-workspace") {
3 id,
4 label
5 }
6}

Finding 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.

1query {
2 sysWorkspaces {
3 id,
4 label
5 }
6}

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 sysWorkspaces or workspaces query, or run astro 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 list in your Workspace. Alternatively, you can copy the Release name from your Deployment’s Settings tab in the Astro Private Cloud UI.

The workspaceDeployment query can return also any of the fields under Type 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
1query workspaceDeployment {
2 workspaceDeployment(
3 releaseName: "mathematical-probe-2087"
4 workspaceUuid: "ck35y9uf44y8l0a19cmwd1x8x"
5 )
6 {
7 id
8 status
9 createdAt
10 updatedAt
11 roleBindings {
12 id,
13 role,
14 user {
15 username,
16 emails {
17 primary
18 }
19 }
20 }
21 }
22}

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 userSearch values:

    • userId (String): The user’s ID
    • userUuid(String): The user’s unique ID
    • username (String): The user’s username
    • email (String): The user’s email
    • fullName (String): The user’s full name
    • createdAt(DateTime): When the user was created
    • updatedAt(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:

1query User {
2 users(user: { email: "name@mycompany.com"} )
3 {
4 id
5 roleBindings {role}
6 status
7 createdAt
8 }
9}