Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Via this REST API it is possible to view, add, delete email aliases of Bitbucket Server users. Regular users can perform these operations with their own aliases while Bitbucket global

Talk
idtalk-687
system administrators can manage aliases of other users as well.

...

Code Block
curl -u username:password http://aquila:7990bitbucket-host/bitbucket/rest/awesome-graphs/latest/emails

...

Code Block
curl -u username:password -G -d user=john http://aquila:7990bitbucket-host/bitbucket/rest/awesome-graphs/latest/emails

...

Code Block
{
  "start": 0,
  "limit": 25,
  "size": 2,
  "isLastPage": true,
  "values": [
    {"email": "john.smith@gmail.com", "automatically": false},  
    {"email": "John.Smith@gmail.com", "automatically": true}
  ]
}

An alias has 2 fields

Talk
idtalk-689

  • email - user email address
  • automatically

...

  • :
    • 'false' means that an alias is added manually by a user or via REST API; 
    • 'true' means that an alias was automatically linked by Awesome Graphs, which happens when a new email alias is being added and the add-on detects that such an email already exists in the database, but differs in case (e.g., John.Johnson@stiltsoft.com and john.johnson@stiltsoft.com), and adds this detected email as an automatically linked alias.

Adding aliases

Here is the curl command for a user to add a new alias for him/herself:

Talk
idtalk-690

Code Block
curl -u username:password -X PUT -G -d email=jsmith@example.com http://aquila:7990bitbucket-host/bitbucket/rest/awesome-graphs/latest/emails

...

Code Block
curl -u username:password -X PUT -G -d user=john -d email=jsmith@example.com http://aquila:7990bitbucket-host/bitbucket/rest/awesome-graphs/latest/emails

When you attempt to add an email address that is already used (by another Bitbucket user or already linked as an alias), you will see the response with displayName

Talk
idtalk-691
display name and the link to the user profile of the current owner of this alias:

Code Block
{"name": "User", "link": "http://aquila:7990bitbucket-host/bitbucket/users/user"}

Deleting aliases

...

Code Block
curl -u username:password -X DELETE -G -d email=jsmith@example.com http://aquila:7990bitbucket-host/bitbucket/rest/awesome-graphs/latest/emails

...

Code Block
curl -u username:password -X DELETE -G -d user=john -d email=jsmith@example.com http://aquila:7990bitbucket-host/bitbucket/rest/awesome-graphs/latest/emails

...