Drupal views_get_view in custom service I created a custom service with mymodule_services_resources and I'm calling a function to return some items. This function inside is calling a view with views_get_view. The problem is always return an empty array.

If tested the same code somewhere else it shows the right results, but it does not work with services. I have something like this:

$view = views_get_view('the_view');
$view-&gt;set_display('default');
$args = array("my_param");
$view-&gt;set_arguments($args);
$view-&gt;pre_execute();
$view-&gt;execute();   
$view-&gt;result; //empty array in the WS  


I tried loading the admin user ($user = user_load(1); ) before calling the view but I had the same results.

Is there something I should add, change or remove in order I can get the results of a view calling service endpoint?

Thanks!
the module services_views will help you expose the view as a resource in two different ways

It has currently two features:


Create view based resource creating Services display in a view
Execute any view of the system via views resource call