wip: Add rest api

Close #29
Implements #30 
Am I reading the diff correctly that a few of these `require()`s are now extraneous?