bat_api.services.inc 2.35 KB
Newer Older
1 2 3 4 5 6
<?php


/**
 * Implements hook_default_services_endpoint().
 */
istos's avatar
istos committed
7
function bat_api_default_services_endpoint() {
8 9 10 11 12
  $export = array();

  $endpoint = new stdClass();
  $endpoint->disabled = FALSE; /* Edit this to true to make a default endpoint disabled initially */
  $endpoint->api_version = 3;
istos's avatar
istos committed
13
  $endpoint->name = 'bat_api';
14
  $endpoint->server = 'rest_server';
Nicolò Caruso's avatar
Nicolò Caruso committed
15
  $endpoint->path = 'bat/v2';
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
  $endpoint->authentication = array(
    'services' => 'services',
  );
  $endpoint->server_settings = array(
    'formatters' => array(
      'json' => TRUE,
      'bencode' => FALSE,
      'jsonp' => FALSE,
      'php' => FALSE,
      'xml' => FALSE,
      'yaml' => FALSE,
    ),
    'parsers' => array(
      'application/json' => TRUE,
      'application/vnd.php.serialized' => TRUE,
      'application/x-www-form-urlencoded' => TRUE,
      'application/x-yaml' => TRUE,
      'application/xml' => TRUE,
      'multipart/form-data' => TRUE,
      'text/xml' => TRUE,
    ),
  );
  $endpoint->resources = array(
istos's avatar
istos committed
39
    'events' => array(
40 41 42 43 44 45 46 47 48
      'operations' => array(
        'index' => array(
          'enabled' => '1',
        ),
        'update' => array(
          'enabled' => '1',
        ),
      ),
    ),
istos's avatar
istos committed
49
    'events-calendar' => array(
Nicolò Caruso's avatar
Nicolò Caruso committed
50 51 52 53 54 55
      'operations' => array(
        'index' => array(
          'enabled' => '1',
        ),
      ),
    ),
istos's avatar
istos committed
56
    'units' => array(
57 58 59 60
      'operations' => array(
        'index' => array(
          'enabled' => '1',
        ),
istos's avatar
istos committed
61 62 63 64 65 66 67 68
        'update' => array(
          'enabled' => '1',
        ),
      ),
      'actions' => array(
        'add' => array(
          'enabled' => '1',
        ),
69 70
      ),
    ),
istos's avatar
istos committed
71
    'units-calendar' => array(
72 73 74 75 76 77
      'operations' => array(
        'index' => array(
          'enabled' => '1',
        ),
      ),
    ),
Nicolò Caruso's avatar
Nicolò Caruso committed
78 79 80 81
    'user' => array(
      'actions' => array(
        'login' => array(
          'enabled' => '1',
istos's avatar
istos committed
82 83 84 85 86
          'settings' => array(
            'services' => array(
              'resource_api_version' => '1.0',
            ),
          ),
Nicolò Caruso's avatar
Nicolò Caruso committed
87 88 89 90 91 92 93 94 95
        ),
        'logout' => array(
          'enabled' => '1',
          'settings' => array(
            'services' => array(
              'resource_api_version' => '1.0',
            ),
          ),
        ),
istos's avatar
istos committed
96 97 98
        'token' => array(
          'enabled' => '1',
        ),
Nicolò Caruso's avatar
Nicolò Caruso committed
99 100
      ),
    ),
101 102
  );
  $endpoint->debug = 0;
istos's avatar
istos committed
103
  $export['bat_api'] = $endpoint;
104 105 106

  return $export;
}