'RESTful web services', 'description' => 'Configure resources and entities that are exposed as web API.', 'page callback' => 'drupal_get_form', 'page arguments' => array('rest_admin_form'), 'access arguments' => array('administer site configuration'), 'file' => 'rest.admin.inc', ); return $items; } /** * Implements hook_permission(). */ function rest_permission() { $permissions = array(); if (drupal_container()->has('plugin.manager.rest')) { $manager = drupal_container()->get('plugin.manager.rest'); $resources = config('rest.settings')->get('resources'); if ($resources && $enabled = array_intersect_key($manager->getDefinitions(), $resources)) { foreach ($enabled as $key => $resource) { $plugin = $manager->getInstance(array('id' => $key)); $permissions = array_merge($permissions, $plugin->permissions()); } } } return $permissions; } /** * Implements hook_help(). */ function rest_help($path, $arg) { switch ($path) { // Main module help for the REST module case 'admin/help#rest': $output = ''; $output .= '
' . t('The REST module provides a framework for exposing Drupal\'s data structures as RESTful web services. It can be used to read and write resources remotely, such as entity types like nodes or users. For more information, see the online handbook entry for the RESTful web services module.', array('@rest' => 'http://drupal.org/documentation/modules/rest')) . '
'; $output .= '' . t('This page allows you to expose resources using Drupal\'s REST API. That enables external clients to interact with your Drupal installation via a machine readable interface. All entity types are available for such operations while contributed modules can provide more.') . '
'; $output .= 'curl -H "Accept: application/hal+json" --include --request GET --cookie ' . session_name() . '=' . session_id() . ' ' . url('entity/node/5', array('absolute' => TRUE)) . '
curl --include --request DELETE --cookie ' . session_name() . '=' . session_id() . ' ' . url('entity/node/5', array('absolute' => TRUE)) . '
' . t('Note: Session information of the current user is shown here, make sure that you have the permission to use the web API to get and delete nodes.', array('@permissions' => url('admin/people/permissions', array('fragment' => 'module-rest')))) . '
'; return $output; } }