API Stability |
Long-Term
|
The usersPage() GraphQL query returns a list of users in an organization. You can get all users, or limit the list to a specific search value.
To use this query field, you'll need root access, organization owner access, or permission to manage users in at least one repository or view.
For information on organization settings, see the Organization Settings documentation page. For information on user authorization, see the Manage users & permissions documentation page.
This field is not yet available. It's described here as a preview and is used for getting a new pagination pattern.
Syntax
Below is the syntax for the usersPage() query field:
usersPage(
search: string
orderBy: OrderByUserFieldInput
pageSize: integer!
pageNumber: integer!
): UsersPage!
The search
takes a simple string within
quotes. For the input
OrderByUserFieldInput
, you'll have to
specify within curly-brackets one of three possible sorting fields
(see the Given Datatypes section below). With
pageSize
you specify the number of records
you want per page. Imagining that you have a list of users that
would span several pages, use pageNumber
to
stipulate which page you want returned.
Look at this example for better understanding. The rest of the
syntax (i.e., the UsersPage
portion) is
explained afterwards.
query{
usersPage(
search: "company.com"
orderBy: {userField: USERNAME, order: ASC}
pageSize: 10
pageNumber: 1
) {
page {
id, username, displayName
}
pageInfo {
number
totalNumberOfRows
total
}
}
}
{
"data": {
"usersPage": {
"page": [
{
"id": "TMc2x9a2APnkGvyMJQbxgcOU",
"username": "bob",
"displayName": "Bob Newhart"
},
{
"id": "mQ2oDkHSLhTG6l6ppsmxJYHJ",
"username": "steve",
"displayName": "Steve McQueen"
},
{
"id": "czN4YDhpmZ1JrZnJ4bkQzK52",
"username": "tom",
"displayName": "Tom Hanks"
}
],
"pageInfo": {
"number": 1,
"totalNumberOfRows": 3,
"total": 3
}
}
}
}
For the UsersPage
(see Returned Datatypes
below), you have to enter page
with the
fields you want returned. As for pageInfo
,
all three of the parameters are required and returned.
Given Datatypes
For the given datatype,
OrderByUserFieldInput
, there are several
parameters that may be given. Below is a list of them along with
their datatypes and a description of each:
Table: OrderByUserFieldInput
Parameter | Type | Required | Default | Stability | Description |
---|---|---|---|---|---|
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column. | |||||
Table last updated: Sep 19, 2024 | |||||
order | OrderByDirection | yes | Long-Term | How to sort users information. See OrderByDirection . | |
userField | OrderByUserField | yes | Long-Term | The user field by which to sort user information. See OrderByDirection . |
Returned Datatypes
The returned datatype UsersPage
has a few
parameters and sub-parameter. Below is a list of them:
Table: UsersPage
Parameter | Type | Required | Default | Stability | Description |
---|---|---|---|---|---|
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column. | |||||
Table last updated: Oct 4, 2024 | |||||
page | [User ] | yes | Long-Term | The users included in the page. See User . | |
pageInfo | PageType | yes | Long-Term | The page settings. See PageType . |