Add a stable ID to the user endpoint when asking for profile (BB-8580)

Issue #7321 resolved
Gabriel Petrovay
created an issue

As BB API consumers, how can we implement a user migration when a user decides to change both his username and hit email address?

Could you add the stable ID of the user to the /user endpoint?

Without it, BB users are not satisfied using out platform with a BB account because, when such a change happens, they have to start from scratch (like new users). Github users benefit of a transparent migration feature because the Github API returns this stable ID in each profile.

Comments (12)

  1. Michael Frauenholtz staff

    Hi Gabi,

    Traditionally we have not exposed repository or user ids. However, this looks to be a valid use case. I've added this issue to our internal tracker to be prioritized. We'll let you know when we've got more to share on this.

    Cheers,
    Michael

  2. Ian Lewis

    We ran into this issue as well. If users change their Bitbucket username there is no way to properly link the user to a user in our system. I'm not sure that using username OR email is a good way to link users either.

    This is pretty necessary for Bitbucket login support.

  3. Thomas Welton

    Yeah, I'd need to to integrated a "login with bitbucket" to my website. No offense but adding a "login with github" was a breeze :P

    I need to know a users ID, or at least be given some value that is unique for all users and wont change.

  4. Erik van Zijst staff

    Sorry for not resolving this issue sooner. However, since the fall of 2014 the (2.0) API now includes immutable uuid fields:

    $ curl -s https://api.bitbucket.org/2.0/users/evzijst | jq .uuid
    "{a288a0ab-e13b-43f0-a689-c4ef0a249875}"
    

    These can be used interchangeably with usernames:

    $ curl -s "https://api.bitbucket.org/2.0/users/\{a288a0ab-e13b-43f0-a689-c4ef0a249875\}" | jq .
    {
      "username": "evzijst",
      "website": "",
      "display_name": "Erik van Zijst",
      "uuid": "{a288a0ab-e13b-43f0-a689-c4ef0a249875}",
      "links": {
        "self": {
          "href": "https://api.bitbucket.org/2.0/users/evzijst"
        },
        "repositories": {
          "href": "https://api.bitbucket.org/2.0/repositories/evzijst"
        },
        "html": {
          "href": "https://bitbucket.org/evzijst"
        },
        "followers": {
          "href": "https://api.bitbucket.org/2.0/users/evzijst/followers"
        },
        "avatar": {
          "href": "https://bitbucket-assetroot.s3.amazonaws.com/c/photos/2015/Apr/17/2785371717-4-evzijst-avatar_avatar.png"
        },
        "following": {
          "href": "https://api.bitbucket.org/2.0/users/evzijst/following"
        }
      },
      "created_on": "2010-07-07T05:16:36+00:00",
      "location": "@erikvanzijst",
      "type": "user"
    }
    

    The same applies for repositories who's uuid fields are interchangeable with username/slug in URLs.

    More documentation: https://confluence.atlassian.com/display/BITBUCKET/Use+the+Bitbucket+REST+APIs#UsetheBitbucketRESTAPIs-uuid-mainUniversallyUniqueIdentifier(UUID)

  5. Log in to comment