Several weeks back I was discussing with a co-worker what it means to work in the data field. The old-school answer, which is still probably the most common, is that you will be in some way involved with databases. While that is unlikely to change there is a shift towards working with APIs instead of directly with the database (providing a level of abstraction from the underlying database). I, for one, am a strong fan of this approach since it often makes my life easier.
Of course that means that someone has to build the APIs, which has gotten a whole lot easier. The question from my co-worker was, “Can you build an API in R?” Valid question. My off-the-cuff answer was of course, you can do anything in R, and if you can’t do it in native R you use Rcpp and do it in C++ and call it from R (EDIT: After thinking about this a bit, it is probably not wise to do this in R given the fact that R is an interpreted language and doesn’t really “run” a stand-alone application in the traditional sense).
While I didn’t take the time to develop an API in R, I did write a simple Java program that uses Maven, Spring MVC, and MyBatis to publish an API. I learned this technique from some highly seasoned developers; many thanks to them.
It is really quite simple once you get all the pieces hooked together.
Check it out on GitHub.