This resource represents users watching an issue. Use it to get details of users watching an issue as well as start and stop a user watching an issue.

Hierarchy

  • CommonHttpService
    • IssueWatchersService

Constructors

  • Internal

    Create a new instance of the service.

    Parameters

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

    Returns IssueWatchersService

Methods

  • Adds a user as a watcher of an issue by passing the account ID of the user. For example, "5b10ac8d82e05b22cc7d4ef5". If no user is specified the calling user is added.

    This operation requires the Allow users to watch issues option to be ON. This option is set in General configuration for Jira. See Configuring Jira application options for details.

    Permissions required:

    • Browse projects project permission for the project that the issue is in.
    • If issue-level security is configured, issue-level security permission to view the issue.
    • To add users other than themselves to the watchlist, Manage watcher list project permission for the project that the issue is in.

    Parameters

    • params: {
          issueIdOrKey: string;
          requestBody: string;
      }
      • issueIdOrKey: string

        The ID or key of the issue.

      • requestBody: string

        The account ID of the user. Note that username cannot be used due to privacy changes.

    Returns Promise<void>

    Returned if the request is successful.

    POST /rest/api/3/issue/{issueIdOrKey}/watchers @scopes-current write:jira-work @scopes-beta write:issue.watcher:jira

  • Returns the watchers for an issue.

    This operation requires the Allow users to watch issues option to be ON. This option is set in General configuration for Jira. See Configuring Jira application options for details.

    This operation can be accessed anonymously.

    Permissions required:

    • Browse projects project permission for the project that the issue is ini
    • If issue-level security is configured, issue-level security permission to view the issue.
    • To see details of users on the watchlist other than themselves, View voters and watchers project permission for the project that the issue is in.

    Parameters

    • params: {
          issueIdOrKey: string;
      }
      • issueIdOrKey: string

        The ID or key of the issue.

    Returns Promise<Watchers>

    Returned if the request is successful

    example:

    {
    "isWatching": false,
    "self": "https://your-domain.atlassian.net/rest/api/3/issue/EX-1/watchers",
    "watchCount": 1,
    "watchers": [
    {
    "accountId": "5b10a2844c20165700ede21g",
    "active": false,
    "displayName": "Mia Krystof",
    "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g"
    }
    ]
    }

    GET /rest/api/3/issue/{issueIdOrKey}/watchers @scopes-current read:jira-work @scopes-beta read:issue.watcher:jira, read:user:jira, read:avatar:jira

  • Deletes a user as a watcher of an issue.

    This operation requires the Allow users to watch issues option to be ON. This option is set in General configuration for Jira. See Configuring Jira application options for details.

    Permissions required:

    • Browse projects project permission for the project that the issue is in.
    • If issue-level security is configured, issue-level security permission to view the issue.
    • To remove users other than themselves from the watchlist, Manage watcher list project permission for the project that the issue is in.

    Parameters

    • params: {
          accountId?: string;
          issueIdOrKey: string;
          username?: string;
      }
      • OptionalaccountId?: string

        The account ID of the user, which uniquely identifies the user across all Atlassian products. For example, 5b10ac8d82e05b22cc7d4ef5. Required.

      • issueIdOrKey: string

        The ID or key of the issue.

      • Optionalusername?: string

        This parameter is no longer available. See the deprecation notice for details.

    Returns Promise<void>

    DELETE /rest/api/3/issue/{issueIdOrKey}/watchers @scopes-current write:jira-work @scopes-beta write:issue.watcher:jira

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

    Returns void