How do I read the data from attachments (.csv and .txt files), from inside a ticket?

Hi all,

I am new to atlassian community.

 

Here's what I am trying to do.

writing a python script to:

- open issue pages which are created in JIRA from last 90 days

- open attachment of each issue and read the .txt and ,csv file

- collect all the data into one big .txt or .csv file

- finally attach it to a new ticket and assigning it to my self.

 

Can someone please confirm if the whole process is even achievable ?

If yes, hints/pseudocode would be great.

Cheers!

 

1 answer

Defintely possible.You can easily use the REST interface:

      * Search for issues

https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-query-issues

      * Iterate over the results in your code, pulling out references to the attachments you want
      * Get the attachments by reading the issue 

https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-version-2-tutorial

      and

https://docs.atlassian.com/jira/REST/server/#api/2/attachment-getAttachment

      *Collate it in your code
      * Create a new issue with the data you've built -

https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-create-issue

My python is too weak (well, non-existent) to convert the curl based calls in there into actual code, but hopefully you can see where I'm going with it!

(Apologies for the attempts at formatting this - I forgot that the bullet points don't work on this Lithium platform, and I've tried to redo it manually)

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

800 views 2 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you