Getting "Access denied for user anonymous" when calling a CRUD function

by Javiator   Last Updated May 21, 2015 06:03 AM

I configured a REST service with the Services module and created a custom service with the CRUD + index functions. If I call the index function like so localhost/drupal/blog/note, it gives me the correct output. But if I call the retrieve function like so localhost/drupal/blog/note/2, I just get ["Access denied for user anonymous"]. The retrieve function should just return the id that is passed in the path, which is 2 in this example. I don't have any authentication enabled for my service. I also turned on all available permissions for the anonymous user to see if it works but that did not help.

So what could be the problem?

Answers 2

problem say ur not authorized person means you need to login to system first then hit the url you will get the result in browser..

$cookie_session = "$session_name=$sessid";


 curl_setopt($curl, CURLOPT_COOKIE, "$cookie_session");

this will you will set your session and you will able to use CRUD function.

Gholave Ranjeett Vijaykumar
Gholave Ranjeett Vijaykumar
March 18, 2014 06:27 AM

You need to give the access for "Anonymous User"(If you want to access your service output through Anonymous User) too, for the content view/edit/delete (which is required), for the same node type which you are going to access through your web service in Drupal 7.

Either you need to first login and you can view if you have required permissions.

August 05, 2015 02:55 AM

Related Questions

Configure Menu Access Visibility and permission

Updated June 26, 2015 17:03 PM

Show block on nodes and only for node author

Updated April 15, 2015 02:03 AM

Dynamic content-type creation

Updated June 29, 2015 17:03 PM