How to interface against other networked applications using Erlang?

Sure, you can do REST with Erlang, see e.g. http://www.infoq.com/articles/vinoski-erlang-rest - if appropriate for your apps' needs, REST is an excellent approach. (Pycon Italia Tre, next week in Florence, has sessions on Erlang/Python cooperation, see www.pycon.it if you're near Tuscany;-).


The port/socket solution is a good idea and is not hard as it may seem. Google's protocol buffers is just what you need. It is very easy to use, efficient and maintainable. It has implementations for C#, erlang, java, python and many more (See OtherLanguages and developer guide)

You can use protocol buffers to define the request and response protocol structure. Then use it to communicate between erlang and any other supported language. The tutorial will explain it all. After that all you need to do is send the response over the port.

The advantage of this approach is that:

  1. You can easily extend and change the protocol in the future
  2. It is much more efficient than the REST approach
  3. It is currently used by Google for almost all of its internal RPC protocols and file formats

If you want to implement a REST API in Erlang there is only one thing to do. Use the excellent MochiWeb Kit to build your own HTTP server that implements your protocol.

Don't panic, it really is easier than it would appear.

There are a number of tutorials about how to do it including a screencast set from the Pragmatic Programmers.

It comes with a complete set of json libraries, so you'll be fine!


There is also a JSON library for Erlang, which you might want to look into. I haven't used it, so I can't say anything about it from experience.