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.