Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,300,182
Community Members
 
Community Events
165
Community Groups

Bitbucket Server API, Removing user from Group

Good Day All, I am attempting to remove a user from a group on my Bitbucket Server(v7.1.1) using the RestAPI via curl. I'm following the doc here(https://docs.atlassian.com/bitbucket-server/rest/7.6.0/bitbucket-rest.html#idp36)

Here is the curl syntax I am using

curl -D- -u user:* -X GET -H "Content-Type: application/json" "https://*.*.com:8443/rest/api/1.0/admin/users/remove-group?&context=johnsmith&itemName=group1"

Here is my response error

HTTP/1.1 405
Cache-Control: private
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-AREQUESTID: @KLMZ8Ux485x1589179x0
X-ASEN: SEN-11523232
X-AUSERID: 1
X-AUSERNAME: user
Allow: POST,OPTIONS
X-Content-Type-Options: nosniff
vary: accept-encoding
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 26 Oct 2021 13:05:13 GMT

What can I do to fix my request? Maybe I am missing something in my syntax, I'm having trouble debugging this, I appreciate any advice here! Thank you.

1 answer

1 accepted

1 vote
Answer accepted

Hey @Matt Kimball , Looking at the docs I think you need to use POST request, not a GET. Additionally, you need to covert the URL params to a JSON type payload.

You can click the "expand" button next to "Example request representations" to find the example JSON payload.

Don't forget to configure required headers to send a JSON request e.g. for cURL that will be "-H "Content-Type: application/json"

 

Thanks,
Maciej Adamczak
Atlassian Developer

Thank you @Maciej Adamczak ! I made the changes you suggested and I am getting much better results now. Here is the syntax I am using

curl -D- -u "user:*" -X POST -H "Content-Type: application/json" -d "{\"context\": \"johnsmith\",\"itemName\": \"group1\"}" "https://*.*.com:8443/rest/api/1.0/admin/users/remove-group" 
Like Maciej Adamczak likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,257 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you