I still can't obtain anything from REST server.
Let's say I want to work with node. Under Drupal admin all the 4 services works fine :
- node.get
- node.view
- node.save
- node.delete
But when I try the same request from outside Drupal nothing happen. Examining HTTP request show an error in response : 404 Not found: could not find resource
Trying to test REST server via my_url/services/rest lead to the same 404 error.
In the same times XML-RPC server test request lead to a 200 response with following content : "XML-RPC server accepts POST requests only".
Both services and REST server was updated one hour ago (6.x-2.x-dev (2009-sept.-06) and 6.x-2.0-beta-1)
May I have missed something ?
Comments
Comment #1
leovarg CreditAttribution: leovarg commentedsame exact thing here . anyone?
Comment #2
librarywebchic CreditAttribution: librarywebchic commentedI'm seeing the exact same error with the REST Server. Has anyone figured out what is going on or how to solve this?
Comment #3
leovarg CreditAttribution: leovarg commentedNop, i dont think so! I'm still looking for that to be fix
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedAs for me I did not try again : I've put the functionnality using it on an hold state.
Comment #5
Hugo Wetterberg CreditAttribution: Hugo Wetterberg commentedHi Guys,
Sorry about the delay with this, I wasn't subscribed to the issue queue. What are your respective setups. Enabled services, the url's you tried to access, and so on?
/Hugo
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedHi Hugo,
The project involving REST server is in pending state and every stuff have been archived.
The customer I am working for plan to reactivate this part of it's project by the end of November. I then can give you all the informations needed.
Comment #7
gmartens CreditAttribution: gmartens commentedHi
I'm using Drupal 6.11 with
REST SERVER module: 6.x-2.0-beta1
SERVICES module: 6.x-2.x-dev
a simple HTTP-get via my_url/services/rest/node/123 also causes the 404-error:
HTTP/1.0 404 Not found: could not find resource
So a fix for this issue would be great!
Greetz,
GM
Comment #8
Hugo Wetterberg CreditAttribution: Hugo Wetterberg commentedOk, just to check, have you enabled the node_resource module? Not just the node_service module?
/Hugo
Comment #9
gmartens CreditAttribution: gmartens commentedHugo,
yes both node resource and node service modules are enabled ....
GM
Comment #10
kehan CreditAttribution: kehan commentedI'm getting the same problem (404s) using the urls in the readme file with the node_resource, services, rest_server. Do we need some services authentication modules enabled?
wget http://localhost/services/rest/node/28
returns:
Comment #11
lasconic CreditAttribution: lasconic commentedI think rest_server needs to be adjusted to work with the last version (6.x-2.x-dev) of services.
In particular because of this issue #616490: Services API misuses hash/number (#) symbols
Comment #12
Hugo Wetterberg CreditAttribution: Hugo Wetterberg commentedOk, I think that I've pinpointed the problem. Most of you guys are probably running drupal in a subdirectory, which I've never done, and there are some faulty path manipulation that's done when the base path is anything else than /.
There is also some problems with the recent change that started stripping #s from all service declarations.
A update is coming soon that will correct this. I'll try to get this done tonight.
Comment #13
Hugo Wetterberg CreditAttribution: Hugo Wetterberg commentedComment #14
Hugo Wetterberg CreditAttribution: Hugo Wetterberg commentedTagged a 6.x-2.0-beta2 release of REST Server with the following changes:
http://github.com/hugowetterberg/rest_server/commit/413a1640acf673aa48e4...
(http://drupal.org/cvs?commit=294780)
Comment #15
pm530 CreditAttribution: pm530 commentedHi Hugo:
Looks like the problem is still there in 6.x-2.0-beta2. I am using it with Service 6.x-2.x-dev and drupal's multisite.
Comment #16
pm530 CreditAttribution: pm530 commentedHi Hugo:
Looks like the problem is still there in 6.x-2.0-beta2. I am using it with Service 6.x-2.x-dev and drupal's multisite.
Comment #17
Hugo Wetterberg CreditAttribution: Hugo Wetterberg commentedHave you installed and configured a authentication module?
Comment #18
pm530 CreditAttribution: pm530 commentedHi Hugo:
The key authentication module is installed and configured. 404 error is still there.
FYI:
the git diff shows a change in RESTserver.inc:
- $cm = $controller['#models'][$formatter['model']];
+ $cm = $controller['models'][$formatter['model']];
but the change is not in beta2 release.
And this doesn't make it work.
Comment #19
Hugo Wetterberg CreditAttribution: Hugo Wetterberg commentedWhat's the 404 status message?
Comment #20
pm530 CreditAttribution: pm530 commentedHTTP/1.x 404 Not found: could not find resource
Comment #21
Hugo Wetterberg CreditAttribution: Hugo Wetterberg commentedAnd the node_resource is installed and the url you're trying to access is: "http://example.com/services/rest/node"?
Can you check what $canonical_path is at line 14 in RESTServer.inc and what $resources and $resource_name is before the if statement at line 49?
Comment #22
pm530 CreditAttribution: pm530 commentedHi Hugo:
I found my problem. I forget to enable the node_resource module. Sorry for the false alarm.
The new question is. How can I user this module to serve other services. Let's say system.connect .
Comment #23
kehan CreditAttribution: kehan commentedHi Hugo,
I get the following values:
$canonical_path = 'node/28' (I'm trying to load node 28)
$resource_name = 'node'
$resources:
I have key based authentication module enabled but have then unchecked the 'use keys' option on admin>build>services.
I'm am using a multisite install, with the modules in my specific site's folder.
wget is still giving me 404:
Thought I'd better post this but I'm looking into it.
Comment #24
kehan CreditAttribution: kehan commentedOK I discovered a few stray hashes in includes/RESTServer.inc - on double checking these have been removed in the version at http://github.com/hugowetterberg/rest_server - could you commit this code to cvs.drupal.org as the dev snapshot is broken with the latest services module.
Thanks,
Kehan
Comment #25
gmartens CreditAttribution: gmartens commentedhi Kehan,
I tested your latest version (http://github.com/hugowetterberg/rest_server), but I'm
still having the same issue ...
> wget http://localhost/drupal/services/rest/node/138
--11:02:54-- http://localhost:80/drupal/services/rest/node/138
=> `138'
Connecting to localhost:80... connected!
HTTP request sent, awaiting response... 404 Not found: could not find resource
11:02:56 ERROR 404: Not found: could not find resource.
The node service & node resource, key authentication module (but also unchecked the 'use keys' ) are enabled.
Drupal is in a subfolder since I'm using a multisite install
greets,
GM
Comment #26
myktra CreditAttribution: myktra commentedSame here, Drupal in subfolder off webroot, returning a 404. Also having a similar problem (perhaps) with the JSON server module.
Comment #27
ransomweaver CreditAttribution: ransomweaver commentedIs the WSOD when visiting mysite.com/services/rest indicative of rest_server FAIL? version 1 didn't do this.
And anyone have any node.save php cURL examples? everything I do comes back http 500, internal server error. Though hopefully that's due to line 1 above....
Comment #28
lasconic CreditAttribution: lasconic commentedCould this be commited to 6.2 branch?
Comment #29
Hugo Wetterberg CreditAttribution: Hugo Wetterberg commentedHi everybody. I've committed the missing hash removal as beta3. And the subfolder issue should be resolved since beta2.
@ransomweaver No it's not indicative of a fail, there's simply nothing to show at the root, if a resource has a index controller the next level, in other words: mysite.com/services/rest/node will give you some results.
When I'm testing things through everything seems to work. So what I need to know is: using the latest and greatest version of services and rest_server, do you still have problems?
Cheers,
Hugo
Comment #30
Hugo Wetterberg CreditAttribution: Hugo Wetterberg commentedComment #31
arirasekh CreditAttribution: arirasekh commentedI appear to be having the same issue.
I'm using the services 6.x-2.0-beta1 with rest_server-6.x-2.0-beta3. I've got Drupal running in a subdirectory within web root and I receive a 404 error with any of the following requests (regardless of clean URLs being enabled/disabled):
http://localhost/drupal-6.6/?q=services/rest
http://localhost/drupal-6.6/?q=services/rest&method=node.get&nid=1
http://localhost/drupal-6.6/?q=services/rest&method=node.load&nid=1
Thanks
Comment #32
Hugo Wetterberg CreditAttribution: Hugo Wetterberg commented@arirasekh That's because the REST server doesn't work like that. Check out the notes for the 2.x version on the project page, I've moved them to the top of the page so that less people will miss them. And you also seem to have installed the node service and not the node resource, which sort of takes away some of the benefits of the REST server.
Comment #33
blaupunkt72 CreditAttribution: blaupunkt72 commentedIt would be helpful to include some additional samples across the different services.
the included 'retrieve' sample, http://[server]/services/rest/node works great to get a giant dump with no details
GET /services/rest/node?type=xxxx does not query as the docs suggest is the case for index pages
one of the entries suggests using views to filter records, but it is unclear what the REST syntax is for the View Service
the intuitive GET /services/rest/view does not work
Comment #34
Hugo Wetterberg CreditAttribution: Hugo Wetterberg commentedYes, this is pretty much a issue of lacking documentation. The node resource _can_ use my query_builder module for the node index, but I didn't want to introduce a dependency. Take a look at node_resource.inc, line 97: http://bit.ly/9s5B1x
The services that are written for rpc style servers are mapped to actions. 'views.get' will get mapped as the action 'get' on the resource 'service_views'. So the way to access it would be:
POST /services/rest/service_view/get
with the body:
{'view_name':'your_view','args':[1,34]}
/Hugo
Comment #35
ygerasimov CreditAttribution: ygerasimov commentedDear Hugo,
I still have the same problem on my fresh drupal 6.15 installation. I use following versions of modules:
Services 6.x-2.0-beta1
Node Resource 6.x-2.0-beta1
Node Service 6.x-2.0-beta1
REST Server 6.x-2.0-beta3
But still when try to go example.com/services/rest/node or example.com/services/rest/node/1 get 404 Not found: could not find resource.
Let me know how to cope with this problem?
Thank you.
Comment #36
ygerasimov CreditAttribution: ygerasimov commentedsorry. everything is working after authentification keys has been created
Comment #37
geekomono CreditAttribution: geekomono commentedDear Hugo,
I have also the 404 Error.
I use the following modules :
+ Services 6.x-2.0-beta1
+ Node Resource 6.x-2.0-beta1
+ Node Service 6.x-2.0-beta1
+ REST Server 6.x-2.0-beta3
+ Zend framework
My test URL is http://127.0.0.1/drupal02/services/rest/node/1 and the drupal's version is 6.15.
I have not Authentification key and I'am learning how to use it. Maybe it is the solution as for ygerasimov. I do not realize specials configurations. I just installed the Services, REST Server and activated all modules. But I still have the error and I do not understand why ? Do you have an idea ?
Thank you .
Comment #38
kaw3939 CreditAttribution: kaw3939 commentedHi,
I am able to get the services module to retrieve a node, but I can't get it to retrieve a view.
I have tried a lot of different formats for the URL and none seems to work, this is my best guess as to what it is supposed to be:
/services/rest/service_view/get?view_name=workshop_section_template
My site is in a subdirectory, but retrieving a node works fine, so I think it is the syntax of my URI request. The view name is correct and it works in the services admin browse area correctly.
Thank you for any help,
kaw3939
Comment #39
joblo CreditAttribution: joblo commentedI had a similar problem with REST:
+ installed and activated Services-6.x-2.0 / Node Resource / Node Service / REST Server 6.x-2.0-beta3
the test url in the browser didn't deliver a result: /services/rest/node/1
if have tried with services_keyauth disabled or not configured
the problem I have found:
+ the Service module behind the REST Service always want an authentication, even if no one is installed
+ the default attributes of the controller are always set to 'auth' => true
services.module: line 404
and the function services_auth_invoke always returns true (means $auth_error) if no auth-method is found
changed return TRUE; to return FALSE; in line 326 and the REST service was accessable via the browser.
should the services_auth_invoke really return an error, if no auth method is found?
----------------------------------------
other side-effects with this change ??
----------------------------------------
another workaround I have tested
added
'#auth' => false,
'#key' => false,
in node_resource_service_resource in node_ressource.module (line 42)
+ but I think thats dangerous, because auth will always be generally disabled for retrieving nodes
+ should be set for own custom services only
Comment #40
sumitk CreditAttribution: sumitk commentedConfirming 39 .. and thanks joblo!
* rest_server beta3 + drupal 6.16 + services 2.x + no authentication method enabled is giving a 401 (authentication error) on services/rest/node
* Making change to line 326 to return a FLASE in services.module is making REST server work properly
Comment #41
ben.mi CreditAttribution: ben.mi commentedHave a question.who can help me?
------
drupal 6.16
services 6.x-2.0
rest_server 6.x-2.0-beta3
Input stream helper 6.x-1.0
Autoload 6.x-1.3
all the module is opened.
but i can't get the result by http://services/services/rest/node/id
and the next code is return Failed to open/read local data from file/application.
i don't konw why?
Comment #42
Hugo Wetterberg CreditAttribution: Hugo Wetterberg commentedI don't know anything about the key auth stuff. But this is how a request is made:
Or, if you use http_client:
Comment #43
Josephnewyork CreditAttribution: Josephnewyork commentedI can't get any requests to return anything (REST Server 2.0/Services 2.0).
I don't want to use Keys or session IDs, I just want to be able to load content via GET method...
When I visit these URLs in my browser, I'm expecting to see the REST XML, but I see nothing:
/services/rest/service_view/get?view_name=friends_service&args=joe (to load a view)
/services/rest/node/2 (to load a node)
I just want to be able to access some XML?? I can't think of anything else to try... Please help! Thanks!!
Comment #44
Hugo Wetterberg CreditAttribution: Hugo Wetterberg commentedYou have to configure a authentication module. If you don't want one you'll have to install key auth and just uncheck all it's options. Stupid, I know, it's a services design/security choice that one may or may not agree with.
Other than that you'll have to learn to debug http requests. Look at response headers et cetera. The views example you posted will never work, as requests to translated (old-style) services have to be made using POST. The REST server will respond with a 404 controller not found when you make a call like that.
Also read up on what a REST server _is_, as that will help you understand how to use this module.
Comment #45
Josephnewyork CreditAttribution: Josephnewyork commentedThanks for the response Hugo.
I had it set up without checking the key or sessid, and no dice. Here is my response headers for /services/rest/node/2:
As to the views service, the need for the GET method instead of the POST is needed for CDN caching reasons. Actually, the reason I used it in the first place was because of the GET method... I'll have to create a work-around.
Thanks
Comment #46
maykelmoya CreditAttribution: maykelmoya commentednode.get allows a second argument for filtering fields. Is that doable with rest_server?
Thanks
Comment #47
wils.solutions CreditAttribution: wils.solutions commentedSo,
My auth module is unchecked however I am getting the same error: 404 =(
tkx
Comment #48
wils.solutions CreditAttribution: wils.solutions commentedHi Hugo,
I have followed the steps:
1 - Installed Services
2 - Installed the REST Server
3 - Enabled the Auth Key Module
4 - Created a Key
5 - On Key settigns i have disabled the key/sid checkboxes...all checkboxes are un checked.
6 - Still have the 404 page trying on my browser: /services/rest/node/1
Note: the all services are enabled.
Tkx
Wils
Comment #49
thbnelson CreditAttribution: thbnelson commentedApparently I made a work around for the issue described by joeweitzel. I wanted to use a simple GET request for CDN caching, simplicity and to test via browser. Just submitted as a bug on its own with a patch for beta3.
http://drupal.org/node/825412
Comment #50
iTiZZiMO CreditAttribution: iTiZZiMO commentedHello all,!
i've the same issue.
Service Module 6.2
Rest_Server 6.2.x beta 03
All Services are activated
Node Creation of type xy allowed for anonymous user
Key Authentication Module enabled
Keys are created for all services
Here is my test script (i tried it with php.serialized and json format, always the same error 406
Could anybody help me? it is also possible to send data for node creation via json format ?
Comment #51
iTiZZiMO CreditAttribution: iTiZZiMO commentedhello again,
i found out that the hash argument is missing?
here is the coding part of restserver.inc
if i disable use keys in the key authentication modules, it works.
Is it an issue of restserver or the key module?
Because the execption was thrown in rest_server module.
Comment #52
avner CreditAttribution: avner commentedi have the same problem
disabling the key did not resolve the issue
Comment #53
roynilanjan CreditAttribution: roynilanjan commentedwhen try to run like domain_name/services/rest/node/[nid] entire blank page is coming
i have used the beta3 version
Comment #54
roynilanjan CreditAttribution: roynilanjan commentedCan you explain what should be proper configuration with authentication module for this rest-server.... ?
Comment #55
dbosen CreditAttribution: dbosen commentedI had the same problem to get /services/rest/node/1. All I got was a blank page (just like roynilanjan).
But /services/rest/node/1.yaml or /services/rest/node/1.php etc. worked. My problem was, that my PHP did not have libxml2 included. After adding libxml2 support to php everything worked. Maybe some of you have a similar problem, just check if http://your_domain/services/rest/node/1.yaml works.
Comment #56
Openlogic CreditAttribution: Openlogic commentedI was able to get the node.get and node.delete methods working as expected using the GET and DELETE http methods
What is the URL syntax to invoke methods such as node.view which do not have corresponding http methods? Would this be treated as a targeted action as described in the documentation on the project home page? If so, then I thought I'd try something like this:
POST /services/rest/node/123/view
but this results in a 404 "could not find controller"
Any clarification would be much appreciated.
Thanks
Faisal
Comment #57
deeptiengg CreditAttribution: deeptiengg commentedHi,
I am using
REST Server - 6.x-2.0-beta3
Services - 6.x-2.2
I had few static nodes in my drupal application which I accessed from remote Rails based application using REST services as follows:
http://mysite/services/rest/node/2.json (2 is the node id of the drupal node)
Everything worked fine. Now I have some dynamic pages with PHP code in drupal which I again want to access from my remote application. So I used the same thing as above but I am not getting the dynamic content at the other end. Reason being that it uses node.get method which gives the copy of node so its returning the php code as it is. How this can be resolved..????? I have seen that node.view in drupal gives me the correct results, Is it possible to remotely access the node using node.view or if there is some other solution ????
Thanks for your help in advance.
Regards
deeptiengg
Comment #58
deeptiengg CreditAttribution: deeptiengg commentedCan someone suggest something please.....
Comment #59
J-Chance CreditAttribution: J-Chance commentedsubscribing
Comment #60
FreddieK CreditAttribution: FreddieK commentedsubscribing
Comment #61
ngstigator CreditAttribution: ngstigator commentedRe #42
"Not found: could not find resource" when using the http_client version. When using the curl example I get "bool (false)".
I'm wrapping these inside a function in a custom module. Any pointers would be greatly appreciated.
UPDATE: works perfectly with key authentication disabled.
Comment #62
ngstigator CreditAttribution: ngstigator commentedResponse to #41
Line 6
$url .= "/method=user.get&id=1&hash=" . $hash;
should be:
$url .= $domain . "/method=user.get&id=1&hash=" . $hash;
Might return the HTML for "Page not found", however.
Comment #63
voxpelli CreditAttribution: voxpelli commentedIn response to #55 - seems like a check for libxml2 should be added to the REST Server then.
In response to #56 - the Node Resource from Services 2.x is the preferred way to use nodes with the Rest Server. With it you just do a "GET /services/rest/node/123" to get the node.
In response to #57 - how a specific resource works is nothing that the REST Server deals with - that's a Services issue.
I'm closing this issue now - we don't need everyone asking their individual questions in the same issue. If you still have any outstanding questions please create a new issue for them. 63 comments makes it impossible to get a good overview so this issue will never get more solved than it is now.
Comment #65
anilkhadka CreditAttribution: anilkhadka commentedI enabled service-views module and now views is shown as resources but when I visit this URL
http://localhost/drupal/note/views/get?view_name='blog'
but I could not able to get Content of views.
If possible I also wanted to use views as a searching engine by using services module and rest server.Is there any solution
Thank you.
Comment #66
edup_pt CreditAttribution: edup_pt commentedHi,
I've just installed drupal 7.10 and services (3.1) plugin with rest, (after installing Chaos tools). I've added the file spyc.php into the lib.
Im have setted the xmlrpc and its working, but i cant put any rest service working. It always give me 404 Page Not Found.
- Im setting the service like every post i read says but really no luck
I've added some screenshoots in order for you to see my configurations.
Any kind of help i would appreciatte.
Thanks.
Comment #67
edup_pt CreditAttribution: edup_pt commentedOk. Problem fixed. I didn't have the pretty url's turned on.
Thanks.