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,365,108
Community Members
 
Community Events
168
Community Groups

Are there any Bitbucket REST APIs to invite, remove, list users for a repository.

I am working on a project to automate the following tasks using Bitbucket REST APIs:

  1. Invite a user to a repository.
  2. Remove users from repositories.
  3. To fetch the list of users having access to repositories via API.
  4. To check for any usage/activity of individual users against the repository ( To take decisions for removing access ) via API.
  5. To view the subscription-related information ( Plan name, Monthly / Annual, Renewal date, Billing card details, Billing emails ) via API.
  6. To view the billing history of items by month/range along with pdfs via API.

These endpoints are not yet available with Bitbucket REST APIs v2. Please suggest possible ways to automate/integrate the above points using Bitbucket REST APIs.

Thank you!

1 answer

0 votes

Hi @Sumit Kumar and welcome to the community.

 

1. Invite a user to a repository.

We still support certain endpoints of version 1.0 of our API for invitations, until we provide these for API 2.0

Users can be invited/added directly to a repository, or they can be invited/added to a user group that has access to the repository.

Inviting a user to a specific repo: https://support.atlassian.com/bitbucket-cloud/docs/invitations-endpoint/

Inviting a user to a user group: https://support.atlassian.com/bitbucket-cloud/docs/invitations-resource/ (section "Issue an invitation to a group")

 

2. Remove users from repositories.

If the user has direct/explicit repo access only, this can be removed with the following endpoint:

https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-permissions-config-users-selected-user-id-delete

If the user belongs to a user group with access to the repository, you can remove the user from that user group with API 1.0, see below section "DELETE a member"

https://support.atlassian.com/bitbucket-cloud/docs/groups-endpoint/

 

3. To fetch the list of users having access to repositories via API.

You can get this info with the following endpoint:

https://developer.atlassian.com/cloud/bitbucket/rest/api-group-workspaces/#api-workspaces-workspace-permissions-repositories-repo-slug-get

As noted on that page:

Permissions returned are effective permissions: the highest level of permission the user has. This does not distinguish between direct and indirect (group) privileges.


4. To check for any usage/activity of individual users against the repository ( To take decisions for removing access ) via API.

What do you count as usage/activity? Is it accessing the repo from Bitbucket website? Cloning, pulling, or pushing commits? Or all of these?

I'm afraid that none of this info is available in our API and it is also not available on our website either.

We have a feature request to add clone and push events to the Audit Log available to workspace admins:

https://jira.atlassian.com/browse/BCLOUD-8322

And another feature request to make Audit Logs available via API, that our team is currently working on: https://jira.atlassian.com/browse/BCLOUD-13176

You can vote and comment on both to give them more weight and further express your interest, and you can add yourself as a watcher (by selecting the "Start watching this issue" link) if you'd like to get notified via email on updates.

 

5. To view the subscription-related information ( Plan name, Monthly / Annual, Renewal date, Billing card details, Billing emails ) via API.

This info is not available via API. We have a feature request to get content from this page via API: https://jira.atlassian.com/browse/BCLOUD-22127 You can leave a comment there mentioning the details you'd like to retrieve.

Please keep in mind that billing emails are not available on Bitbucket. These are only available at https://my.atlassian.com/ for the Technical and Billing contacts for the license.

 

6. To view the billing history of items by month/range along with pdfs via API.

This info is not available on Bitbucket website and it is not available via API either. Invoices can be obtained by billing and technical contacts at https://my.atlassian.com/billing/paidorders

 

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events