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,295,669
Community Members
 
Community Events
165
Community Groups

1) how to get all the repositories ? 2) How to check exisiting Repositories ? (REST API 2.0)

Please help me sir/mam..,how to achieve these by RESTAPI2.0
I have some requirement > 
1)i have a text field by entering the repository name,i want to know the repository is valid or not.

2)how to know the repository belongs to which group.

3)how to add user.

1 answer

1 accepted

0 votes
Answer accepted

Hi @Sohit Kumar and welcome to the community!

 

1. You can get all repositories owned by a certain workspace with the following API endpoint:

It is possible to filter the response to get only the names of the repositories with the fields parameter

This is an example API call with curl:

curl -u username:app-password https://api.bitbucket.org/2.0/repositories/<workspace-id>?fields=values.name

 

2. You mentioned

how to know the repository belongs to which group.

I am not sure I understand what you are referring to by 'group'. Repositories are owned by workspaces and they belong to a certain project in that workspace. Are you perhaps referring to the project each repo belongs to?

Or do you mean which user groups have access to the repo?

 

3. It is not possible to add users with API 2 yet, but we have temporary support for certain API 1 endpoints.

If you want to add a user to a user group, you can check the following page, section "Issue an invitation to a group", it includes an example:

If you want to add a user to a certain repository, you can check the following page, section "POST send an invite" (it also includes an example):

 

Kind regards,
Theodora

HI, Kind thanks for your briefly response.

I have more question related to this :-

  1. Is there anyway or any api available to check whether the email is Atlassian registered account or not ?
  2. suppose I want know that repository is existing or not by just passing the repo name ? 
  3. And I have followed your references (repositories) can you give/explain me with a example/sample alias ?

Hi @Sohit Kumar ,

Is there anyway or any api available to check whether the email is Atlassian registered account or not ?

I'm afraid that we don't have such an API endpoint.

If you're an admin of a workspace or repo, you can invite someone using their email address, but we don't have an API endpoint to show if an Atlassian account exists with that email. May I ask why you would need to check that?  

 

suppose I want know that repository is existing or not by just passing the repo name

If you use https://api.bitbucket.org/2.0/repositories/<workspace-id>/<repo-name>

and the repo does not exist, you will get an error message saying so in the response. Please note though that the same error will show if a repository with that name exists in that workspace and you don't have access to it.

 

And I have followed your references (repositories) can you give/explain me with a example/sample alias ?

I'm not sure what example you are looking for, is it for checking whether a repository exists? Or for something else?

Kind regards,
Theodora

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,170 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