node-jira-client icon indicating copy to clipboard operation
node-jira-client copied to clipboard

fix getIssueChangelog() wrong endpoint

Open zombieleet opened this issue 3 years ago • 1 comments

calling the getChangelog() endpoint with an issueNumber causes the below error

null for uri: https://jira.[company-name].com/rest/api/2/issue/ISSUE-KEY/changelog?startAt=0&maxResults=50

This PR fixes the issue by doing the below

  1. add expand property with value of changelog to the query object
  2. remove "/changelog" path as a suffix to pathname (/issue/${issueNumber/)

This issue was also present in the dotnet implementation as well, which was fixed using this approach https://github.com/solidify/jira-azuredevops-migrator/issues/13

zombieleet avatar Feb 11 '22 11:02 zombieleet

They look like two different endpoints:

  • https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-get
  • https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-changelog-get

I am not familiar with Jira API, but I'd prefer to recommend getIssue(..., ..., "changelog") instead of turning getChangelog into an alias of getIssue

pioug avatar Mar 08 '22 15:03 pioug