|
The statements and opinions on this page are solely those of its authors and do not necessarily represent the official position of CouchSurfing International.
This page is a Request for Enhancement. It is a draft. You are encouraged to find support for it, etc. An API (Application Programming Interface) consists of a set of callable methods. On the Web this means tipically you can access information and methods directly calling a certain URL. A very good API from which we could take inspiration is the Flickr API. The Flickr API provides a bunch of very useful methods (such as flickr.activity.userComments, flickr.activity.userPhotos, flickr.contacts.getPublicList, flickr.groups.browse, flickr.people.findByUsername, flickr.people.getPublicGroups, flickr.photos.geo.getLocation, flickr.photosets.comments.getList, see complete list) and we could provide similar methods.
Why do we need an API for CS ?An API exposes some callable methods. With these methods, independent services can request to obtain informations and do something with it. In general, API expose information for consumption (ex: fetch your photos and display them wherever and however you want), but sometimes can also gives methods to directly change stored information (ex: change my mission text) but this is much more rare and in general this is not useful, nor used. CS is a no-profit association so it does not profit from excluding other services from information, like for instance ebay does (see eBay files suit against auction site Bidder's Edge which was copying all ebay profiles and setting up a similar services bootstrapping its network with ebay users). Anyway there are evident copyright issues here as well. For instance the photo a CS member has uploaded is not intended for external use, surely it is not possible for a company to print it and sell it or run a commercial with it. Same for text users insert on CS web site. So, unless a new content licence (like creative commons) is adopted, all content on CS should be considered as "all rights reserved". This probably sucks but it is the default copyright of everything you find on the Web.
IssuesServer loads. It is of fundamental importance to limit the number of calls a user can make per minute (or at least monitor them at the beginning). With an API it is extremely easy to, for istance, write a program that every second asks the list of all my friends. Such a program will be able to put the serve on its knees. All API providers (Flickr, Google Maps, ...) provide a limit to the amount of calls you can make per minute (or day). All of them asks you to get a unique key to make your calls so that it is possible to know which users is making the calls and monitor the number of calls. APIInformal needsWhat information can we provide? What needs does an external developer have? Individual purposes (for a given user)
Searching purposesIt will be very powerful to provide a way for external websites to implement a search of CS users. Others purposes
API SpecificationThe best way to provide an API is through REST. In a nutshell it means that methods are called directly with HTTP calls of URLs. Examples can be found on Flickr API. For example calling this URL http://api.flickr.com/services/rest/?method=flickr.contacts.getPublicList&api_key=cd227ee972c49005a7a539fee08d6ccd&user_id=12037949754%40N01 you get this XML
<rsp stat="ok">
<contacts page="1" pages="1" per_page="1000" perpage="1000" total="278">
<contact nsid="36521960554@N01" username="/nico" iconserver="1" iconfarm="1" ignored="0"/>
<contact nsid="59501100@N00" username="27" iconserver="1" iconfarm="1" ignored="0"/>
....
which is a list of contacts of user beej whose user_id is 12037949754%40N01) expressed in XML. REST make API methods easy to call. They usually return plain XML so that the result is easy to parse and integrate in your own application or site. You can experience with more Flickr API calls at http://www.flickr.com/services/api/explore/ Examples for inspirationFaceBook API http://developers.facebook.com/ The Facebook Platform allows you to add social context to your app utilizing the following data from Facebook: Profiles Friends Photos Events For instance someone coded a Ridesurf application usable with Facebook logins since it leverages the facebook API, called Zimride http://www.mashable.com/2007/04/15/zimride/ Example of some Mashup or integration that can be created with a good APIIt can be external websites, affiliated or not with CS, or new features for CS website (in this case, there is no need of the API, hack the DB directly) :
|
| FAQ | Media | Terms of Use | Privacy | Contact Us |
© 1999-2010 CouchSurfing International Inc. - a Non-Profit Organization | Show in English 'CouchSurfing' and 'CouchSurfer' are registered and unregistered service marks of CouchSurfing International.- CS Release: Kahramanmaraş - r9655 - 2010-02-03 18:37:35 UTC |