Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Querying Jira with Python and Rest

Tags:

python

rest

jira

I want to pull a list of users in the jira-users group. as i understand it, it can be done with Python using restkit.

Does anyone have any examples or links that give an example of this?

thanks.

like image 735
Huskeraider Avatar asked Jan 15 '23 18:01

Huskeraider


2 Answers

If somebody still need a solution, you can install JIRA rest api lib https://pypi.python.org/pypi/jira/. Just a simple example for your question:

from jira.client import JIRA

jira_server = "http://yourjiraserver.com"
jira_user = "login"
jira_password = "pass"

jira_server = {'server': jira_server}
jira = JIRA(options=jira_server, basic_auth=(jira_user, jira_password))

group = jira.group_members("jira-users")
for users in group:
    print users
like image 82
Lexx Tesla Avatar answered Jan 18 '23 07:01

Lexx Tesla


Jira has a REST API for external queries, it's using HTTP protocol for request and responses and the response content is formed as JSON. So you can use python's urllib and json packages to run request and then parse results.

This is Atlassian's document for Jira REST API: http://docs.atlassian.com/jira/REST/latest/ and for example check the users API: http://docs.atlassian.com/jira/REST/latest/#id120322

Consider that you should do authentication before send your request, you can find necessary information in the document.

like image 27
MostafaR Avatar answered Jan 18 '23 09:01

MostafaR