Bitbucket Documentation

Index

Skip to end of metadata
Go to start of metadata

The bitbucket 'followers' REST resource provides functionality to list the followers of a user, repository or issue.

Overview

In bitbucket, people can follow users, repositories and issues. Since these lists can be quite big, the default UI does not list the followers individually. It just displays the number of followers. You can use the REST APIs to retrieve a list of followers.

Getting the List of Followers of a User

GET /users/USERNAME/followers/

Parameters:

  • USERNAME: The username.

Getting the List of Followers of a Repository

GET /repositories/USERNAME/REPO_SLUG/followers/

Parameters:

  • USERNAME: The owner's username.
  • REPO_SLUG: The slug of the repository.

Getting the List of Followers of an Issue

GET /repositories/USERNAME/REPO_SLUG/issues/ISSUE_ID/followers/

Parameters:

  • USERNAME: The owner's username.
  • REPO_SLUG: The slug of the repository.
  • ISSUE_ID: The ID of the issue.

Getting the List of Repositories you follow

GET /user/follows/

This will return the list of repositories the authenticated user follows.

RELATED TOPICS

Using the bitbucket REST APIs

Labels
  • None
  1. Nov 09, 2011

    Anonymous

    Hey guys,

    How do I get a list of users that a user follows?

    1. Nov 09, 2011

      GET https://api.bitbucket.org/1.0/users/{username}/followers/

      That should get it.

       

      1. Nov 10, 2011

        Hey Anthony,

        Thanks for the reply. That resource link if for list of followers of a user.

        But what about list of users I follow? User1 and User2 follow me but I follow User4.

        1. Nov 10, 2011

          Easy answer: just put your username in that segment of the URL

          If you're looking for like a recursive web of "follower intrigue" lol that might take a lil work.

          1. Nov 10, 2011

            Hey Anthony, I am open to the "lil work", do you have any suggestions.

            I want to be able to recreate this:

            for an app I am creating.

            1. Nov 10, 2011

              What's your language of choice? I know a slew, I might  be able to provide a base.

              1. Nov 10, 2011

                Objective-c

  2. Mar 01, 2012

    Anonymous

    Hello,

    I'm trying to get the list of repositories I'm following with this URL.

    https://api.bitbucket.org/1.0/user/follows/

    And it works in cosole with this command.

    curl --user id:pw https://api.bitbucket.org/1.0/user/follows/

     

    But it doesn't work with following jQuery ajax request.

        $.ajax({
            username:   id,
            password:   pw,
            url:        'https://api.bitbucket.org/1.0/user/follows/',
            dataType:   'json',
            type:       'GET',
            success:    function(data, textStatus, jqXHR) {
                alert('Success ' + jqXHR.status + ' ' + jqXHR.statusText);
            },
            error:      function(jqXHR, textStatus, errorThrown) {
                alert('Fail ' + jqXHR.status + ' ' + jqXHR.statusText);
            }
        });

     

    All I got is '401 Unauthorized'. I'm doing it in an PhoneGap instance, and whitelist is set to api.bitbucket.org. How can I make the jQuery ajax work with BitBucket API?

    1. Mar 01, 2012

      From jQuery.ajax documentation

      If the server performs HTTP authentication before providing a response, the user name and password pair can be sent via the username and password options. [...]

       

      Seems like this server is not doing that, instead try this to use an authentication header:

      http://coderseye.com/2007/how-to-do-http-basic-auth-in-ajax.html

       

      1. Mar 01, 2012

        Anonymous

        It works! Thank you!

        It's surprising that jQuery sends request even if it's going to different domain, with authentication information ignored that's specified in ajax() request.

    2. Mar 01, 2012

      The reason it isn't working is because of the Same Origin Policy

      Even if you could get the authentication to pass in to the server before the request (which I'm finding quite difficult to do right now), you would still get a rejection from the policy above. 

      Add a 

      snippet

      to the end of the URL (yes, there is a second question mark that the server parses). It will force the server to digest the request as a JSONP request which isn't encumbered by the policy. Happy hunting, Hope I've helped. 

      1. Mar 01, 2012

        Anonymous

        It's a little strange that it comes to the error() function with 200 okay status. I think it's authentication is working, but some kind of callbacks should be added. So I'm going with the Grace Batumbya's Authentication header approach. Thanks anyway!