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.
Returns, for the user, details of the watched status of issues from a list. If an issue ID is invalid, the returned watched status is false
.
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:
read:jira-work
read:issue.watcher:jira
, read:user:jira
Connect app scope required: WRITE
A list of issue IDs.
array<string>
RequiredReturned if the request is successful
A container for the watch status of a list of issues.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import api, { route } from "@forge/api";
var bodyData = `{
"issueIds": [
"10001",
"10002",
"10005"
]
}`;
const response = await api.asUser().requestJira(route`/rest/api/3/issue/watching`, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: bodyData
});
console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.json());
1
2
3
4
5
6
7
{
"issuesIsWatching": {
"10001": true,
"10002": false,
"10005": true
}
}
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:
read:jira-work
read:issue.watcher:jira
, read:user:jira
, read:avatar:jira
Connect app scope required: READ
string
RequiredReturned if the request is successful
The details of watchers on an issue.
1
2
3
4
5
6
7
8
9
10
11
12
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import api, { route } from "@forge/api";
const response = await api.asUser().requestJira(route`/rest/api/3/issue/{issueIdOrKey}/watchers`, {
headers: {
'Accept': 'application/json'
}
});
console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.json());
1
2
3
4
5
6
7
8
9
10
11
12
13
{
"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"
}
]
}
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:
write:jira-work
write:issue.watcher:jira
Connect app scope required: WRITE
string
RequiredThe account ID of the user. Note that username cannot be used due to privacy changes.
string
Returned if the request is successful.
any
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import api, { route } from "@forge/api";
var bodyData = `"<string>"`;
const response = await api.asUser().requestJira(route`/rest/api/3/issue/{issueIdOrKey}/watchers`, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: bodyData
});
console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.json());
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:
write:jira-work
write:issue.watcher:jira
Connect app scope required: DELETE
string
Requiredstring
string
Returned if the request is successful.
1
2
3
4
5
6
7
8
9
10
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import api, { route } from "@forge/api";
const response = await api.asUser().requestJira(route`/rest/api/3/issue/{issueIdOrKey}/watchers?accountId=5b10ac8d82e05b22cc7d4ef5`, {
method: 'DELETE'
});
console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.text());
Rate this page: