Home/Atlassian REST API reference
Jira and Confluence Cloud REST API
JQL autocomplete data and suggestions in the Jira REST API
Two read-only endpoints feed a JQL editor. /jql/autocompletedata returns every field name with its operators, every function and the reserved words. /jql/autocompletedata/suggestions completes one value for a field, for example the statuses that start with To.
Endpoints
| Method | Path | What it does |
|---|---|---|
GET | /rest/api/3/jql/autocompletedata | Returns visible field names, functions and reserved words. |
GET | /rest/api/3/jql/autocompletedata/suggestions | Returns value suggestions for a field. |
POST | /rest/api/3/jql/parse | Validates JQL. |
Examples
GET /rest/api/3/jql/autocompletedata
Reads the full reference data. The excerpt shows the first two fields and the shape of each entry.
curl
curl \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
'https://your-domain.atlassian.net/rest/api/3/jql/autocompletedata'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/3/jql/autocompletedata',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"visibleFieldNames": [
{
"value": "\"[CHART] Date of First Response\"",
"displayName": "[CHART] Date of First Response - cf[10026]",
"orderable": "true",
"searchable": "true",
"cfid": "cf[10026]",
"operators": [
"=",
"!=",
"in",
"not in",
"is",
"is not",
"<",
"<=",
">",
">="
],
"types": [
"java.util.Date"
]
},
{
"value": "\"[CHART] Time in Status\"",
"displayName": "[CHART] Time in Status - cf[10027]",
"orderable": "true",
"searchable": "true",
"cfid": "cf[10027]",
"operators": [
"~",
"!~",
"is",
"is not"
],
"types": [
"java.lang.String"
]
}
],
"visibleFunctionNames": [
{
"value": "approved()",
"displayName": "approved()"
},
{
"value": "approver(\"\")",
"displayName": "approver(\"\")"
}
],
"jqlReservedWords": [
"fetch",
"function"
]
}Response headers
X-Ratelimit-Limit: 350Sent to Atlassian Cloud on .
GET /rest/api/3/jql/autocompletedata/suggestions
Asks for values of status that contain To. The match is wrapped in bold tags in displayName.
curl
curl -G \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
--data-urlencode 'fieldName=status' \
--data-urlencode 'fieldValue=To' \
'https://your-domain.atlassian.net/rest/api/3/jql/autocompletedata/suggestions'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/3/jql/autocompletedata/suggestions',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'fieldName': 'status', 'fieldValue': 'To'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"results": [
{
"value": "\"To Do\"",
"displayName": "<b>To</b> Do"
}
]
}Sent to Atlassian Cloud on .
POST /rest/api/3/jql/parse
Validates a query that uses the field and value learned from the suggestions.
curl
curl -X POST \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"queries": [
"project = WEB AND status = Done",
"project = "
]
}' \
'https://your-domain.atlassian.net/rest/api/3/jql/parse?validation=strict'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.post(
'https://your-domain.atlassian.net/rest/api/3/jql/parse?validation=strict',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'validation': 'strict'},
json={'queries': ['project = WEB AND status = Done', 'project = ']},
)
print(r.status_code, r.text)Response: HTTP 200
{
"queries": [
{
"query": "project = WEB AND status = Done",
"structure": {
"where": {
"clauses": [
{
"field": {
"name": "project",
"encodedName": "project"
},
"operator": "=",
"operand": {
"value": "WEB",
"encodedValue": "WEB"
}
},
{
"field": {
"name": "status",
"encodedName": "status"
},
"operator": "=",
"operand": {
"value": "Done",
"encodedValue": "Done"
}
}
],
"operator": "and"
}
}
}
]
}Sent to Atlassian Cloud on .
How it behaves
- The data call returned 184 field names, 67 function names and 178 reserved words on this instance. The field list includes entries added by installed apps, such as "[CHART] Date of First Response".
- Each field entry has value (already quoted when the name needs it), displayName with the custom field id appended, orderable, searchable, the operators it accepts and its Java types.
- The suggestion for fieldName=status and fieldValue=To was one result: value "To Do" with the quotes included, and displayName with the typed part wrapped in <b> tags.
Pitfalls
- displayName in suggestions contains HTML. Strip or render it before putting it in a plain text field.
- Use value, not displayName, when you build a JQL string. value already carries the quotes JQL needs.
- The list differs by site and by installed app, so cache it per site and not across sites.
Questions and answers
Can I filter suggestions by prefix?
Yes. fieldValue takes the partial text. With status and To the response contained only To Do.
Related
- Parse and validate JQL
- Search with JQL
- Fields, work types, priorities, statuses
- expand, fields and properties parameters