add tests and docs to rest api