Fitocracy API

About

This is a 3rd party API providing data for fitocracy.com.

Data provided via the API include variables such as, user progress, groups, profile imagery, follow counts etc.

This was developed to be used as a basic read-only API for profile data until Fitocracy provide an API, which I'm sure they will.

For any queries about how to use this, or any other comments/suggestions/feedback please contact me at jo@easyjo.com. or follow me @easyjo

Usage

The main URL for getting data for a user is: http://fitocracy-api.heroku.com/data/easyjo

http://fitocracy-api.heroku.com/data/USERNAME OR USERID

This provides a json feed in the following format:

	{
	   "level":"25",
	   "followers":"25",
	   "following":"27",
	   "progress":{
	      "progress_text":"7520/8500 pts",
	      "current":"7520",
	      "next":"8500"
	   },
	   "about":"training for an ironman in Sept, Currently sucking at swimming, enjoying biking, bored of running. but... progressing \\o/",
	   "user":{
	      "image":"http://fitocracy.com/site_media/user_images/279361_816031146812_193102950_43140027_2794721_o.jpg",
	      "url":"http://www.fitocracy.com/profile/easyjo/",
	      "name":"easyjo"
	   },
	   "groups":[
	      {
	         "name":"Goons",
	         "url":"http://www.fitocracy.com/group/125/"
	      },
	      {
	         "name":"Fit geeks",
	         "url":"http://www.fitocracy.com/group/227/"
	      },
	      {
	         "name":"Triathletes",
	         "url":"http://www.fitocracy.com/group/172/"
	      }
	   ]
	}

JSONP version for loading data remotely, via JS

http://fitocracy-api.heroku.com/data/jsonp/USERNAME OR USERID/?callback=X

Example 1

An example of this with jQuery:

$(function() {
         $.getJSON('http://fitocracy-api.heroku.com/data/jsonp/easyjo/?callback=?', {},  function (data) {          
                $('#example1').html("<h4>About me</h3>" + data.about + "<h4>My current progress: " + data.progress.progress_text + "</h4>");
           })  
});
Preview of the above
Loading...

Example 2

Another example, using a few more fields

$.getJSON('http://fitocracy-api.heroku.com/data/jsonp/easyjo/?callback=?', {},  function (data) {   
			var groups = "";
			$.each(data.groups, function(index, value) {                        
           		groups  = groups + "<a href='" + value.url + "'>" + value.name + "</a> ";
            });
            $('#example2').html("<h4>About " + data.user.name + "</h4><img class='img_left' src='" + data.user.image + "' /><h4>Progress: " + data.progress.progress_text + "</h4><p>" + data.about + "</p> Groups: " + groups);
           });
Preview of the above
Loading...

Group data

The main URL for getting data for a group is: http://fitocracy-api.heroku.com/group/125

http://fitocracy-api.heroku.com/group/GROUP ID

This provides a json feed in the following format:

{"average_level"=>"8.95", "created"=>"May 8, 2011", "category"=>"Competitive, Social", "visibility"=>"Public", "members"=>"1836", "about"=>"MEMBERS OF SOMETHING AWFUL DOT COM", "group"=>{"image"=>"http://s3.amazonaws.com:80/static.fitocracy.com/site_media/user_images%2Fhatofpig_1.jpg", "url"=>"http://www.fitocracy.com/group/125", "name"=>"Goons"}}

JSONP version for loading data remotely, via JS

http://fitocracy-api.heroku.com/group/jsonp/125/?callback=X