How to get issues from Jira projects using expand=changelog?

Nicolau Rodrigues
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 8, 2020

Hello experts, 

I am ingesting issues data using Jira Rest API, that is being requested from a python code.

I am using the search API to bring the data I need:

https://mycompanyjira.atlassian.net/rest/api/2/search

 When I assembly my 'get' request without the "expand=changelog", everything works OK. This is the jql I used to connect (with no changelog):

querystring = {"jql": "project=" + project_name, "startAt": startPoint}

 However, trying to get the changelog, I get the following error back from the API:

 "errorMessages": ["Field 'expand' does not exist or you do not have permission to view it."]

The jql I used to connect using the change log is the following: 

querystring = {"jql": "project=" + project_name + "&expand=changelog", "startAt": startPoint}

I am using HTTP GET method to request:

response = requests.get(url=url, headers=headers, params=querystring)

And the final URL, before requesting, looks like this:

https://mycompanyjira.atlassian.net/rest/api/2/search?jql=project%3PROJECTKEY%26expand%3Dchangelog&startAt=0

Do you think it can be a permission issue? I mean, does Jira require specific authorization to bring changelog? Or am I making any mistake assembling the request?

Thanks in advance,

Nicolau 

 

3 answers

1 vote
Mehmet A _Bloompeak_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
September 9, 2020

Hi @Nicolau Rodrigues ,

In your final url, expand is part of jql. Instead it must be a request query parameter as below.

https://mycompanyjira.atlassian.net/rest/api/2/search?jql=project%3PROJECTKEY&startAt=0&expand=changelog

0 votes
Andrii Polishchuk
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 3, 2021

On NodeJs you can just add array with expand

0 votes
Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 9, 2020

Hi @Nicolau Rodrigues 

I did not tested it but as the error says "expand" not supported in the "jql search" API endpoint.

I do know that "expand" work with "issue" API endpoint.

That means, get list of your issues with 

https://mycompanyjira.atlassian.net/rest/api/2/search

Than iterate the list of issues and for each issue run:

/rest/api/2/issue/{issueIdOrKey}?expand=changelog

and that will return you for each issue, all its data with the changelog as you wanted

Suggest an answer

Log in or Sign up to answer