Convert from $resource to $http