API discovery

From StatusNet
Jump to: navigation, search

Finding the API root

As of StatusNet 0.9.2 (plus or minus), the base URL for the Twitter-compatible API can be obtained using Really Simple Discovery. This is the same API discovery system that other tools like WordPress provide for blogging/microblogging protocol discovery:

First, find the <link rel="EditURI" type="application/rsd+xml"> in the site's home page:

 <link rel="EditURI" type="application/rsd+xml" href="http://identi.ca/rsd.xml"/>

Pull that URL down and you'll get something kinda like this:

 <?xml version="1.0" encoding="UTF-8"?>
 <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
   <service>
     <engineName>StatusNet</engineName>
     <engineLink>http://status.net/</engineLink>
     <apis>
       <api name="Twitter" preferred="true" apiLink="https://identi.ca/api/" blogID="">
         <settings>
           <docs>http://status.net/wiki/TwitterCompatibleAPI</docs>
           <setting name="OAuth">true</setting>
         </settings>
       </api>
     </apis>
   </service>
 </rsd>

Approximate path/selector: rsd/service/api[name="Twitter"]@apiLink

Getting server info

This can provide very useful info about the server, the most important of which for a client is likely:

  • Max character count: config/site/textlimit

You can also find various useful info such as whether the site is marked as public or private, which may help in deciding whether to include a site in multi-service broadcast posts. Note that some data, including the character count, aren't available in older versions of StatusNet.

Here's a patch to Adium 1.4beta which provides an example of checking this data (Obj-C).

Personal tools
Namespaces
Variants
Actions
Navigation
Status.net
Toolbox