refactored document REST api

Change-Id: I96b3f4665e14969f3a8b5c54dd019e704e02b535