Server API unit tests and improvements