Class: User

User

new User()

User

Properties:
Name Type Description
connector IConnector

the jira connector instance

Source:

Methods

addUserToApplication(options, callbackopt) → {Promise.<any>}

Add user to given application. Admin permission will be required to perform this operation.usernameapplication key

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username username

applicationKey string

applicationKey application key

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

changeUserPassword(options, callbackopt) → {Promise.<any>}

Modify user password.the usernameuser key

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username the username

key string

key user key

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

create(options, callbackopt) → {Promise.<any>}

Create user. By default created user will not be notified with email. If password field is not set then password will be randomly generated.

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
key string

key

name string

name

password string

password

emailAddress string

emailAddress

displayName string

displayName

notification string

notification

applicationKeys string

applicationKeys

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

createAvatarFromTemporary(options, callbackopt) → {Promise.<any>}

Converts temporary avatar into a real avatarusername

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username username

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

defaultColumns(options, callbackopt) → {Promise.<any>}

Returns the default columns for the given user. Admin permission will be required to get columns for a user other than the currently logged in user.username

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username username

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

deleteAvatar(options, callbackopt) → {Promise.<any>}

Deletes avatarusername

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
id string

id

username string

username username

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

deleteById(options, callbackopt) → {Promise.<any>}

Removes user.the usernameuser key

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username the username

key string

key user key

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

find(options, callbackopt) → {Promise.<any>}

Returns a list of users that match the search string. This resource cannot be accessed anonymously.A query string used to search username, name or e-mail addressthe index of the first user to return (0-based)the maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.If true, then active users are included in the results (default true)If true, then inactive users are included in the results (default false)

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username A query string used to search username, name or e-mail address

startAt string

startAt the index of the first user to return (0-based)

maxResults string

maxResults the maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

includeActive string

includeActive If true, then active users are included in the results (default true)

includeInactive string

includeInactive If true, then inactive users are included in the results (default false)

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

findAssignableUsers(options, callbackopt) → {Promise.<any>}

Returns a list of users that match the search string. This resource cannot be accessed anonymously. Please note that this resource should be called with an issue key when a list of assignable users is retrieved for editing. For create only a project key should be supplied. The list of assignable users may be incorrect if it's called with the project key for editing.the usernamethe key of the project we are finding assignable users forthe issue key for the issue being edited we need to find assignable users for.the index of the first user to return (0-based)the maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username the username

project string

project the key of the project we are finding assignable users for

issueKey string

issueKey the issue key for the issue being edited we need to find assignable users for.

startAt string

startAt the index of the first user to return (0-based)

maxResults string

maxResults the maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

actionDescriptorId string

actionDescriptorId

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

findBulkAssignableUsers(options, callbackopt) → {Promise.<any>}

Returns a list of users that match the search string and can be assigned issues for all the given projects. This resource cannot be accessed anonymously.the usernamethe keys of the projects we are finding assignable users for, comma-separatedthe index of the first user to return (0-based)the maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username the username

projectKeys string

projectKeys the keys of the projects we are finding assignable users for, comma-separated

startAt string

startAt the index of the first user to return (0-based)

maxResults string

maxResults the maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

findById(options, callbackopt) → {Promise.<any>}

Returns a user. This resource cannot be accessed anonymously.the usernameuser key

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username the username

key string

key user key

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

findUsersForPicker(options, callbackopt) → {Promise.<any>}

Returns a list of users matching query with highlighting. This resource cannot be accessed anonymously.A string used to search username, Name or e-mail addressthe maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
query string

query A string used to search username, Name or e-mail address

maxResults string

maxResults the maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

showAvatar string

showAvatar

exclude string

exclude

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

findUsersWithAllPermissions(options, callbackopt) → {Promise.<any>}

Returns a list of active users that match the search string and have all specified permissions for the project or issue. This resource can be accessed by users with ADMINISTER_PROJECT permission for the project or global ADMIN or SYSADMIN rights.the username filter, list includes all users if unspecifiedcomma separated list of permissions for project or issue returned users must have, see Permissions JavaDoc for the list of all possible permissions.the issue key for the issue for which returned users have specified permissions.the optional project key to search for users with if no issueKey is supplied.the index of the first user to return (0-based)the maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username the username filter, list includes all users if unspecified

permissions string

permissions comma separated list of permissions for project or issue returned users must have, see Permissions JavaDoc for the list of all possible permissions.

issueKey string

issueKey the issue key for the issue for which returned users have specified permissions.

projectKey string

projectKey the optional project key to search for users with if no issueKey is supplied.

startAt string

startAt the index of the first user to return (0-based)

maxResults string

maxResults the maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

findUsersWithBrowsePermission(options, callbackopt) → {Promise.<any>}

Returns a list of active users that match the search string. This resource cannot be accessed anonymously and requires the Browse Users global permission. Given an issue key this resource will provide a list of users that match the search string and have the browse issue permission for the issue provided.the username filter, no users returned if left blankthe issue key for the issue being edited we need to find viewable users for.the optional project key to search for users with if no issueKey is supplied.the index of the first user to return (0-based)the maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username the username filter, no users returned if left blank

issueKey string

issueKey the issue key for the issue being edited we need to find viewable users for.

projectKey string

projectKey the optional project key to search for users with if no issueKey is supplied.

startAt string

startAt the index of the first user to return (0-based)

maxResults string

maxResults the maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

getAllAvatars(options, callbackopt) → {Promise.<any>}

Returns all avatars which are visible for the currently logged in user.username

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username username

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

login(options, callbackopt) → {Promise.<any>}

Creates a new session for a user in JIRA. Once a session has been successfully created it can be used to access any of JIRA's remote APIs and also the web UI by passing the appropriate HTTP Cookie header.

Note that it is generally preferrable to use HTTP BASIC authentication with the REST API. However, this resource may be used to mimic the behaviour of JIRA's log-in page (e.g. to display log-in errors to a user). Note that the response contains the Set-Cookie HTTP headers that must be honoured by the caller. If you are using a cookie-aware HTTP client then it will handle all Set-Cookie headers automatically. This is important because setting the JSESSIONID cookie alone may not be sufficient for the authentication to work.Schema{"id":"https://docs.atlassian.com/jira/REST/schema/auth-success#","title":"Auth Success","type":"object","properties":{"session":{"title":"Session Info","type":"object","properties":{"name":{"type":"string"},"value":{"type":"string"}},"additionalProperties":false},"loginInfo":{"title":"Login Info","type":"object","properties":{"failedLoginCount":{"type":"integer"},"loginCount":{"type":"integer"},"lastFailedLoginTime":{"type":"string"},"previousLoginTime":{"type":"string"}},"additionalProperties":false}},"additionalProperties":false}

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username

password string

password

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

logout(options, callbackopt) → {Promise.<any>}

Logs the current user out of JIRA, destroying the existing session, if any.

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

removeUserFromApplication(options, callbackopt) → {Promise.<any>}

Remove user from given application. Admin permission will be required to perform this operation.usernameapplication key

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username username

applicationKey string

applicationKey application key

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

resetColumns(options, callbackopt) → {Promise.<any>}

Reset the default columns for the given user to the system default. Admin permission will be required to get columns for a user other than the currently logged in user.username

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username username

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

setColumns(options, callbackopt) → {Promise.<any>}

Sets the default columns for the given user. Admin permission will be required to get columns for a user other than the currently logged in user.

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

storeTemporaryAvatar(options, callbackopt) → {Promise.<any>}

Creates temporary avatar. Creating a temporary avatar is part of a 3-step process in uploading a new avatar for a user: upload, crop, confirm.

The following examples shows these three steps using curl. The cookies (session) need to be preserved between requests, hence the use of -b and -c. The id created in step 2 needs to be passed to step 3 (you can simply pass the whole response of step 2 as the request of step 3).

curl -c cookiejar.txt -X POST -u admin:admin -H "X-Atlassian-Token: no-check" \ -H "Content-Type: image/png" --data-binary @mynewavatar.png \ 'http://localhost:8090/jira/rest/api/2/user/avatar/temporary?username=admin&filename=mynewavatar.png'

curl -b cookiejar.txt -X POST -u admin:admin -H "X-Atlassian-Token: no-check" \ -H "Content-Type: application/json" --data '{"cropperWidth": "65","cropperOffsetX": "10","cropperOffsetY": "16"}' \ -o tmpid.json \ http://localhost:8090/jira/rest/api/2/user/avatar?username=admin

curl -b cookiejar.txt -X PUT -u admin:admin -H "X-Atlassian-Token: no-check" \ -H "Content-Type: application/json" --data-binary @tmpid.json \ http://localhost:8090/jira/rest/api/2/user/avatar?username=admin usernamename of file being uploadedsize of file

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username username

filename string

filename name of file being uploaded

size string

size size of file

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

storeTemporaryAvatarUsingMultiPart(options, callbackopt) → {Promise.<any>}

Creates temporary avatar using multipart. The response is sent back as JSON stored in a textarea. This is because the client uses remote iframing to submit avatars using multipart. So we must send them a valid HTML page back from which the client parses the JSON from.

Creating a temporary avatar is part of a 3-step process in uploading a new avatar for a user: upload, crop, confirm. This endpoint allows you to use a multipart upload instead of sending the image directly as the request body.

You must use "avatar" as the name of the upload parameter:

curl -c cookiejar.txt -X POST -u admin:admin -H "X-Atlassian-Token: no-check" \ -F "avatar=@mynewavatar.png;type=image/png" \ 'http://localhost:8090/jira/rest/api/2/user/avatar/temporary?username=admin' Username

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username Username

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

update(options, callbackopt) → {Promise.<any>}

Modify user. The "value" fields present will override the existing value. Fields skipped in request will not be changed.the usernameuser key

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username the username

key string

key user key

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>

updateProjectAvatar(options, callbackopt) → {Promise.<any>}

Parameters:
Name Type Attributes Description
options Object

An object containing options to pass to the Jira API.

Properties
Name Type Description
username string

username

token string

token The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used

callback <optional>

if supplied, called with result of api call

Source:
Returns:

result of api call

Type
Promise.<any>