rest/api/2/search?jql=project={{PROJECT}}&maxResults=3
object(stdClass)[1] public 'expand' => string 'schema,names' (length=12) public 'startAt' => int 0 public 'maxResults' => int 3 public 'total' => int 95 public 'issues' => array (size=3) 0 => object(stdClass)[2] public 'expand' => string 'operations,versionedRepresentations,editmeta,changelog,customfield_10010.requestTypePractice,renderedFields' (length=107) public 'id' => string '00000' (length=5) public 'self' => string 'https://domain.atlassian.net/rest/api/2/issue/00000' (length=56) public 'key' => string 'xxx-000' (length=10) public 'fields' => object(stdClass)[3] ... 1 => etc...
Note: I have custom workflow and custom statuses.
Several suggestions from the community forums and Stack but nothing worked.
Example:
rest/api/2/search?jql=filter=11111+and+status="In+Progress"&fields=id,key,status
https://synergix.atlassian.net/rest/api/2/search?jql=project="PROJECT_KEY"%20and%20(status="In Progress"%20or%20status%20=%20"Open")
Documentation needed to connect and query based on a custom workflow: Click here;
The solution:
project = PROJECT_ID AND (status="Staged / Completed" OR status = "Live / Closed")
Everything together:
$jira_token = "YOUR_API_TOKEN";
$jira_domain = "https://DOMAIN.atlassian.net";
$jira_user = "EMAIL@DOMAIN.com";
$jql = "project = PROJECT_ID AND (status=\"Staged / Completed\" OR status = \"Live / Closed\")";
$query = http_build_query([
"jql" => $jql,
"maxResults" => 3,
"fields" => "self"
]);
$jira_url = $jira_domain . '/rest/api/2/search?' . $query;
$jira_password = $jira_user .":". $jira_token;
// Do your Curl request...
$jira_issues = json_decode($result);
Explanation:
YOUR_API_TOKEN - More about it here.
PROJECT_ID - Or project key. More about it here.
DOMAIN - Your Atlassian domain.
EMAIL@DOMAIN.com - Your Jira account email.
Note: I suggest that you use this instead of building this from scratch.
Some help for folks that are using a local env to test. This took me a while to figure out but you need CA certificates to use the API on WAMP or XAMPP.
Download here.
There is plenty of help online on how to install it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @David
Welcome to the Atlassian community!
Do you need to get this information through the API so that you can use the value somewhere else programmatically?
If you don't require that, then two ways you can get the count of issues matching a filter are:
1. Use an Automation Rule with a Lookup Issues action to retrieve the issues, and email yourself the count of issues using the smart value {{lookupIssues.size}}
2. Use the Two Dimensional Filter Statistics gadget on a Jira Dashboard.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes, I need programmatic access. I want to use this information on my reports dashboard.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When you say nothing has worked, what are you getting? Is there an error message? Is the 'total' value in the returned object wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I appreciate you trying to help but I figured it out on my own. I posted the solution here to help someone else maybe trying to achieve the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.