Below issue occurred on one of the our customer End where jira changelogs having revision id not sorted.
1) Is there any JIRA documentation which tell us that change logs are retrieved on which sorting order like sorted by time or sorted by revision id or any other factor ?
Jira Server Query used
<JIRA_SERVER_URL>/rest/api/2/issue/<ISSUE_ID>?expand=changelog
(2) The reason we are asking this question is on one of the JIRA On-Premise instance we had observed that jira change logs are retrieved sorted on time but those change logs having revision id not sorted
Revision 1 -> created is T1 , Id is R2
Revision 2 -> created is T2 , Id is R1
Here we had observed that Revision 2 having id lower than than revision 1
The documentation for how this REST call works is explained in https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/issue-getIssue
However it sounds like you have an expectation that the id value in the json response for each change will be incrementing. In my own testing I found that the id values did increment once per change. However from reviewing the docs on this, I don't think its a requirement that each id be sequential in the order they were changed, but rather each change id will be unique. If you need to sort these changes based on when they happened, I'd recommend looking at the created parameter within that response to sort these changes.
I included a sample response to show some details of my own testing. Although my changes are appearing sequentially, you can also find each of them has a unique 'created' date/timestamp for them that indicate when they happened:
"changelog": {
"startAt": 0,
"maxResults": 3,
"total": 3,
"histories": [
{
"id": "10511",
"author": {
"self": "http://localhost:8792/rest/api/2/user?username=admin",
"name": "admin",
"key": "admin",
"emailAddress": "admin@localhost",
"avatarUrls": {
"48x48": "https://www.gravatar.com/avatar/46d229b033af06a191ff2267bca9ae56?d=mm&s=48",
"24x24": "https://www.gravatar.com/avatar/46d229b033af06a191ff2267bca9ae56?d=mm&s=24",
"16x16": "https://www.gravatar.com/avatar/46d229b033af06a191ff2267bca9ae56?d=mm&s=16",
"32x32": "https://www.gravatar.com/avatar/46d229b033af06a191ff2267bca9ae56?d=mm&s=32"
},
"displayName": "admin",
"active": true,
"timeZone": "America/Chicago"
},
"created": "2018-06-08T09:44:58.535-0500",
"items": [
{
"field": "labels",
"fieldtype": "jira",
"from": null,
"fromString": "",
"to": null,
"toString": "newlabel"
}
]
},
{
"id": "10512",
"author": {
"self": "http://localhost:8792/rest/api/2/user?username=admin",
"name": "admin",
"key": "admin",
"emailAddress": "admin@localhost",
"avatarUrls": {
"48x48": "https://www.gravatar.com/avatar/46d229b033af06a191ff2267bca9ae56?d=mm&s=48",
"24x24": "https://www.gravatar.com/avatar/46d229b033af06a191ff2267bca9ae56?d=mm&s=24",
"16x16": "https://www.gravatar.com/avatar/46d229b033af06a191ff2267bca9ae56?d=mm&s=16",
"32x32": "https://www.gravatar.com/avatar/46d229b033af06a191ff2267bca9ae56?d=mm&s=32"
},
"displayName": "admin",
"active": true,
"timeZone": "America/Chicago"
},
"created": "2018-06-08T09:46:03.878-0500",
"items": [
{
"field": "priority",
"fieldtype": "jira",
"from": "3",
"fromString": "Medium",
"to": "2",
"toString": "High"
}
]
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.