refactored document REST api

Change-Id: I342cbd86599e996091413d6d4217e3578fa7664d