I'm trying to understand if my server json works, but when I try to use curl to check the methods I always get this error:

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

This is what I used:
curl --data method=system.connect http://mysite.com/mydrupalfolder/services/json

Just to give you more information: my installation is not in the root of my site and I have clean URL's enabled.

Any idea?
Thank you in advance.

Comments

nicholasthompson’s picture

Status: Active » Fixed

The method's value is considered a JSON value. For a JSON value to be a string, it should be enclosed in double quotes. This threw me for several hours too...

Try:

curl http://vmtest6/services/json --data method=\"system.getServices\"

Please re-open if this does not help...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

myktra’s picture

Yes, I'm receiving this as well on latest dev build, calling curl from multiple workstations, including the server Drupal is running on. My site is also not in the root folder.

curl --data method=\"system.connect\" http://my-server/my-drupalrootfolder/?q=services/json
curl --data method=\"system.connect\" http://my-server/my-drupalrootfolder/services/json

{ "#error": true, "#data": "Invalid method system.connect" }

The Services service module is installed and the JSON server appears in the Servers section in /admin/build/services.

Not sure if this is related but I am also seeing this error message in /admin/build/services/browse/system.connect

warning: Invalid argument supplied for foreach() in /srv/www/my-server/public_html/ww/sites/all/modules/json_server/json_server.module on line 28.

Services 6.x-2.x-dev
JSON server module 6.x-1.x-dev

Thoughts?

upupax’s picture

No.. I'm still having the same problem too...

chuckfletcher’s picture

I have the same issue. Any ideas on this?

chuckfletcher’s picture

I see a different error in system.connect: warning: call_user_func_array() expects parameter 2 to be array, null given in myserver/modules/services/services.module on line 411.

ilo’s picture

Do you all have the same issue, and do you all use services module version 6.x-2.0? If you take a look to the services issue queue there is a major redesign ongoing for development branches. Does this module work with the stable release of services? did you try?

burningdog’s picture

JSON Server doesn't work with the stable release of Services (6.x-2.0-beta1) unless the patch at #4 is applied from #663744: JSON Server returns "invalid method" for all function calls with Services 6.x-2.x-dev.

@myktra, once you've applied that patch, try:
curl --data 'method="system.connect"' http://my-server/my-drupalrootfolder/services/json

It took me a while to find the format which worked. Using arguments is like so:
curl --data 'method="my_module.connect"' --data 'name="Roger Saner"' --data 'mail="me@example.com"' http://example.com/?q=services/json