When trying to call views.retrieve, I get the error message "View could not be found", where there is a blank space where the @view name should be. However if I simply tell the access callback to return TRUE, it proceeds to retrieve the view as expected.

Comments

dragonwize’s picture

Status: Active » Postponed (maintainer needs more info)

What exactly is the path you are using?

Services 3.x does not use the views.retrieve syntax. Instead it is [endpoint]/[resource]/[id]/[action]. For the views resource you use "views" or your resource alias.

g10’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new2.2 KB

Noticed the same issue (with 7.x-1.x-dev, using AMFserver)
The problem is not the syntax, when the same syntax for node.retrieve is used, it works fine, but not for views.retrieve.
Difference is, in the access callback method, that node.retrieve checks if the $args[0] is a string and makes it an object, views.retrieve expects a named array (eg. $args['view_name'] but receives $args[0] as a string).

I'm not sure where the exact issue is situated, is this a server issue? (as the comment in _node_resource_access mentions: ' // Make sure we have an object or this all fails, some servers can mess up the types.)

I noticed node_resource normalizes the arguments as an array with an object for each entry, thus followed this:
$args[0]->view_name opposed to $args['view_name'] which is expected in the callback, whilst the callback receives $args[0] with a string value

This solves the issue, the callback receives the proper arguments, and returns the view…
patch in attachment.

g10’s picture

fixed a typo/but in last patch where the optional $display_id is not passed

g10’s picture

Status: Needs review » Closed (works as designed)

Previous patch is unnecessary!
traced the issue to the amfserver module, which did not pass an associative array to the views resource

solution is here:
http://drupal.org/node/1218070

josebc’s picture

Status: Closed (works as designed) » Active

This is happening with SOAP Server also

kylebrowning’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)