Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Sohit Kumar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 23, 2021

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
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 25, 2021

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

Sohit Kumar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 26, 2021

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 ?
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 1, 2021

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
AUG Leaders

Atlassian Community Events