bitbucket api /users endpoint doesn't seem to work, is this expected?

coleman.jackson May 21, 2023

Hi all.

I am trying to get the uuid of users on bitbucket cloud from passing in a username via the users endpoint in the bitbucket api v2.0 (documented here). However, the endpoint is appearing to error out, both when I try a real user and when I try the tutorial user.

Command I run:

curl https://api.bitbucket.org/2.0/users/tutorials

and the response:
{"type": "error", "error": {"message": "tutorials"}}


It does this with any username I pass in.

is this normal? If not, what do I need to do to fix the command?

1 answer

1 accepted

1 vote
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 23, 2023

Hello @coleman.jackson  and thank you for reaching out to the community!

As part of user privacy improvements, back in 2019 the Bitbucket Cloud API has have Removed usernames from user-referencing APIs . This means that the username is no longer supported in the /users endpoint, and you will need to identify the account with the uuid or account_id (Atlassian account id) : 

/2.0/users/{UUID}

instead of

/2.0/users/username

With that in mind, if you would like to fetch the UUID of the user used to authenticate the API request, the Get current user endpoint  can be used : 

curl -X GET -u USERNAME:APP_PASSWORD https://api.bitbucket.org/2.0/user

The above endpoint only ever returns the authenticated user's own user object, not that of other users.

However, if you would like to get the UUID of the members of a workspace you have access, the List users in a workspace endpoint might be useful : 

https://api.bitbucket.org/2.0/workspaces/<workspace>/members

This should return all the users that are part of the provided workspace, along with their uuid and account_id.

Hope that helps! Let me know if you have any questions.

Thank you, @coleman.jackson !

Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events