Last week we launched the Referly API to make it easy for any online business to create a refer-a-friend program.
While we started with a simple REST API and PHP library we knew there were many developers using other languages who would benefit from Referly as well, and we’re grateful for the open source contributions of Max Stoller and Raullen Chai. These two awesome developers made helpers libraries in Ruby and Python to make creating your social referral program even easier in those languages. See the Referly API Documentation and Helper Libraries for more info.
Referly API Ruby Wrapper by Max Stoller
client.links.create(url: 'http://refer.ly') client.links.all
client.rewards.create(visit_id: '12345', amount: 1.00, earned_on: '2012-07-23', payable_on: '2012-07-24') client.rewards.all
Referly API Python Wrapper by Raullen Chai
Thanks also go to Raullen Chai, one of our favorite Canadians, for cranking out the Referly API Python wrapper.
You can grab the code from Raullen’s GitHub account.
from lib import client KEY = r'12345' SECRET = r'abcde' if __name__ == "__main__": myclient = client.ReferlyAPI(KEY, SECRET) #Create Account print myclient.create_account(email@example.com') #List Links print myclient.list_links() #Create Link print myclient.create_link(r'http://refer.ly') #List Rewards print myclient.list_rewards() #Add Reward print myclient.add_reward('xxxxxxxxx', 1.00, '2012-06-01', '2012-08-01')