Skip to content

[JiraSprint] Use /search/jql endpoint for Jira Cloud - #12262

Open
torrresagus wants to merge 1 commit into
badges:masterfrom
tiltmeter-dev:fix/jira-search-jql
Open

torrresagus wants to merge 1 commit into
badges:masterfrom
tiltmeter-dev:fix/jira-search-jql

Conversation

@torrresagus

Copy link
Copy Markdown

What changed in the API

Notice jira-cloud-change-2046-search-jql about atlassian.net's API describes this change, published 2024-10-31 and effective 2025-05-01. It is not signed by atlassian.net: it was read from a file the person running Tiltmeter trusts.

The notice's summary:

Jira Cloud removed GET and POST /rest/api/3/search and /rest/api/2/search, which now answer 410
Gone, in favor of /rest/api/3/search/jql and /rest/api/2/search/jql, which page with nextPageToken
instead of startAt, return no total, and return only issue ids unless the request names its fields.
Jira Server and Data Center keep the old endpoints: code that serves both must switch only for Cloud
sites. Source: https://developer.atlassian.com/changelog/#CHANGE-2046

GET https://your-domain.atlassian.net/rest/api/2/search

Severity Change Path Before After
breaking endpoint_removed $ — (gone), moved to GET https://your-domain.atlassian.net/rest/api/2/search/jql
breaking field_removed $.total — (absent)
breaking field_removed $.maxResults — (absent)
breaking field_removed $.startAt — (absent)

POST https://your-domain.atlassian.net/rest/api/2/search

Severity Change Path Before After
breaking endpoint_removed $ — (gone), moved to POST https://your-domain.atlassian.net/rest/api/2/search/jql
breaking field_removed $.total — (absent)
breaking field_removed $.maxResults — (absent)
breaking field_removed $.startAt — (absent)

The notice's notes:

GET /rest/api/2/search: Query parameters: jql, nextPageToken instead of startAt, maxResults, fields,
expand. fields defaults to id only: pass the fields the code reads, such as fields=*navigable. Only
Jira Cloud (*.atlassian.net, api.atlassian.com/ex/jira) removed it; Server and Data Center sites
keep the old endpoint.
$.total: To count matching issues, POST /rest/api/2/search/approximate-count with body {"jql":
"..."}; it returns {"count": n}.
$.startAt: Pages are fetched with nextPageToken: pass the nextPageToken of the previous page; isLast
is true on the last page.
POST /rest/api/2/search: Body: jql, nextPageToken instead of startAt, maxResults, fields (a list),
expand (a string). fields defaults to id only: send the fields the code reads, such as
["*navigable"]. Only Jira Cloud (*.atlassian.net, api.atlassian.com/ex/jira) removed it; Server and
Data Center sites keep the old endpoint.

What this pull request changes

JiraSprint now calls /rest/api/2/search/jql for Jira Cloud sites (*.atlassian.net and api.atlassian.com/ex/jira), because Cloud removed /rest/api/2/search in CHANGE-2046. On Cloud it follows nextPageToken until isLast and counts the issues itself, since the new endpoint returns no total. Server and Data Center sites still call /search and use total as before, and a new mocked service test covers Cloud paging.

  • services/jira/jira-sprint.service.js
  • services/jira/jira-sprint.tester.js

Left for a human

  • The code finds Cloud sites by hostname only. A Cloud site on a custom domain would still call the removed /search endpoint and get 410 Gone.
  • The tests were not run because there is no shell here. The new Cloud test in jira-sprint.tester.js is mocked with nock, and it only runs in CI when the PR title includes [JiraSprint].

This pull request was generated automatically by Tiltmeter from the unsigned notice jira-cloud-change-2046-search-jql about atlassian.net's API. An AI agent (Claude Code with claude-opus-5-5) wrote these edits; review them like any other change.

JiraSprint now calls `/rest/api/2/search/jql` for Jira Cloud sites (`*.atlassian.net` and `api.atlassian.com/ex/jira`), because Cloud removed `/rest/api/2/search` in CHANGE-2046. On Cloud it follows `nextPageToken` until `isLast` and counts the issues itself, since the new endpoint returns no `total`. Server and Data Center sites still call `/search` and use `total` as before, and a new mocked service test covers Cloud paging.

Notice jira-cloud-change-2046-search-jql about atlassian.net's API describes the change. It was read from a file and is not signed by the provider.
@github-actions

Copy link
Copy Markdown
Contributor
Warnings
⚠️

📚 Remember to ensure any changes to config.private in services/jira/jira-sprint.service.js are reflected in the server secrets documentation.

Messages
📖 ✨ Thanks for your contribution to Shields, @torrresagus!

Generated by 🚫 dangerJS against 90677f1

@LitoMore LitoMore added the service-badge New or updated service badge label Oct 28, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

service-badge New or updated service badge

Development

Successfully merging this pull request may close these issues.

2 participants