Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I retrieved json file by python rest api and on the file the comments do not exist? What causes this

Mehmet Sahan October 4, 2022

I created issue and I updated the issue by adding some comments and retrieved the json file from my jira account but the comments do not exist on the file.

2 answers

1 accepted

0 votes
Answer accepted
carlosughini
Community Champion
October 4, 2022

Hi Mehmet,

Hope you have been well.

Could you please share how exactly did you get the JSON file from the REST API?

It would be great if you could share both your code and the endpoint you are using.

Looking forward to hearing from you.

Kind regards,

Carlos

Mehmet Sahan October 5, 2022

Hello Carlos, Here is the information you asked below:

 

import requests
from requests.auth import HTTPBasicAuth
import json
import pandas as pd
from tabulate import tabulate
import sys

auth = HTTPBasicAuth("xxxxxxxxx@gmail.com",
                    "GJGYUGUYGJBUG776RDYTUG")


headers = {
    "Accept": "application/json"
}
query = {
    'jql': 'project =IT'
}

response = requests.request(
    "GET",
    url,
    headers=headers,
    auth=auth,
    params=query
)


print(response.status_code)

projectIssues = json.dumps(json.loads(response.text),
                        sort_keys=True,
                        indent=4,
                        separators=(",", ": "))

file_path = 'jira_report1b.json'
sys.stdout = open(file_path, "w")

print (projectIssues)
0 votes
Trudy Claspill
Community Champion
October 4, 2022

What was the API call that you executed?

Mehmet Sahan October 5, 2022

Hello Trudy, See the respond above. Thank you

Trudy Claspill
Community Champion
October 11, 2022

Based on my experimentation it appears that you have to use the fields parameter to explicitly call out that you want the Comment data included in the output.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events