• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


06 Feb, 2025

Updated at 15 Feb, 2025

jira query api curl bash not showing results

#!/bin/bash

# Load environment variables from .env file
source .env

# Jira API URL to get issues assigned to the user in the current sprint with "READY FOR DEV" status
JQL_QUERY="assignee=$ASSIGNEE_ID%20AND%20sprint%20in%20openSprints()%20AND%20project%20%3D%20%22$PROJECT_KEY%22"

URL="https://$JIRA_DOMAIN/rest/agile/1.0/board/$BOARD_ID/issue?jql=$JQL_QUERY&maxResults=100"

# Make the API request with curl
response=$(curl -s -X GET "$URL" -H "Authorization: Basic $(echo -n "$EMAIL:$API_TOKEN" | base64)" -H "Accept: application/json")

# Check if there are issues and filter by status "READY FOR DEV"
issues_count=$(echo "$response" | jq '.issues | length')
if [ -z "$issues_count" ]; then
    issues_count=0
fi

if [ "$issues_count" -gt 0 ]; then
    echo "Issues Assigned to User in Current Sprint with Status 'READY FOR DEV' on Board $BOARD_ID:"
    echo "$response" | jq -r '.issues[] | select(.fields.status.name == "READY FOR DEV") | "\(.key) - \(.fields.summary) [Status: \(.fields.status.name)]"'
else
    echo "No issues found assigned to the user in the current sprint with status 'READY FOR DEV'."
fi