Fixed rest api, test cases.