0
votes

I have created a path with a hook_menu function which is intended to be accessed anonymous users. Definition is :


     ##generic access point for API calls #
     items['api'] = array(
       'title' => 'api access point',
       'description' => 'Pass all api calls thru single access point to simplify code',
       'page callback' => 'xxxxxxx_utility_api',
       'access arguments' => array('access content'),
       'access callback' => TRUE,
       'type' => MENU_CALLBACK, );

The path www.mysite.com/api/aaa/bbb/...

returns JSON

and functions as long as I am logged in, but I need to allow anonymous access to the path

How can I configure drupal to allow anonymous access to a path that returns JSON

1

1 Answers

0
votes

your need to have 2 levels and to delete access arguments and next clear cache menu (drush cc menu)

     items['api/custom'] = array(
       'title' => 'api access point',
       'description' => 'Pass all api calls thru single access point to simplify code',
       'page callback' => 'xxxxxxx_utility_api',
//       'access arguments' => array('access content'),
       'access callback' => TRUE,
       'type' => MENU_CALLBACK, );