Skip to main content
Version: 0.1.0

GraphQL API Example Use Cases

Querying User Information

In many scenarios while using the API, you would have to pass in your user or team IDs. These always refer to Zeet User ID or Team ID unless explicitly mentioned. This guide covers how you can query relevant user/ team/ repo information.

First, make sure that you have the Zeet GraphQL API ready and working. You can use the Getting Started guide for reference.

Query user info with currentUser

You can query your user ID using the currentUser query. The currentUser query returns a User object. You can query for more fields if required.

  const req = gql`
query {
currentUser {
id,
name,
login
}
}
`

Query team info with team

You can also use the team query to fetch team info. The team query takes in either the team ID or the team Path as input and returns a Team object. The team path is just the name of your team!

This query shows you all the teams associated with this user along with their respective team IDs.

  const req = gql`
query {
team (
id: $team_id
path: $team_name
) {
id,
name,
}
}
`

Querying Repo information

You can query repo information using the repo query. The query takes in either the repo ID or the repo Path as input and returns a Repo object. The repo path can be found in the API section of your app settings (see below) and is in the format of team-name/project/environment/app. You can also get this from the URL of your app!

  const req = gql`
query {
repo (
id: $repo_id,
path: $repo_path
) {
id,
name
}
}
`

Find repo information from your Dashboard

You can find important information about your repo from the API section of your app settings.