import random
import sys
import os
import jira.client
import json
import logging
import datetime
import base64
import requests
import urllib
import json
from jira.client import JIRA
serverURL='http://ontrack-internal.amd.com'
query='project = SWDEV AND issuetype = Defect AND status in (Implemented, Rejected) AND "Deliverable ID" = "17.50 Sustaining [969960]" AND "Target SW Release" = "17.50 [694916]" AND status in (Implemented,Rejected) ORDER BY updated DESC'
jql='/rest/api/2/search?jql=%s' % urllib.parse.quote(query)
response=requests.get(serverURL+jql,verify=False,auth=("user","pass"))
print (response.json())
Hi Rahul,
If you're using the python-jira library you can use the raw option on results to have it returned in json format. I was able to return search results in formatted json using the code below.
import jira.client
from jira.client import JIRA
import json
jira_options={'server': 'http://ontrack-internal.amd.com'}
jira=JIRA(options=jira_options,basic_auth=('username','password'))
issues_in_project = jira.search_issues('project = SWDEV AND issuetype = Defect AND status in (Implemented, Rejected) AND "Deliverable ID" = "17.50 Sustaining [969960]" AND "Target SW Release" = "17.50 [694916]" AND status in (Implemented,Rejected) ORDER BY updated DESC')
for entry in issues_in_project:
print json.dumps(entry.raw,sort_keys=True, indent=4)
Hope that helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.