Hi,
I need to fetch the changelog for a specific issue from a Jira On-Prem server. Currently, I’m using the following endpoints:
rest/api/latest/issue/ABC-123/?expand=changelog
rest/api/latest/issue/ABC-123/changelog
However, I’m facing two issues:
expand=changelog
, but it doesn’t seem to work. Can anyone guide me on how to paginate this API?Any help would be appreciated!
Thanks!
You can lookup the Jira version with the serverinfo endpoint, then you'll know what version of the REST API documentation you should be reading to learn if the changelog response object for the Get Issue endpoint is subject to pagination.
Also, if you Google 'Jira data center rest api issue changelog' the very first result is the thread that contains the answer as to why you are getting a 404 error when trying to access this endpoint on Jira Data Center:
rest/api/latest/issue/ABC-123/changelog
Have fun on your learning journey!
Thanks, @David Bakkers! I understand why I'm getting the 404 error when accessing rest/api/latest/issue/ABC-123/changelog. But is there a way to apply pagination in rest/api/latest/issue/ABC-123/?expand=changelog
?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But is there a way to apply pagination in
rest/api/latest/issue/ABC-123/?expand=changelog
?
When you read the documentation for that endpoint, does it say it supports pagination?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@David Bakkers , Thanks for your response. The documentation doesn’t mention if pagination is supported for this endpoint, which is why I asked. Based on the response format, I see the startAt and maxResults keys under the changelog metadata, so I thought pagination might be possible.
After calling the server info endpoint, I got the version number "9.12.15". Is there a way to retrieve all changelogs in Jira Data Center using any REST API? If an issue has more than 2,000 change logs, how can I fetch the complete data?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If an issue has more than 2,000 change logs, how can I fetch the complete data?
What happened when you used that endpoint on an Issue with more than 2,000 change logs? Did the endpoint return the complete set of change logs in a single response? If not, what were the values of the startAt, total, and maxResults keys in the response?
When you declared a value for the maxResults parameter in your request, did the number of results returned per page change to that value?
When you declared a value for the startAt parameter in your request, did the results returned 'jump' to that position in the total set?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@David Bakkers, The response was delayed because I encountered this error while posting the message:
"You may have recently posted the same thing elsewhere in the community. Update your text or wait before reposting."
Here are the answers to your questions. Currently, there are 1,034 logs in the ABC-123 issue.
When I call this API:
http://10.12.11:8080/rest/api/latest/issue/ABC-123/?expand=changelog&maxResults=10&startAt=0&fields=key
I receive all 1,034 logs in the response:
{
"expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations",
"id": "10000",
"self": "http://10.12.11:8080/rest/api/latest/issue/10000",
"key": "ABC-123",
"changelog": {
"startAt": 0,
"maxResults": 1034,
"total": 1034,
"histories": [ .... ]
}
}
Even when I change startAt, I still receive all 1,034 logs. I want to understand the maximum limit or why pagination isn't working.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I want to understand the maximum limit or why pagination isn't working.
I can see where you've asked this exact same question across multiple other threads on the same topic, where the answer to your question is already provided, but you seem to not be seeing the proverbial forest for the trees.
I was hoping that if I kept giving you enough hints, you'd work it out for yourself, but that doesn't seem to be happening.... so.....
It's not working because that endpoint doesn't support pagination.
So, you've proven it to yourself with these tests....
THAT ENDPOINT DOESN'T SUPPORT PAGINATION
...which of course means the endpoint will return ALL the change logs for an Issue in the same response UNLESS your Jira Admin has set a maximum response limit for the REST API, and only your Jira Admin can answer that question for you.
This is how Jira Data Center works compared to Jira Cloud. Most of the API endpoints are UNLIMITED because making requests for gigantic amounts of data only degrades the performance of your company's Jira instance, nobody else's.
Let's consider this topic closed now, OK.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, @David Bakkers , for replying. I got the answer, so I'm closing this thread.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.