You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I am trying to put the following permission using REST APIs
With the following JSON
$ json="[
{
"type": "read-only",
"matcher": {
"id": "refs/heads/master",
"displayId": "master",
"type": {
"id": "master",
"name": "master"
},
"active": true
},
"users": [
"admin"
],
"groups": []
}
]"
With the following Request:
$ curl -D- -u admin:admin -H "Content-Type: application/json" -X POST -d "$json" -X POST http://localhost:7990/rest/branch-permissions/2.0/projects/SAM/repos/branchPermissionTest/restrictions
Getting the following response with an error message
HTTP/1.1 400
X-AREQUESTID: @WUFJSOx924x697x0
X-ASEN: SEN-L12102830
X-AUSERID: 1
X-AUSERNAME: admin
Cache-Control: no-cache, no-transform
Vary: X-AUSERNAME,Accept-Encoding
Transfer-Encoding: chunked
Content-Type: application/json;charset=UTF-8
X-Content-Type-Options: nosniff
Date: Wed, 22 Aug 2018 09:54:30 GMT
Connection: close
{"errors":[{"context":null,"message":"Can not deserialize instance of com.atlassian.stash.internal.repository.ref.restriction.rest.RestRestrictionRequest out of START_ARRAY token\n at [Source: com.atlassian.stash.internal.web.util.web.CountingServletInputStream@ce51d28; line: 1, column: 1]","exceptionName":"org.codehaus.jackson.map.JsonMappingException"}]}
-------------------------------------------------------------------------------------------------
Not sure what is going wrong here.
Need the guidance to form the correct JSON data for the above branch permission and also need suggestions if I am doing anything wrong with the request/parameters/anything else.
Thanks
Adding header
-H "Content-Type: application/vnd.atl.bitbucket.bulk+json"
helped me.
Please, can anyone suggest what should be the JSON to prevent all changes on master/dev/release branches except admin? just like shown below in the screenshot.
awaiting for response.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.