I'm trying to consume an API for branch restrictions here but I get this error

Jose Fernando Martinez
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!
December 13, 2023

Hello I am sending this thing for that API, image.png

I have all headers good and all kind of authentications good but I get this error

 

{"type": "error", "error": {"message": "Something went wrong", "id": "9557509a980f4b00b77eb1623d7b1e5b"}}

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 15, 2023

Hi Jose Fernando and welcome to the community!

I see that the property "branch_match_kind" is missing from your call's data. This is necessary for the API call, and depending on its value you should use either "pattern" or "branch_type" but not both. Please allow me to explain:

If you want to create the branch restriction for the branch named development, your data should look like this:

{
"branch_match_kind": "glob",
"pattern": "development",
"kind": "require_approvals_to_merge",
"value": 2
}

If you want to create the branch restriction based on the repo's branching model and use the branch you set as Development branch from Repository settings > Branching model, then your data should look like this:

{
"branch_match_kind": "branching_model",
"branch_type": "development",
"kind": "require_approvals_to_merge",
"value": 2
}

This second example will create a restriction for the branch defined as Development branch from from Repository settings > Branching model, and if you change the Development branch from this page, then the branch restriction will be updated accordingly.

Please feel free to let me know if you have any questions!

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events