refactor restapi abstract