Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Fetch all epics using ruby-jira gem

Chinmaya Patanaik May 24, 2018

I've been playing with Jira API via the `ruby-jira` gem. I have a task where I would like to list all the epics that belong to a user's account. My current solution is to get all the issues and return items with `issuetype` name set to `Epic`.

def list_epics

  epics = []

  begin
    all_issues = @Integration Team_client.Issue.all
    all_issues.each do |issue|
      epics << issue if issue.fields.issuetype.name == 'Epic
    end
  rescue JIRA::HTTPError
    puts "Jira API error"
  end
  epics
end

`@jira_client` represents an authenticated user account.

I couldn't find much information from the documentation page of `jira-ruby` project. So any help is appreciated.

1 answer

0 votes
Tarun Sapra
Community Champion
May 24, 2018 edited

Hello @Chinmaya Patanaik

Since your requirement is " I have a task where I would like to list all the epics that belong to a user's account."

Thus, in the ruby gem you can check if there is support for doing a JQL query (there must be)

The you can fire a JQL query like "type = epic and assignee = <user-account>" and thus the results from the call based on the above JQL should get you the results you want.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, loom, loom for training, loom for teaching, video training, async learning, online education, screen recording, loom tutorials, loom use cases, atlassian learning, team training tools, instructional video, virtual training tools

🛗 Elevate Your Training and Enablement with Loom

Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!

Register today
AUG Leaders

Atlassian Community Events