Links
Comment on page
👥

Get Users

Use this method to get multiple users' metadata simultaneously, such as the name, bio, social link, etc.

Usage in your script

JavaScript
TypeScript
const response = await altura.getUsers();
​
// customize options
const options = {
perPage: 20,
page: 1,
sortBy: 'name',
sortDir: 'asc'
}
const response = await altura.getUsers(options);
​
// filter documents by any properties
const response = await altura.getUsers(
{}, // default options
{
name: 'AlturaNFT'
} //fetching users with name AlturaNFT
)
​
const users = response.users;
const userCount = response.count;
const response: { users: IAlturaUser[], count: number } = await altura.getUsers();
​
// customize options
const options = {
perPage: 20,
page: 1,
sortBy: 'name',
sortDir: 'asc'
}
const response: { users: IAlturaUser[], count: number } = await altura.getUsers(options);
​
// filter documents by any properties
const response: {users: IAlturaUser[], count: number} = await altura.getUsers(
{}, // default options
{
name: 'AlturaNFT'
} //fetching users with name AlturaNFT
)
​
const users = response.users;
const userCount = response.count;

Parameters

Parameter
Type
Required
Description
perPage
String
Yes
Amount of users per page.
page
String
Yes
Amount of pages
sortBy
String
Yes
The field to sort the users by (any field in the user schema may be used)
sortDir
String
Yes
Choose to sort in ascending (asc) or descending (desc) order