Is there a possibility to analyze the Jira issue using REST API?

kumar August 8, 2024

Hi all,

 

I need to know the possibilities of analysis of Jira issues/complete Jira project?

What I need to do is:

- Access the existing Jira project A

- Then get the issues one by one within the Project A

- For each issue, analyze some fields such as attachment, comments

- If the specific type of attachment(basically based on extension based check) exists, then do further analysis, else reject the issue

 

Now from my reading and research, I have found that there are different ways to do it.

I am considering REST API.

 

Now my question is:

- Can my above steps achievable using REST API?

 

Thanks in advance

1 answer

1 accepted

3 votes
Answer accepted
Peter Van de Voorde
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 8, 2024

Hi @kumar

Welcome to the Atlassian Community.

Short answer: Yes that should be possible using the Jira REST API.

You can use this call to get the project: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-projects/#api-rest-api-2-project-projectidorkey-get

This call to get the issues and their attachment links: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-issueidorkey-get

I hope this helps.

Cheers,
Peter

kumar August 8, 2024

Hi @Peter Van de Voorde 

I have a small Python script for REST API here.

 

# This code sample uses the 'requests' library:

# http://docs.python-requests.org

import requests

from requests.auth import HTTPBasicAuth

import json

print("url")

url = "https://domain-name.atlassian.net/rest/api/2/project/search"

print(" url is done")

auth = HTTPBasicAuth("gmail_id@gmail.com", "API-TOKEN")

print("authenticated")

headers = {

  "Accept": "application/json"

}

print("headers  ")

response = requests.request(

   "GET",

   url,

   headers=headers,

   auth=auth

)

print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
Now I need to access the project. let's say project name "JiraRESTAPICheck".
Then Access all the issues in the project "JiraRESTAPICheck", after accessing each issue,
- check for attachment with specific extensions(let's say, .md extension) and if the specific extension file present in the issue, do not do anything, if the file is not present, reject the issue.
Can you help me with above things please?
Thanks in advance
Peter Van de Voorde
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 8, 2024

Hi @kumar ,

This is just a basic example script from the documentation.
I would highly recommend that you try to do this on your own first before asking someone else to do the work for you.

If you really don't know how to do this I would recommend higher a developer to do this for you and to pay them, don't expect to get your work done for you for free.

Cheers,
Peter

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events