Run JQL search query using Jira Cloud REST API

プラットフォームについて: Cloud のみ - この記事は クラウド プラットフォームのアトラシアン製品に適用されます。

   

要約

You can use Jira Cloud's REST API to return work items based on a JQL search query.

In turn, we can use additional methods to return Jira work items using the API, including:

  • Performing a cURL request
  • Creating an automation rule to Send a web request

In all cases, we'll use the Search for issues using JQL (GET) API endpoint. As the JQL query is a request parameter for this resource, it must be URL-encoded in order to work correctly.

Encode the JQL query

There are two ways to encode a JQL query to make it URL-compatible.

Option 1: Run JQL in Jira and copy from address bar

  1. In Jira, select Search > View all issues
  2. Write a JQL query and select the magnifying glass tilted left Search icon
    1. In your browser's address bar, the JQL query will be encoded following jql=
  3. Copy the text following the "=" character for use in the API
    jira issue search page with JQL query. the address bar is highlighted, displaying the JQL encoded in API-ready format. 

Option 2: Use URL encoding smart value in Jira Automation

Jira Automation supports the URL Encoding Smart Value in automation rules that you create. You can input your JQL query as you would in Jira search to get the proper encoded value returned. 

例:

{{#urlEncode}}project = SUP and created > -5d{{/}}

For more details, please refer to our documentation on Smart Values in Jira Automation.

JQL API search with cURL


This operation requires an API token. Please refer to Manage API tokens for your Atlassian account.

This cURL command returns work items created in the last 7 days for the "OP" project.

curl --request GET \
  --url 'https://yoursitename.atlassian.net/rest/api/3/search?maxResults=10000&jql%3Dproject%3DOP%20and%20created%20%3E%3D%20-7d' \
  --user 'youremail@mail.com:yourapitoken' \
  --header 'Accept: application/json'

JQL API search with Postman

This operation requires an API token. Please refer to Manage API tokens for your Atlassian account.

The screenshot below provides an example of project OP work items created within the last 5 days.
screenshot of the Postman interface. the details for a GET request to the jira search endpoint are filled in.

JQL API search from Jira automation

The following examples show automation rules that use the Send web request action. For more details on how to build this type of rule please check Automation for Jira - Send web request using Jira REST API.

Automation rule using a manually encoded JQL query

https://yoursitename.atlassian.net/rest/api/3/search?fields=key&maxResults=500&jql=project%3DOG%20and%20created%3E%3D%20-5d

jira automation rule example. the rule searches for issues with a manually created JQL query and returns the search value to the automation audit log.

Automation rule using a JQL query encoded by the URL encoding smart value

https://yoursitename.atlassian.net/rest/api/3/search?fields=key&maxResults=500&jql={{#urlEncode}}project=OG and created>= -5d{{/}}

automation rule example. the rule searches for a JQL query using the URL encoding smart value and returns the search data to the automation audit log.

  • Web Response Smart Values for adding values to the Audit Log

    Jira Issue JSON URL: {{webResponse.body.issues.self}} Jira Issue Keys: {{webResponse.body.issues.key}}
    • Result from both automation rules:
      automation audit log. the results of the combined rules above are displayed in the log event.

その他のリソース

Last modified on Mar 17, 2025

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.