A few days ago, I was asked to craft a JQL query to pull all the elements from my Jira project because, you know, numbers are everything when it comes to BI insights! 📊
We’re juggling a pretty complex hierarchy:
-> Initiative
-> Feature
-> SubFeature
-> Epics (can be in another Jira project)
-> Stories (and so on).
All working in tandem across multiple teams, synchronized in one big backlog. Sounds like a fun puzzle, right? 😅
But here’s the kicker: Jira simply refuses to give us a straightforward way to do this with a single JQL. Tons of articles, feature requests… it’s clear Jira’s pretty fixed in its ways, probably because of all that customization magic under the hood.
So, naturally, I started thinking like a Python dev tinkering, hacking, and experimenting. And I found a pretty neat post suggesting a way to retrieve all related elements connected to an Initiative using this JQL:
project = MYPROJECT AND issuekey in childIssuesOf("MYInititative-1ID")
This approach worked pretty well, but only for a single element at a time. Naturally, I started thinking I could leverage the API to iterate over multiple items... because why not automate the whole thing? 🚀
But here’s the twist: since my last API adventure, things changed quite a bit. I moved from a Cloud instance to a Server instance. And that (surprise!) broke my usual authentication methods. The standard login? Nope, not working anymore. 😕
So, I turned to 'Grok' I asked it to help me craft some code to log in and run the queries. But (plot twist!), Grok couldn’t quite deliver the right magic the different reply (and requests to fix the issues) were resulting in a classic 404 Unauthorized.🤔
Undeterred, I decided to experiment some more. I tried a different approach running the request via LibreChat to see if I could crack the authentication mystery.
Stay tuned for what I found out next...
This was the same prompt I provided:
Considering I'm a new joiner of python, and that this code should work to connect Jira API:
`
from jira import JIRA
host = "https://jira.Server.com/"
pat = 'yourToken' headers = JIRA.DEFAULT_OPTIONS["headers"].copy()
headers["Authorization"] = f"Bearer {pat}"
jira=JIRA(server=host, options={"headers": headers})
`
can you create a python script which enable me to run this query:
`project = MYPROJECT AND issuekey in childIssuesOf("MYInititative-1ID")`
And what I got was really surprisingly good...
Not only a script that works but a script with steps and nice output:
Here my code
github repo
Output:
python retrieve_initiative_childs.py
🚀 Starting Jira Query Script
==================================================
✅ Successfully connected to Jira
🔍 Executing query: project = MYPROJECT AND issuekey in childIssuesOf("MYINITIATIVE-1")
📊 Found 50 issues
================================================================================
QUERY RESULTS
================================================================================
1. Issue Key: MYResult-1
Summary: Initiative summary
Status: ToDo
Assignee: Unassigned
Priority: Minor
Issue Type: Sub-Feature
URL: https://jira.server.com/browse/MYRESULT-4
----------------------------------------
...
Finally, I made some adjustments to the script (always with Librechat support) to retrieve all the Initiatives and gather all their related child elements into a CSV file making life easier for our BI team to analyze and work with the data seamlessly. 📊
What really surprised me was the clarity and level of detail available to manage the output during execution. Often, these little nuances are overlooked by senior developers, but they can make a huge difference in troubleshooting and refining the process.
It’s a reminder that sometimes, taking the time to fine tune your tools and outputs pays off in big dividends. 🚀
Moreover, I was pleasantly surprised to realize that my background as a developer helped me craft effective prompts that guided the process and refined the results. To me, this underscores that vibe coding truly works hand-in-hand with developers—those who are open to experimenting, exploring, and trying new approaches. ✅
It’s a powerful reminder that combining technical expertise with a curious mindset can lead to innovative solutions and exciting discoveries. 🚀
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.