Home/Atlassian REST API reference
Jira and Confluence Cloud REST API
Jira REST API v2 vs v3: what actually differs
Version 2 and version 3 of the Jira Cloud platform API offer the same operations. v3 adds support for Atlassian Document Format in comment bodies, worklog comments, the description and environment fields and multi-line text custom fields, while v2 takes and returns strings. A work item created through v2 is the same work item in v3, so a client can mix the two.
Endpoints
| Method | Path | What it does |
|---|---|---|
POST | /rest/api/3/issue | Creates a work item. The description must be ADF. |
POST | /rest/api/2/issue | Same operation. The description is a string. |
GET | /rest/api/3/issue/{issueIdOrKey}/comment | Lists comments with ADF bodies. |
GET | /rest/api/2/issue/{issueIdOrKey}/comment/{id} | Returns one comment with a string body. |
Examples
POST /rest/api/2/issue
Creates a work item through v2 with a wiki markup string as the description.
curl
curl -X POST \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"fields": {
"project": {
"key": "WEB"
},
"issuetype": {
"name": "Task"
},
"summary": "Example created through REST API v2",
"description": "Created with *wiki markup* through v2."
}
}' \
'https://your-domain.atlassian.net/rest/api/2/issue'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.post(
'https://your-domain.atlassian.net/rest/api/2/issue',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
json={'fields': {'project': {'key': 'WEB'},
'issuetype': {'name': 'Task'},
'summary': 'Example created through REST API v2',
'description': 'Created with *wiki markup* through v2.'}},
)
print(r.status_code, r.text)Response: HTTP 201
{
"id": "10769",
"key": "WEB-58",
"self": "https://your-domain.atlassian.net/rest/api/2/issue/10769"
}Sent to Atlassian Cloud on .
POST /rest/api/3/issue
Sends the same kind of plain string description to v3.
curl
curl -X POST \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"fields": {
"project": {
"key": "WEB"
},
"issuetype": {
"name": "Task"
},
"summary": "Plain string description",
"description": "plain string"
}
}' \
'https://your-domain.atlassian.net/rest/api/3/issue'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.post(
'https://your-domain.atlassian.net/rest/api/3/issue',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
json={'fields': {'project': {'key': 'WEB'},
'issuetype': {'name': 'Task'},
'summary': 'Plain string description',
'description': 'plain string'}},
)
print(r.status_code, r.text)Response: HTTP 400
{
"errorMessages": [],
"errors": {
"description": "The field value is not valid Atlassian Document Format (ADF) content."
}
}Sent to Atlassian Cloud on .
GET /rest/api/2/issue/{issueIdOrKey}/comment/{commentId}
Reads, through v2, a comment that was written as ADF through v3.
curl
curl -G \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
--data-urlencode 'expand=renderedBody' \
'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/comment/{commentId}'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/comment/{commentId}',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'expand': 'renderedBody'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"self": "https://your-domain.atlassian.net/rest/api/2/issue/10766/comment/11103",
"id": "11103",
"body": "First comment through the REST API.",
"renderedBody": "<p>First comment through the REST API.</p>"
}Sent to Atlassian Cloud on .
GET /rest/api/3/issue/{issueIdOrKey}/comment
Reads, through v3, the comment that was written through v2 as a wiki markup string.
curl
curl -G \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
--data-urlencode 'maxResults=2' \
--data-urlencode 'orderBy=-created' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/comment'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/comment',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'maxResults': '2', 'orderBy': '-created'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"startAt": 0,
"maxResults": 2,
"total": 2,
"comments": [
{
"self": "https://your-domain.atlassian.net/rest/api/3/issue/10766/comment/11104",
"id": "11104",
"body": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "A "
},
{
"type": "text",
"text": "bold",
"marks": [
{
"type": "strong"
}
]
},
{
"type": "text",
"text": " comment through v2."
}
]
}
]
}
}
]
}Sent to Atlassian Cloud on .
GET /rest/api/2/myself
Shows that v2 responses keep v2 in their self links.
curl
curl \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
'https://your-domain.atlassian.net/rest/api/2/myself'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/2/myself',
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/2/user?accountId=<accountId>",
"accountId": "<accountId>",
"displayName": "<display name>"
}Sent to Atlassian Cloud on .
How it behaves
- POST /rest/api/2/issue accepted a wiki markup string as description and answered 201 with id, key and a v2 self link.
- POST /rest/api/3/issue with a plain string description answered 400 with the message The field value is not valid Atlassian Document Format (ADF) content.
- A comment written through v3 as an ADF paragraph came back from v2 as a plain string body, with renderedBody holding the HTML.
- A comment written through v2 as a string with *bold* came back from v3 as an ADF document with a strong mark on the word.
- Links in responses follow the version used for the request.
Pitfalls
- The v2 string was read as wiki markup in the run: the asterisks around a word became bold in the v3 view.
- Switching a client from v2 to v3 breaks every call that sends a string to description, environment, a comment body or a multi-line text field. Single-line text custom fields stay strings in v3.
- Reading a v3 comment through v2 flattens it to text. The run covers one plain paragraph only, so check how headings, lists and mentions come back before relying on it.
- Search is a separate case: the old search paths were removed in both versions.
Questions and answers
Should I use v2 or v3?
v3 is the latest version and is the one the reference describes. Use v2 only when a tool cannot produce ADF, because it takes strings for the rich text fields.
Do v2 and v3 have different operations?
The reference says both offer the same collection of operations. The difference is how rich text fields are represented.