refactored document REST api