Hello,
As a newbie, I'd like to get an idea how to issue a JIRA rest api, as well as how to authenticate to the server? Here is an example api:
# GET http://<Your_JIRA _Server>/rest/api/2/issue/<Issue_Key>
example: GET 'http://dev:8080/rest/api/2/issue/TWP-1116
- I understand you must first authenticate to the server and am looking for a basic example using something like:
username = b'mwise'
plus = b':'
password = b'PAssword'
issueId = 'TWP-1116'
baseURL = 'http://dev:8080'
getIssueId = baseURL + '/rest/api/2/issue/' #
credentials = (username + plus + password).decode("utf-8")
headers = {"Authorization": " Basic " + credentials, "Content-Type": "application/json"}
2. Once authenticated, I'd like an example of issuing the api? Something like?
request = urllib.request.urlopen(getIssueId + issueId, headers=headers)
request.get_method = lambda: 'GET'
response_body = urllib.urlopen(request)
print(response_body.read())
3. There is then a json packet response, which needs to be parsed. How would this example parse to get the 'id' included in the "expand" response ?
{
"expand": "renderedFields,names,schema,transitions,operations,editmeta,changelog",
"id": "15828",
"self": "http://dev:8080/rest/api/2/issue/15828",
"key": "TWP-1108",
"fields": {
"issuetype": {
"self": "http://devcenter:8080/rest/api/2/issuetype/10205",
"id": "10205",
"description": "This Issue Type is used to create Zephyr Test within Jira.",
"iconUrl": "http://dev:8080/download/resources/com.thed.zephyr