Going Stellar

Home/Atlassian REST API reference

Jira and Confluence Cloud REST API

Jira work item votes with the REST API

GET /rest/api/3/issue/{issueIdOrKey}/votes returns the vote count, whether the caller has voted and the voters. POST adds the caller's vote and DELETE removes it, both with 204. Voting must be switched on for the site, otherwise the spec says 404.

Endpoints

MethodPathWhat it does
GET/rest/api/3/issue/{issueIdOrKey}/votesReturns the vote details of a work item.
POST/rest/api/3/issue/{issueIdOrKey}/votesAdds the caller's vote.
DELETE/rest/api/3/issue/{issueIdOrKey}/votesRemoves the caller's vote.

Examples

GET /rest/api/3/issue/{issueIdOrKey}/votes

Read the votes of a work item with no votes. The voters list is empty.

curl

curl \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/votes'

Python (requests)

import os
import requests

EMAIL = "you@example.com"
r = requests.get(
    'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/votes',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)

Response: HTTP 200

{
 "self": "https://your-domain.atlassian.net/rest/api/3/issue/WEB-55/votes",
 "votes": 0,
 "hasVoted": false,
 "voters": []
}

Response headers

X-Ratelimit-Limit: 350
X-Ratelimit-Remaining: 348

Sent to Atlassian Cloud on .

POST /rest/api/3/issue/{issueIdOrKey}/votes

Add the caller's vote. There is no body in the request or the answer.

curl

curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/votes'

Python (requests)

import os
import requests

EMAIL = "you@example.com"
r = requests.post(
    'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/votes',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)

Response: HTTP 204

No response body.

Sent to Atlassian Cloud on .

GET /rest/api/3/issue/{issueIdOrKey}

The work item itself carries a votes summary with the count and hasVoted, without voters.

curl

curl \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}'

Python (requests)

import os
import requests

EMAIL = "you@example.com"
r = requests.get(
    'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)

Response: HTTP 200

{
 "key": "WEB-55",
 "fields": {
  "votes": {
   "self": "https://your-domain.atlassian.net/rest/api/3/issue/WEB-55/votes",
   "votes": 0,
   "hasVoted": false
  }
 }
}

Sent to Atlassian Cloud on .

How it behaves

  • GET answers self, votes, hasVoted and voters; with zero votes the voters array was empty.
  • POST needs no body and answered 204.
  • The issue resource has its own votes object with self, votes and hasVoted.

Pitfalls

  • Vote operations act on the calling user. There is no accountId parameter to vote for someone else.
  • Without the View voters and watchers permission the voters list stays empty even when votes exist, as the spec notes.
  • A 404 on votes can mean voting is disabled on the site, not that the work item is missing.
  • The spec sets a per-work-item cap of 50,000 voters and answers 413 beyond it.

Questions and answers

Can I vote on behalf of another user?

No. The operations use the caller's identity and take no user parameter.

Sources

  1. The Jira Cloud platform REST API v3 (Atlassian Developer)
  2. Get votes (Jira REST API v3)
  3. Add vote (Jira REST API v3)
  4. Delete vote (Jira REST API v3)

Markdown version · All REST API pages