Skip to main content

Retrieving Users

In this section, we will show you how to get a list or one of Busy Hour User.

Prerequisites

  1. Busy Hour Account (Sign Up if you don't have one yet)
  2. Generate a Master/Project API Key from Dashboard/Settings or from Dashboard/Projects

Retrieving Multiple Users

warning

You can retrieve a list of Busy Hour User with any Master API Key or a Project API Key that only specificly for the project user you want to retrieve.

To retrieve a list of Busy Hour User, you can use the user.list function from the @busy-hour/node package. The function take an object with the following properties:

PropertyTypeDescription
projectIdstring (optional)The ID of the project that the user belong to
nicknamestring (optional)The nickname of the user
limitnumber (optional)Total number of users to retrieve, (default: 10)
pagenumber (optional)The page number of users to retrieve, (default: 1)

Quick Example

src/main.ts
import { BusyHourNode } from '@busy-hour/node';

// Create an instance of BusyHourNode with your API key (Master/Project)
const nodeSdk = new BusyHourNode({
apiToken: 'your-api-token',
});

nodeSdk.user.list({
projectId: 'your-project-id',
nickname: 'your-user-nickname',
limit: 5,
page: 2,
});

Retrieving a User

warning

You can retrieve a Busy Hour User with any Master API Key or a Project API Key that only specificly for the project user you want to retrieve.

To retrieve a Busy Hour User, you can use the user.find function from the @busy-hour/node package. The function take a userId to retrieve as the argument.

Quick Example

src/main.ts
import { BusyHourNode } from '@busy-hour/node';

// Create an instance of BusyHourNode with your API key (Master/Project)
const nodeSdk = new BusyHourNode({
apiToken: 'your-api-token',
});

nodeSdk.user.find({
userId: 'your-user-id',
});