Hi,
Am using the jira module in python to get the all project details using for one custom field, the python coding will be like below,
fieldid=cf[XXXXX]
associated_projects = []
JQL="%s is not EMPTY order by updated" % (fieldid)
issues = jira.search_issues(JQL, maxResults=1, fields="issue key")
for issue in issues:
jira_issue = jira.issue(issue.key, fields='project')
project_key = jira_issue.fields.project.key
print ("Project Key", project_key)
associated_projects.append(str(project_key))
associated_projects list have all project name details, from this above code it will take more time to fetch the all project name one by one, whether this same needs to done in one single Rest API call? to get the all project name detail for customfiled.
So that we could save the more time.
Hello @Senthil V
Here's the way to do it in a single REST call
https://community.atlassian.com/t5/Jira-questions/Jira-REST-API-to-get-projects/qaq-p/728218
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tarun Sapra,
Thanks for the information sharing, but i need some restriction is jql query.
JQL="%s is not EMPTY order by updated" % (fieldid)
I want to form this jql query like above to get the project details.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Senthil V
But the JQL query is only going to give you issues and from those issues which can get the project keys.
In your code here
jira_issue = jira.issue(issue.key, fields='project')
project_key = jira_issue.fields.project.key
print ("Project Key", project_key)
You are only getting the project key, which you can also get from the issue key (ABC-123) in this issue key "ABC" is the project. So you can do one REST call based on the JQL and then parse the results of all issueKeys returned and each of the issueKey contains the project key as well thus you are doing everything in just one REST call.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tarun Sapra,
Can you share Rest API for the same thing mentioned above. I don't have knowledge to get the same thing Rest API by step by step. It could be very help full for me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tarun Sapra,
I am trying with below RestAPI, but am not getting all the project or issues name
https://domainname/rest/api/2/search?jql=cf[xxxxx]+is+not+EMPTY+order+by+updated&validateQuery=True&startAt=0&fields=issue+key&maxResults=1000
and also only showing 20 record only
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Senthil V
See some samples here
http://localhost:8080/rest/api/2/search?jql=assignee=charlie
Can you try the REST call in the web browser, is it showing the same number of results as in the issue navigator view for your JQL.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.