Probably not a bug, though, so I didn't want to reopen an old issue. Probably just me not getting something.

The error is: { "#error": true, "#data": "Invalid method " }

What I've tried is many variations on the following two themes:

$.post('http://my.site/services/json', {"method":"views.get","view_name":"my_view"});

$.ajax({
type: 'POST',
url: 'http://my.site/services/json',
data: {"method": "views.get", "view_name":"my_view"},
dataType: "json",
});

I'm just trying this in Firebug at the moment, trying to get a response back so I can build from there. I've noticed many other people reporting the same error, but I've tried both 6.x-2.0-alpha2 and 6.x-2.x-dev, both Services 6.x-2.2, and I had gathered both of those versions included a patch to fix this problem. So I have to figure I'm doing something very basic wrong, which is likely as I'm having to learn javascript on the fly here. Can anyone show me my error here?

Comments

dodwyer’s picture

I found I had the same issues until I enabled the additional service modules, System Service, Views Service etc

Hope this helps.

wrd’s picture

Thanks for the reply! I had views service enabled, but none of the others. Unfortunately, I'm getting the same result with all services enabled. I feel like I must just be doing something wrong in my post syntax, just not sure what.

mill0234’s picture

Try:

...
data: {method: '"views.get"', ...
...

The php json_decode function is used so you have to wrap the arguments in a single - double quotes (i.e. '"arg"').

wrd’s picture

Bingo! Many thanks!

pmathur01’s picture

Hi,
I am getting the same error .. I am new to json and webservices. I installed the webservices module. I enabled all the services eg. node, system, user, echo. I am trying to access node.get from drupal cloud android app and I always get this error.
{ "#error": true, "#data": "Invalid method " }.
Even when I browse the service module on my webserver and click on json server I get this error. Can you please guide me with the issue.

Prerna

surbhipatel’s picture

Hello Everyone

I am new to the jsonserver and services module . I configured both the module in the site http://openxcelluk.info/test site . When ever I click on http://openxcelluk.info/test/services/json link I get { "#error": true, "#data": "Invalid method " } every time . Please help me what I have to do . Do I need to do any coding in the module. I even set the key.

jaypan’s picture

Bump. What is the format of the POST data supposed to be? I cannot get any response other than #invalid method.

skyredwang’s picture

Status: Active » Closed (fixed)
jaypan’s picture

Status: Closed (fixed) » Closed (cannot reproduce)

This wasn't fixed, I never got a response.