-
Hi I am trying to retrieve a field called History from JIRA. It describes the transitions that have been made for a specific issue. At my JIRA, it is displayed at the bottom of the issue where you can select to see Activity and then comments, worklog, etc. I am not sure if the JIRA lib supports it as it supports for example Worklog
Worklog is empty in my case. So, basically, what I would need is an object like issue.fields.history which would allow me to iterate over the transitions made. My user at JIRA is a regular user, we just csv file reports from JIRA and process them, but this field History contains these transitions we need to log . Our JIRA admin told us we can directly access the field through https://jira.atlassian.com/browse/JRASERVER-27692 Example: https://jira.fis.dev/rest/api/2/issue/CMSUPPORT-141111?expand=changelog which actually works for me if use the browser. I actually think it would be difficult to do all the processing by hand, e.g using REST python lib to accomplish that. Mostly because of the authentication mechanism which I am struggling now. If anyone has any idea about this, I would appreciate some help. thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I actually had to directly access the API using python request APIs. this code will return a list of each transition ID TIMESTAMP(string) Previous State Current State `
` session is session.get(url_jira, auth = HTTPBasicAuth(username, password))URL is https://<YOUR_JIRA>/rest/api/2/issue/?expand=changelog`def rest_get_jason_obj( url, session ):
` |
Beta Was this translation helpful? Give feedback.
-
HI Maciej
Thanks a lot for answering! I actually handled the direct REST messages,
but this looks much better. I always prefer to use a library if there is
one.
I left the company I was working on this app, but I will forward it to the
person who is in charge now!
best regards
Daniel
…On Mon, Mar 6, 2023 at 6:06 PM maciejkoszykowski ***@***.***> wrote:
Hello @zlogdanbr <https://github.com/zlogdanbr>
There is a way to do it with jira python:
issue = jira.issue('<jira issue id>',expand='changelog')
changelog = issue.changelog
for history in changelog.histories:
# print("history.created: " + history.created) # remove comment if you want to see that there are other history records
for item in history.items:
if item.field == 'status':
print( "status changed on: " + history.created +
" from status: " + item.fromString + " to status: " + item.toString)
Probably, you don't needed anymore, but maybe someone else is going to
need it like I needed.
This way you avoid an extra work around with REST API calls.
have a nice day, Maciej
—
Reply to this email directly, view it on GitHub
<#1487 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANBG5WR2X5EHDLETSIRQW6LW2ZGTRANCNFSM6AAAAAAQCSLAYE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
“Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.” ( Brian Kernighan)
https://zlogdan.wordpress.com/
|
Beta Was this translation helpful? Give feedback.
I actually had to directly access the API using python request APIs.
this code will return a list of each transition
ID TIMESTAMP(string) Previous State Current State
`
def rest_get_transitions_from_jira(url_issue, session, _debug):