Issue #768. This commit can be used as a starting point for writing a REST server.