Get default reviewers API in Bitbucket Datacenter fails with NoSuchBranchException

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

要約

The API to get default reviewers in Bitbucket Datacenter fails with NoSuchBranchException. 



環境

The solution has been validated in Bitbucket Datacenter 8.9.5 but may be applicable to other Bitbucket 8.x versions


診断

The below API returns NoSuchBranchException, though the branch exists in the Bitbucket repository.

curl -u <ADMIN_USERNAME> --request GET --url 'http://{baseurl}/rest/default-reviewers/latest/projects/{projectKey}/repos/{repositorySlug}/reviewers?sourceRepoId=${sourceRepoId}&targetRepoId=${targetRepoId}&sourceRefId=${sourceRefId}&targetRefId=${targetRefId}' --header 'Accept: application/json'

Parameters: 
sourceRepoId = The ID of the repository in which the source ref exists
targetRepoId = The ID of the repository in which the target ref exists
sourceRefId = The ID of the source ref
targetRefId = The ID of the target ref

For example, 
curl -u <ADMIN_USERNAME> --request GET --url 'http://{baseurl}/rest/default-reviewers/latest/projects/PRJ/repos/repo1/reviewers?sourceRepoId=${sourceRepoId}&targetRepoId=${targetRepoId}&sourceRefId=${source-commit-hash}&targetRefId=${target-commit-hash}' --header 'Accept: application/json'



原因

Prior to Bitbucket 8.0, it was possible to pass a commit hash to sourceRefId and targetRefID parameters in the API to review the results. Starting with Bitbucket 8.x, a commit hash is not considered as a valid RefID. A valid RefID would be a branch or a tag name.



ソリューション

A valid RefID such as a branch name or tag name is to be passed to sourceRefID and targetRefID parameter values to run the API successfully and retrieve default reviewers.

curl -u <ADMIN_USERNAME> --request GET --url 'http://{baseurl}/rest/default-reviewers/latest/projects/PRJ/repos/repo1/reviewers?sourceRepoId=${sourceRepoId}&targetRepoId=${targetRepoId}&sourceRefId=${source-branchname}&targetRefId=${target-branchname}' --header 'Accept: application/json'




最終更新日 2024 年 6 月 3 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.