I'm adding Services integrations to the Room Reservations module. A service I need to expose is the times when reservations can be made. I found a function inside room_reservations.inc (the function is _room_reservations_facility_hours()) and created a action type of service pointing to that function.

The problem here is that only the administrator user can have access to the output of this web service, whenever another user (even with the Administrator role) consumes the service I receive a 403 error. Is there a way I can solve this?

The Service declaration

$room_service = array(
      'help'=>'Gets the hours and the days reservations can be made',

The callback function (which connects to _room_reservations_facility_hours())

function _room_reservations_service_get_open_hours(){
  $dates = _room_reservations_facility_hours(TRUE);
  $realDates = array();
      foreach ($dates as $key => $value) {
      //array_push($realDates, $dates[$key]);
        if ($i<8) {

  //$standarized[] = $dates;
  $standarized[] = $realDates;
  return $standarized;

Edit: I'm already using the CSRF Token as a header when consuming the service


Sounds like an authentication issues - have you read up on tokens? There's a couple of modules out there, one pretty recent, plus some doc:

https://www.drupal.org/project/services_token_access https://www.drupal.org/project/services_token https://www.drupal.org/node/2424977

  • I'm already using the CSRF Authentication Token, I'll update my question with this.
    – HaPK
    Nov 25 '15 at 17:42

Trying using access callback and access callback file instead:

          'access callback' => 'INSERT CALLBACK FUNCTION NAME HERE',
          'access callback file' => array(
            'type' => 'inc',
            'module' => 'room_reservations',
            'name' => 'includes/room_reservations.service',
  • Changed the 'callback' and 'file' arguments for the ones you told me and now the service always returns null
    – HaPK
    Nov 26 '15 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.