Thrift as a Public API replacement for REST?

Johann du Toit picture Johann du Toit · Apr 6, 2012 · Viewed 14k times · Source

I started creating a API for a new site I'm working on.

I originally wanted to make it an normal REST API but I keep thinking about how cool thrift would be with the ability to compile multiple client libraries in one batch.

Is Thrift a viable option for a public API ,sockets and all, or should I stick with REST?

And if REST what would the best approach for creating multiple client libraries or would I just have to get down and dirty and actually write them?

Else if Thrift, would I compile the libraries and just offer download links or simple give the developers the .thrift file to generate their own library ?

Note: It's still a small site so I would create the Thrift Specification file just for the API.

Answer

StaxMan picture StaxMan · Apr 12, 2012

First, REST and Thrift are apples to oranges -- former is a general style, latter specific binary RPC system.

But for public interfaces I think that REST using standard textual formats (JSON or XML, usually) makes more sense; as it is easier to access from any language or platform; and although there are Thrift clients on many platform it is still more work. It also forces specific access style on clients, pretty much having to use specific Thrift client library.

So question would rather be what exactly are you trying to gain? What exactly do you consider "cool" there? If you just want to play with new technology, there's nothing wrong with that but you should first play with it, then see if it makes sense.