A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.gitlab.com/api/graphql/users_example/ below:

Query users by using GraphQL

Help us learn about your current experience with the documentation.

Take the survey

.

Query users by using GraphQL

You can query a subset of users in a GitLab instance by using:

Use GraphiQL
  1. Open GraphiQL:

  2. Copy the following text and paste it in the left window. This query looks for a subset of users in a GitLab instance by username. Alternately, you can use their Global IDs.

     {
       users(usernames: ["user1", "user3", "user4"]) {
         pageInfo {
           endCursor
           startCursor
           hasNextPage
         }
         nodes {
           id
           username,
           publicEmail
           location
           webUrl
           userPermissions {
             createSnippet
           }
         }
       }
     }
  3. Select Play.

The GraphQL API returns a GlobalID, rather than a standard ID. It also expects a GlobalID as an input rather than a single integer.

This query returns the specified information for the three users with the listed username.

Show administrators only

If you are signed in as an administrator, you can show the matching administrators on the instance by adding the admins: true parameter to the query. Change the second line to:

  users(usernames: ["user1", "user3", "user4"], admins: true) {
    ...
  }

Or you can get all of the administrators:

  users(admins: true) {
    ...
  }
Pagination and graph nodes

The query includes:

pageInfo

This contains the data needed to implement pagination. GitLab uses cursor-based pagination. For more information, see Pagination in the GraphQL documentation.

nodes

In a GraphQL query, nodes represents a collection of nodes on a graph. In this case, the collection of nodes is a collection of User objects. For each one, the output includes:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4