Improvements in REST API

Many improvements and bugs solved in REST API.