From StatusNet
(Redirected from TwitterCompatibleAPI)Jump to: navigation, search
Contents
[hide][edit] Twitter-compatible API
The goal of the Twitter-ish API is to make it extremely easy for developers with tools that already talk to Twitter to communicate with StatusNet sites as well. The most used methods will be implemented first.
The official Twitter API wiki is a good place to start for information about this API. We intend to provide full documentation on this site, but for now will have the exceptions. The following will be mostly useful for devs experienced with the Twitter API and getting ready to build in Identi.ca compatibility.
[edit] API root
The API root for identi.ca is at http://identi.ca/api. However, there is no resource at the API root. (Twitter's root, http://api.twitter.com/, just shows the home page for Twitter.)
To make API calls you tack on the method name. Examples:
1 1 http://identi.ca/api/statuses/public_timeline.xml 2 2 http://identi.ca/api/statuses/show/123.xml 3 3 http://identi.ca/api/friendships/exists.json?user_a=bob&user_b=dougFor other StatusNet installs, the API root will be determined by whatever you set your $config['site']['path'] and $config['site']['server'] variables to in config.php. Generally, the pattern is:
1 1 http://$config['site']['server']/$config['site']['path']/api
So if your site server name is www.gar.org and the path to your StatusNet install is statusnet, your API root will be:
1 1 http://www.gar.org/statusnet/api
[edit] Authentication
As with Twitter, the API uses HTTP Basic Authentication. Note that this means that users with only an OpenID login cannot use the API; they have to add a password to their account using the control panel on the site.
There's no support for other, undocumented authentication methods.
Note: As of Tuesday, Feb 10, 2009, Identi.ca officially supports SSL for all API methods, and it's especially recommended for use with API methods requiring authentication (e.g.: https://identi.ca/api/account/verify_credentials.xml).
[edit] JSONP callbacks
For API methods that return JSON, an optional JSONP-style callback parameter is supported. If supplied, the response will be in JSONP format with a callback of the given name. (Note: this is actually an undocumented feature of Twitter's API.)
1 1 http://identi.ca/api/statuses/public_timeline.json?callback=foo
[edit] Rate limiting
We currently don't enforce any rate-limiting. Please don't make us regret it.
[edit] Gotchas
Some things to remember:
- StatusNet supports OpenMicroBlogging and some notices and friends may come from other servers.
- On StatusNet sites, user nicknames are unique, but they are not globally unique. Use the ID number instead.
- Private streams are not implemented in StatusNet yet.
- StatusNet sites can be configured as private. In that case, all API methods require authentication, including the public timeline (see the 'config' method below).
- If your apache does not have "Fancy URLs" enabled, the example url's from above need to change. (e.g. http://www.gar.org/statusnet/api
1 1 --> http://www.gar.org/statusnet/index.php/api )
[edit] Status methods
Public timeline As documented. Friends timeline Fully compatible with enhancements. User timeline As documented. Show As documented. Update As documented, including support for 'in_reply_to_status_id' parameter. Additional 'media' parameter allows binary multimedia uploads (images, etc.). Format post data as multipart/form-data when using the 'media' parameter. Replies Fully compatible with enhancements. Destroy As documented. Note: As of StatusNet 0.6.1, status methods support the 'since_id' parameter, which returns statuses with an ID greater than (more recent than) the specified ID. Additionally, they support a 'before_id' parameter, which returns all the notices before a given ID. 'before_id' is an extension to Twitter's API. Update 06/01/09 - As of 0.7.4 'before_id' has been changed to 'max_id', because Twitter has implemented this feature as max_id.
The original Twitter API allows Friends timeline and Replies only for the currently authenticated user. StatusNet supports these methods for arbitrary users. The paths are api/statuses/friends_timeline/[username].rss and api/statuses/replies/[username].rss.
[edit] User methods
Friends As documented, except: does not support 'lite' parameter. Also, ordered by subscription and not signup date. Followers As documented, except: does not support 'lite' parameter. Also, ordered by subscription and not signup date. Featured Not implemented. Robert Scoble gets too much attention as it is. Show As documented. However, if the user cannot be found, a 404 error will be returned, unlike Twitter, which returns a random(?) user in that event. Also, you can bring up a user by email address alone. A user id is not required if an email address is supplied. [edit] Direct message methods
Supported as of StatusNet 0.6.1.
direct_messages As documented. sent As documented. new As documented. destroy Not implemented. [edit] Friendship methods
create As documented. Note that users cannot subscribe to remote profiles using this API. destroy As documented. Users can unsubscribe to a remote profile using this API, but it's preferred to use numeric IDs to nicknames. exists As documented. [edit] Social Graph methods
Supported as of StatusNet 0.7.2.
ids (friends) As documented. ids (followers) As documented. [edit] Account methods
verify_credentials As documented. Note: as of StatusNet 0.6.4, this method returns a full user profile upon successful authentication (Twitter started doing this on Dec 10th, 2008). end_session Not implemented. update_location As documented. update_delivery_device Not implemented. rate_limit_status We have no rate limit, so this always returns 150 hits left. update_profile_background_image As documented. update_profile_image As documented. [edit] Favorite methods
Supported as of StatusNet 0.6.1.
favorites As documented. create As documented. destroy Not implemented. [edit] Notification methods
follow Not implemented. leave Not implemented. [edit] Block methods
Supported as of StatusNet 0.6.4.
create As documented. destroy As documented. [edit] Help methods
test As documented. downtime_schedule Not implemented. [edit] Search
StatusNet has a Twitter-compatible notice search as of StatusNet 0.7.1, and search results can be returned in both Atom and JSON formats.
[edit] Atom
To request search results in Atom, append your URL-encoded query as a parameter to the search method and specify the Atom format:
1 1 http://identi.ca/api/search.atom?q=
[edit] JSON
To request search results in JSON, append your URL-encoded query as a parameter to the search method and specify the JSON format:
1 1 http://identi.ca/api/search.json?q=
The search method also supports the following optional URL parameters:
- callback: if supplied when using the JSON format, the response will use the JSONP format with a callback of the given name.
- E.g.:
- rpp: the number of notices to return per page, up to a max of 100.
- E.g.:
- page: the page number (starting at 1) to return.
- since_id: returns notices with ids greater than the given id.
Other things to note:
- StatusNet's version of the search does not support operators, such as "from:", "to:" and booleans, yet.
- Notice content is HTML-encoded.
Example searches:
- Find notices containing a word:
- Find notices referencing a user:
- Find notices containing a hashtag:
[edit] Trends
StatusNet does not support search term trending data, yet.
[edit] StatusNet methods
These are extensions to the Twitter API that expose StatusNet-specific functionality.
[edit] config
Show a StatusNet instance's configuration info. Of special note is the element (config/site/private), which indicates whether a StatusNet site is private. When a site is configured as private every other API method requires authentication, including the public timeline (`/api/statuses/public_timeline.format`).
- URL: `/api/statusnet/config.format`
- Method: GET
- Auth required: no
- Parameters: None
- Formats: xml, json
- Returns: configuration information
Example ruby script showing how to test for 'private' mode.
Example XML return document:
1 1 StatusNetts 2 2 statusnetts.org 3 3 statusnett 4 4 statusnetts 5 5 true 6 6 en_US 7 7 admin@statusnetts.org 8 8 StatusNetts, Inc. 9 9 http://loconicats.net/blog 10 10 false 11 11 false 12 12 true 13 13 14 14 15 15 http://creativecommons.org/licenses/by/3.0/ 16 16 Creative Commons Attribution 3.0 17 17 http://i.creativecommons.org/l/by/3.0/80x15.png 18 18 19 19 20 20 little_cat_A,catinthehat 21 21 22 22 23 23 false 24 24 20 25 25 600 26 26 27 27 28 28 false 29 29 INVALID SERVER 30 30 update[edit] version
Show the version of StatusNet an instance is running.
- URL: `/api/statusnet/version.format`
- Method: GET
- Auth required: no
- Parameters: None
- Formats: xml, json
- Returns: version information
Example XML return document:
1 1 0.7.1
Retrieved from "http://status.net/wiki/Twitter-compatible_API"
Thursday, June 3, 2010
Twitter-compatible API - StatusNet // more crap on autopost
via status.net
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment