Forums

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

Atlassian Python API - Getting Response from create/update

Normann P. Nielsen (Netic)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 29, 2025

This pretty need API - https://atlassian-python-api.readthedocs.io/jira.html

 

How do I get the response from an operation like:

 

jira.issue_update(jira_key,fields=fields)

jira.issue_create(fields)

 

It seems to just be "null" or NoneType .....

 

I would like to get like a 204 NoContent etc etc ...

 

 

1 answer

0 votes
Pramodh M
Community Champion
June 30, 2025

Hello @Normann P. Nielsen (Netic) 

Reference - https://atlassian-python-api.readthedocs.io/index.html

Install package using pip

pip install atlassian-python-api

Please find the below code examples

from atlassian import Jira

jira = Jira(
url='',
username='',
password=''
)

# Get issue details
key = 'ATP-4'
issue = jira.issue(key)
print(issue) # prints issue details in dict format
print(issue['fields']['summary']) # print just the summary

#Update the summary of the issue
fields = {
'summary': 'Updated Summary from API'
}

jira.update_issue_field(key, fields, notify_users=True)

Thanks & Regards,
Pramodh

Normann P. Nielsen (Netic)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2025

Hi @Pramodh M 

 

But that was not the question - the question is - can You get the actual result of :

jira.update_issue_field(key, fields, notify_users=True)

and print it...

Pramodh M
Community Champion
June 30, 2025

Hi @Normann P. Nielsen (Netic) 

Let me know if you would require help with any other field format?

Thanks

Normann P. Nielsen (Netic)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2025

The only thing I need help to is how to get the server response of jira.issue_update(jira_key,fields=fields) and jira.issue_create(fields)

Pramodh M
Community Champion
June 30, 2025

Hi @Normann P. Nielsen (Netic) 

I tried the below scenario, let me know if this works?

issue_key = "ATP-4"
fields = {
"summary": "Updated summary using direct PUT"
}

# Full absolute URL required by requests
url = f"{jira.url}/rest/api/2/issue/{issue_key}"

response = jira._session.put(url, data=json.dumps({"fields": fields}),
headers={"Content-Type": "application/json"})

print("Status Code:", response.status_code)
print("Response Text:", response.text or "No content (likely 204)")

Thanks and Regards,
Pramodh

Normann P. Nielsen (Netic)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2025

hi @Pramodh M 

 

That is fine I guees - but - You left out most parts of the API - https://atlassian-python-api.readthedocs.io/jira.html ... so is an answers, but not really an answer to my question, as You have to know the url 

{jira.url}/rest/api/2/issue/{issue_key}

and the point with the API is abstracting from that.

But thanks for a possible solution

 

BR,

 

Normann

Pramodh M
Community Champion
July 1, 2025

Hi @Normann P. Nielsen (Netic) 

Well, while that is not possible. You could extend the class as below

from atlassian import Jira
import json

class JiraWithResponse(Jira):
def issue_create_with_response(self, fields):
response = self._session.post("rest/api/2/issue", data=json.dumps({"fields": fields}),
headers={"Content-Type": "application/json"})
return response.status_code, response.json()

def issue_update_with_response(self, issue_key, fields):
url = f"rest/api/2/issue/{issue_key}"
response = self._session.put(url, data=json.dumps({"fields": fields}),
headers={"Content-Type": "application/json"})
return response.status_code

Then, you can have the code as below

jira = JiraWithResponse(
url='https://your-domain.atlassian.net',
username='your-email@example.com',
password='your-api-token'
)

issueKey = ""

# Create issue and get response code
status_code, data = jira.issue_create_with_response(fields)
print(status_code, data)

# Update issue and get response code
status = jira.issue_update_with_response(issueKey, fields)
print(status)

Let me know if this works!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events