Refactor REST API endpoints and documents