Access denied for user anonymous while accessing custom table data
Following up with an answer from our comments...

Here's an example custom service resource:

custom_data.module

function custom_data_services_resources() {
  $resources = array(
    'custom_data_resources' =&gt; array(
      'actions' =&gt; array(
        'getdata' =&gt; array(
          'help' =&gt; t('Gets custom data.'),
          'file' =&gt; array(
            'type' =&gt; 'inc',
            'module' =&gt; 'custom_data',
            'name' =&gt; 'custom_data.resource',
          ),
          'callback' =&gt; 'custom_data_getdata',
          'args' =&gt; array(
            array(
              'name' =&gt; 'data',
              'type' =&gt; 'array',
              'description' =&gt; 'The data dude.',
              'source' =&gt; 'data',
              'optional' =&gt; FALSE,
            )
          ),
          'access callback' =&gt; 'custom_data_access',
          'access callback file' =&gt; array(
            'type' =&gt; 'inc',
            'module' =&gt; 'custom_data',
            'name' =&gt; 'custom_data.resource',
          ),
          'access arguments' =&gt; array('access user profiles'),
          'access arguments append' =&gt; TRUE,
        ),
      ),
    ),
  );
  return $resources;
}


custom_data.resource.inc

function custom_data_getdata($data) {
  return array('foo' =&gt; $data['bar']);
}

function custom_data_access($permission) {
  return user_access($permission);
}


After that, just enable the custom resource under your endpoint's configuration and clear all of Drupal's caches. Then you can make a POST to:

?q=[my-endpoint]/custom_data_resources/getdata.json

If you need to send along custom arguments, I usually recommend a single array parameter, that way you can easily expand upon it and send as many variables/properties you need along with the payload:

{ "bar": 123 }

Which will then return to you:

{ "foo": 123 }

Don't forget to attach a header to your request with a name of X-CSRF-Token and value retrieved from: ?q=services/session/token