Namespace: users

QB. users

Methods

staticQB.users.create(params, callback)

modules/qbUsers.js, line 178
Registers a new app user. Call this API to register a user for the app. You must provide either a user login or email address along with their password, passing both email address and login is permitted but not required (read more)
Name Type Description
params object object of user's parameters
Name Type Description
login string The user's login name
password string The user's password for this app
email string The user's email address
full_name string optional The user's full name
phone string optional The user's phone number
website string optional The user's web address, or other url
facebook_id string optional The user's facebook uid
twitter_id string optional The user's twitter uid
blob_id number optional The id of an associated blob for this user, for example their photo
external_user_id number | string optional An uid that represents the user in an external user registry
tag_list string | Array.<string> optional A comma separated list of tags associated with the user. Set up user tags and address them separately in your app
custom_data string optional The user's additional info
callback createUserCallback The createUserCallback function

staticQB.users.delete(params, callback)

modules/qbUsers.js, line 253
Name Type Description
params number | object An id of user to remove or object with external user id
Name Type Description
external number | string An id of user to remove or object with external user id
callback deleteUserCallback An uid that represents the user in an external user registry
Example
// parameter as user id:
var params = 567831;

// parameter as external user id:
// var params = {'external': 'ebdf831abd12da4bcf12f22d'};

QB.users.delete(params, function(error, response) {
    if (error) {
        console.log(error);
    } else {
        console.log(response);
    }
});

staticQB.users.get(params, callback)

modules/qbUsers.js, line 117
Retrieve a specific user or users
Name Type Description
params number | object User ID (number) or object of parameters (object with one of next required properties)
Name Type Default Description
login string The login of the user to be retrieved (read more)
full_name string The full name of users to be retrieved (read more)
facebook_id string The user's facebook uid (read more)
twitter_id string The user's twitter uid (read more)
phone string The user's phone number
email string The user's email address (read more)
tags string | Array.<string> A comma separated list of tags associated with users (read more)
external number | string An uid that represents the user in an external user registry (read more)
page string 1 optional Used to paginate the results when more than one page of users retrieved (can be used with get by 'full_name' or 'tags')
per_page string 10 optional The maximum number of users to return per page, if not specified then the default is 10 (can be used with get by 'full_name' or 'tags')
callback getUsersCallback The getUsersCallback function
Example
var params = {'email': 'example-email@gmail.com'};

// for search by 'full_name' or 'tags':
// var params = {
//     'full_name': 'test_user',
//     'page': 2,
//     'per_page': 25
// };

// for search by user's ID:
// var id = 53454;

// use params or id to get records:
QB.users.get(params, function(error, response) {
    if (error) {
        console.log(error);
    } else {
        console.log(response);
    }
});

staticQB.users.listUsers(params, callback)

modules/qbUsers.js, line 37
Call this API to get a list of current users of you app. By default it returns upto 10 users, but you can change this by adding pagination parameters. You can filter the list of users by supplying a filter string. You can sort results by ask/desc (read more)
Name Type Description
params object Object of parameters
Name Type Default Description
page number 1 optional Used to paginate the results when more than one page of users retrieved
per_page number 10 optional The maximum number of users to return per page, if not specified then the default is 10
filter string optional You can filter the list of users by supplying a filter string. Possible operators: gt, lt, ge, le, eq, ne, between, in. Allowed fields' types: string,number,date. Allowed fields: id, full_name, email, login, phone, website, created_at, updated_at, last_request_at, external_user_id, twitter_id, twitter_digits_id, facebook_id (example: 'field_type+field_name+operator+value')
order string optional Parameter to sort results. Possible values: asc and desc. Allowed fields' types: string,number,date. Allowed fields: id, full_name, email, login, phone, website, created_at, updated_at, last_request_at, external_user_id, twitter_id, twitter_digits_id, facebook_id ('asc+date+created_at' (format is 'sort_type+field_type+field_name'))
callback listUsersCallback The listUsersCallback function

staticQB.users.resetPassword(email, callback)

modules/qbUsers.js, line 279
You can initiate password resets for users who have emails associated with their account. Password reset instruction will be sent to this email address (read more)
Name Type Description
email string The user's email to send reset password instruction
callback resetPasswordByEmailCallback The resetPasswordByEmailCallback function

staticQB.users.update(id, params, callback)

modules/qbUsers.js, line 215
Update current user. In normal usage, nobody except the user is allowed to modify their own data. Any fields you don’t specify will remain unchanged, so you can update just a subset of the user’s data. login/email and password may be changed, but the new login/email must not already be in use (read more)
Name Type Description
id number The id of user to update
params object object of user's parameters
Name Type Description
login string optional The user's login name
old_password string optional The user's old password for this app
password string optional The user's new password for this app
email string optional The user's email address
full_name string optional The user's full name
phone string optional The user's phone number
website string optional The user's web address, or other url
facebook_id string optional The user's facebook uid
twitter_id string optional The user's twitter uid
blob_id number optional The id of an associated blob for this user, for example their photo
external_user_id number | string optional An uid that represents the user in an external user registry
tag_list string | Array.<string> optional A comma separated list of tags associated with the user. Set up user tags and address them separately in your app
custom_data string optional The user's additional info
callback updateUserCallback The updateUserCallback function