wip: Add rest api

Close #29
Implements #30 
Could this be moved to the top of the file? It's my personal preference, but in this case I can also use the excuse that it is the style used by the other files in this module.