enable rest and refactor code
use zero spaces for json format
add tests for rest api
update docs for rest api