All Users API
POST /allUsers
Description
This API endpoint retrieves a paginated list of all users with optional sorting and filtering.
Request Body
The request uses GraphQL to perform the allUsers
query.
Query:
query allUsers ($sort: Boolean, $page: Int, $size: Int, $param: String, $query: String) {
allUsers (sort: $sort, page: $page, size: $size, param: $param, query: $query) {
totalElements
size
number
}
}
GraphQL Variables:
{
"sort": true,
"page": 0,
"size": 0,
"param": "",
"query": ""
}
Example Request:
curl --location '' \
--header 'Content-Type: application/json' \
--data '{"query":"query allUsers ($sort: Boolean, $page: Int, $size: Int, $param: String, $query: String) {\n allUsers (sort: $sort, page: $page, size: $size, param: $param, query: $query) {\n totalElements\n size\n number\n }\n}","variables":{"sort":true,"page":0,"size":0,"param":"","query":""}}'
Response:
-
Success (200 OK):
- The response includes pagination details for all users.
{
"data": {
"allUsers": {
"totalElements": 500,
"size": 10,
"number": 1
}
}
}totalElements
: Total number of users.size
: Number of users per page.number
: Current page number.
-
Error (4XX/5XX):
- If there is an issue with the request or if there is a server error, the response will include an error message and status code.
Parameters:
- sort (Boolean): Whether to sort the users.
true
to enable sorting,false
to disable. - page (Int): The page number for pagination.
- size (Int): The number of users per page.
- param (String): The parameter to sort or filter the users.
- query (String): The search query for filtering users.
Note:
This endpoint provides a flexible way to retrieve and manage all users, with options to sort and filter the results. Adjust the sort
, page
, size
, param
, and query
parameters to navigate through and refine the results.