Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bitbucket API adding branch restriction - malformed groups

Trying to add branch restriction to a repository, I was successful in adding a rule, however, I cannot get a group added to the rule.

curl -XPOST --user user:password -H "Content-Type: application/json" -d '{"kind": "push", "pattern": "testing*", "groups": {"name": "testleads"}}' $URL/api/2.0/repositories/team/repo/branch-restrictions

Result:

{"error": {"message": "malformed groups"}}

I have tried different combinations in the groups using full_slug, slug and also changing the inheritance types.

-d '{"kind": "push", "pattern": "testing*", "groups":["name": "devleads"]}'
-d '{"kind": "push", "pattern": "testing*", "groups": {"name": "devleads"}}'

Has anyone tried this?

like image 492
Mir S Mehdi Avatar asked Aug 16 '16 02:08

Mir S Mehdi


1 Answers

After a lot of tries, I narrowed it down to this JSON input to be able to add branch restrictions

-d '{"kind": "push", "pattern": "test*", "value": null, "groups": [{"name": "devLeads", "account_privilege": null, "full_slug": "team-name:devleads", "owner": {"username": "team-name", "display_name": "Team Name ", "type": "team"}, "type": "group", "slug": "devleads"}]}'
like image 85
Mir S Mehdi Avatar answered Sep 22 '22 17:09

Mir S Mehdi