This resource represents information about the current user, such as basic details, group membership, application roles, preferences, and locale. Use it to get, create, update, and delete (restore default) values of the user's preferences and locale.

Hierarchy

  • CommonHttpService
    • MyselfService

Constructors

  • Internal

    Create a new instance of the service.

    Parameters

    • getClientInstance: (() => CommonHttpClient)
        • (): CommonHttpClient
        • Returns CommonHttpClient

    Returns MyselfService

Methods

  • Returns details for the current user.

    Permissions required: Permission to access Jira.

    Parameters

    • params: {
          expand?: string;
      } = {}
      • Optionalexpand?: string

        Use expand to include additional information about user in the response. This parameter accepts a comma-separated list. Expand options include:

        • groups Returns all groups, including nested groups, the user belongs to.
        • applicationRoles Returns the application roles the user is assigned to.

    Returns Promise<User>

    Returned if the request is successful.

    example:

    {
    "accountId": "5b10a2844c20165700ede21g",
    "accountType": "atlassian",
    "active": true,
    "applicationRoles": {
    "items": [],
    "size": 1
    },
    "avatarUrls": {
    "16x16": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=16&s=16",
    "24x24": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=24&s=24",
    "32x32": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=32&s=32",
    "48x48": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=48&s=48"
    },
    "displayName": "Mia Krystof",
    "emailAddress": "mia@example.com",
    "groups": {
    "items": [],
    "size": 3
    },
    "key": "",
    "name": "",
    "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g",
    "timeZone": "Australia/Sydney"
    }

    GET /rest/api/3/myself @scopes-current read:jira-user @scopes-beta read:application-role:jira, read:group:jira, read:user:jira, read:avatar:jira

  • Returns the locale for the user.

    If the user has no language preference set (which is the default setting) or this resource is accessed anonymous, the browser locale detected by Jira is returned. Jira detects the browser locale using the Accept-Language header in the request. However, if this doesn't match a locale available Jira, the site default locale is returned.

    This operation can be accessed anonymously.

    Permissions required: None.

    Returns Promise<Locale>

    Returned if the request is successful.

    example:

    {
    "locale": "en_US"
    }

    GET /rest/api/3/mypreferences/locale @scopes-current manage:jira-configuration @scopes-beta read:user-configuration:jira

  • Returns the value of a preference of the current user.

    Note that these keys are deprecated:

    • jira.user.locale The locale of the user. By default this is not set and the user takes the locale of the instance.
    • jira.user.timezone The time zone of the user. By default this is not set and the user takes the timezone of the instance.

    These system preferences keys will be deprecated by 15/07/2024. You can still retrieve these keys, but it will not have any impact on Notification behaviour.

    • user.notifications.watcher Whether the user gets notified when they are watcher.
    • user.notifications.assignee Whether the user gets notified when they are assignee.
    • user.notifications.reporter Whether the user gets notified when they are reporter.
    • user.notifications.mentions Whether the user gets notified when they are mentions.

    Use Update a user profile from the user management REST API to manage timezone and locale instead.

    Permissions required: Permission to access Jira.

    Parameters

    • params: {
          key: string;
      }
      • key: string

        The key of the preference.

    Returns Promise<string>

    Returned if the request is successful.

    GET /rest/api/3/mypreferences @scopes-current manage:jira-configuration @scopes-beta read:user-configuration:jira

  • Deletes a preference of the user, which restores the default value of system defined settings.

    Note that these keys are deprecated:

    • jira.user.locale The locale of the user. By default, not set. The user takes the instance locale.
    • jira.user.timezone The time zone of the user. By default, not set. The user takes the instance timezone.

    Use Update a user profile from the user management REST API to manage timezone and locale instead.

    Permissions required: Permission to access Jira.

    Parameters

    • params: {
          key: string;
      }
      • key: string

        The key of the preference.

    Returns Promise<void>

    DELETE /rest/api/3/mypreferences @scopes-current manage:jira-configuration @scopes-beta delete:user-configuration:jira

  • Creates a preference for the user or updates a preference's value by sending a plain text string. For example, false. An arbitrary preference can be created with the value containing up to 255 characters. In addition, the following keys define system preferences that can be set or created:

    • user.notifications.mimetype The mime type used in notifications sent to the user. Defaults to html.
    • user.default.share.private Whether new filters are set to private. Defaults to true.
    • user.keyboard.shortcuts.disabled Whether keyboard shortcuts are disabled. Defaults to false.
    • user.autowatch.disabled Whether the user automatically watches issues they create or add a comment to. By default, not set: the user takes the instance autowatch setting.
    • user.notifiy.own.changes Whether the user gets notified of their own changes.

    Note that these keys are deprecated:

    • jira.user.locale The locale of the user. By default, not set. The user takes the instance locale.
    • jira.user.timezone The time zone of the user. By default, not set. The user takes the instance timezone.

    These system preferences keys will be deprecated by 15/07/2024. You can still use these keys to create arbitrary preferences, but it will not have any impact on Notification behaviour.

    • user.notifications.watcher Whether the user gets notified when they are watcher.
    • user.notifications.assignee Whether the user gets notified when they are assignee.
    • user.notifications.reporter Whether the user gets notified when they are reporter.
    • user.notifications.mentions Whether the user gets notified when they are mentions.

    Use Update a user profile from the user management REST API to manage timezone and locale instead.

    Permissions required: Permission to access Jira.

    Parameters

    • params: {
          key: string;
      } & ({
          mediaType?: "application/json";
          requestBody: string;
      } | {
          mediaType: "text/plain";
          requestBody: string;
      })

    Returns Promise<void>

    Returned if the request is successful.

    PUT /rest/api/3/mypreferences @scopes-current manage:jira-configuration @scopes-beta write:user-configuration:jira

  • Method to initialize the class. Normally used to set up validation rules.

    Returns void