put deferred.resolve in getAllrests Func