Blog

Even faster webservices (no comment)

xav.cc offers since long a rather complete REST-style API, which can be used to encode or decode short URLs. It has proved to work quite well, as it is based on a plugin called sfDoctrineRestGeneratorPlugin for the framework symfony. However, there were still some place for responsiveness improvements, and the API is now somehow faster than before.

JSON per default

First, the default serializer is now JSON by default. JSON has many advantages over XML which, in contrary, has other qualities. JSON wins on concision and is faster to generate than XML, while XML is often described as being more robust and more explicit than JSON. Since several weeks, xav.cc offers both formats, and XML was the default one until today. Now we have switched to JSON per default, because we think that this will be a sufficient alternative in most of the cases. It will help save bytes in mobile environments, when mobile clients call the API. It is also much faster to serialize than XML, and will therefore allow for smaller response times.

All this means that, if you were using the API url http://api.xav.cc/sf_short_url with a XML client until today, you will now be served JSON feeds. The fast fix is just to add the format suffix ".xml" at the end of the service URL, and you will be given your XML back: http://api.xav.cc/sf_short_url.xml.

The XML API gets also faster

The XML API has also been made faster, thanks to a patch borrowed from the code of CakePHP, which makes the camelization process much much faster.

We have some plans in order to improve the API, but you may also have ideas or requirements? Would you like BSON or RDF feeds? What is missing in the current API?