Uniform api

* This contains all the api changes from #259 but without the JS admin console
* Contains minor changes to the js to accommodate different roles. 

Should be merged before #259.