Help us learn about your current experience with the documentation.
Take the survey.
Query users by using GraphQLYou can query a subset of users in a GitLab instance by using:
cURL
.Open GraphiQL:
https://gitlab.com/-/graphql-explorer
https://gitlab.example.com/-/graphql-explorer
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
}
}
}
}
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.
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:
id
.membership
fragment, which represents project or group membership that belongs to that user. Fragments are indicated by the ...memberships
notation.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