Skip to content

Latest commit

 

History

History
186 lines (138 loc) · 8.89 KB

IssueWatchersApi.md

File metadata and controls

186 lines (138 loc) · 8.89 KB

IssueWatchersApi

All URIs are relative to https://your-domain.atlassian.com

Method HTTP request Description
addWatcher POST /rest/api/3/issue/{issueIdOrKey}/watchers Add watcher
getIssueWatchers GET /rest/api/3/issue/{issueIdOrKey}/watchers Get issue watchers
removeWatcher DELETE /rest/api/3/issue/{issueIdOrKey}/watchers Delete watcher

addWatcher

Object addWatcher(body, issueIdOrKey)

Add watcher

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.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.IssueWatchersApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

IssueWatchersApi apiInstance = new IssueWatchersApi();
String body = "body_example"; // String | The account ID of the user. Note that username cannot be used due to privacy changes.
String issueIdOrKey = "issueIdOrKey_example"; // String | The ID or key of the issue.
try {
    Object result = apiInstance.addWatcher(body, issueIdOrKey);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling IssueWatchersApi#addWatcher");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body String The account ID of the user. Note that username cannot be used due to privacy changes.
issueIdOrKey String The ID or key of the issue.

Return type

Object

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getIssueWatchers

Watchers getIssueWatchers(issueIdOrKey)

Get issue watchers

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.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.IssueWatchersApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

IssueWatchersApi apiInstance = new IssueWatchersApi();
String issueIdOrKey = "issueIdOrKey_example"; // String | The ID or key of the issue.
try {
    Watchers result = apiInstance.getIssueWatchers(issueIdOrKey);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling IssueWatchersApi#getIssueWatchers");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
issueIdOrKey String The ID or key of the issue.

Return type

Watchers

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

removeWatcher

removeWatcher(issueIdOrKey, username, accountId)

Delete watcher

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.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.IssueWatchersApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

IssueWatchersApi apiInstance = new IssueWatchersApi();
String issueIdOrKey = "issueIdOrKey_example"; // String | The ID or key of the issue.
String username = "username_example"; // String | This parameter is no longer available and will be removed from the documentation soon. See the [deprecation notice](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/) for details.
String accountId = "accountId_example"; // String | The account ID of the user, which uniquely identifies the user across all Atlassian products. For example, *5b10ac8d82e05b22cc7d4ef5*. Required.
try {
    apiInstance.removeWatcher(issueIdOrKey, username, accountId);
} catch (ApiException e) {
    System.err.println("Exception when calling IssueWatchersApi#removeWatcher");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
issueIdOrKey String The ID or key of the issue.
username String This parameter is no longer available and will be removed from the documentation soon. See the deprecation notice for details. [optional]
accountId String The account ID of the user, which uniquely identifies the user across all Atlassian products. For example, 5b10ac8d82e05b22cc7d4ef5. Required. [optional]

Return type

null (empty response body)

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined