Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Create user group using bitbucket api

ArjunKumar Selvamani April 10, 2018

Hi, I am trying to create a user group using bitbucket api.

But failing because of naming exceptions.

Bitbucket Version: 5.5.4.

 

Command Used:

curl -X POST https://bitbucketurl/rest/api/1.0/admin/groups -v -u <username>:<password> -H 'Content-type: application/json' -d '{"name":"Test", "deletable": true}' --insecure

 

Error:

{"errors":[{"context":null,"message":"Please enter a non-empty group name that is 255 characters or less.","exceptionName":"com.atlassian.bitbucket.InvalidNameException"}]}

 

Can someone tell me what is wrong in this

1 answer

1 accepted

0 votes
Answer accepted
Michael Walker
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 10, 2018

Hi ArjunKumar,

The API endpoint is expecting the "?NAME" flag at the end of the URL in your call. If you append this, you can then see the change in behavior. Please see my example below.
 

curl -u <admin_user> -v -d "{"name":"Test2", "deletable": true}" -H "Content-Type: application/json" "https://bitbucket.mycompany.com/rest/api/1.0/admin/groups?name=Test2"

 Best Regards,

Michael

ArjunKumar Selvamani April 10, 2018

Hi Michael,

 

Thanks for the response. When i tried in the way you said it showing the error "XSRF check failed"

 

What to do for this. Can you please help.

ArjunKumar Selvamani April 10, 2018

Sorry Michael, its working fine no issues :)

Thanks for your help

Michael Walker
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 10, 2018

Arjun,

I'm sorry, I forgot to point out the sample base_url in my example. For anyone else encountering this, it should be simply addressed by updating the "https://bitbucket.mycompany.com" at the start of the URL used. Simply adjust this to match your environment, for example: "http://localhost:7990/"

I hope this helps!

Best Regards,

Michael

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events