Fixed tests for RESTApi and bugs related to empty metadata in the request body