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.






12 Comments
Hide/Show CommentsNov 09, 2011
Anonymous
Hey guys,
How do I get a list of users that a user follows?
Nov 09, 2011
Anthony Steiner
GET https://api.bitbucket.org/1.0/users/{username}/followers/
That should get it.
Nov 10, 2011
Grace Batumbya
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.
Nov 10, 2011
Anthony Steiner
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.
Nov 10, 2011
Grace Batumbya
Hey Anthony, I am open to the "lil work", do you have any suggestions.
I want to be able to recreate this:
Nov 10, 2011
Anthony Steiner
What's your language of choice? I know a slew, I might be able to provide a base.
Nov 10, 2011
Grace Batumbya
Objective-c
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?
Mar 01, 2012
Grace Batumbya
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
usernameandpasswordoptions. [...]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
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.
Mar 01, 2012
Anthony Steiner
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
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.
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!
Add Comment