From c25950fe93c4fb472bb0bfb3dbfb0192fe1334f1 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Sat, 20 Jul 2013 02:13:25 +0100
Subject: [PATCH] Issue #2031647 by linclark: Provide minimal default rest
 configuration.

---
 core/modules/rest/config/rest.settings.yml | 17 +++++++++-
 core/modules/rest/rest.module              | 37 +---------------------
 2 files changed, 17 insertions(+), 37 deletions(-)

diff --git a/core/modules/rest/config/rest.settings.yml b/core/modules/rest/config/rest.settings.yml
index c9d1b12eeb3e..2780a6d9b782 100644
--- a/core/modules/rest/config/rest.settings.yml
+++ b/core/modules/rest/config/rest.settings.yml
@@ -1 +1,16 @@
-resources: { }
+# Enable all methods on nodes.
+resources:
+  entity:node:
+    GET: { }
+    POST: { }
+    PATCH: { }
+    DELETE: { }
+
+# To enable only specific formats for an operation, list the supported_formats.
+# For example, the following config makes JSON the only format available for
+# node GET requests.
+#   resources:
+#     entity:node:
+#       GET:
+#         supported_formats:
+#           - json
diff --git a/core/modules/rest/rest.module b/core/modules/rest/rest.module
index 28b33cbab9a6..9fe2674860cf 100644
--- a/core/modules/rest/rest.module
+++ b/core/modules/rest/rest.module
@@ -28,46 +28,11 @@ function rest_permission() {
  */
 function rest_help($path, $arg) {
   switch ($path) {
-    // Main module help for the REST module
+    // Main module help for the REST module.
     case 'admin/help#rest':
       $output = '';
       $output .= '<h3>' . t('About') . '</h3>';
       $output .= '<p>' . 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 <a href="@rest">RESTful web services module</a>.', array('@rest' => 'http://drupal.org/documentation/modules/rest')) . '</p>';
-      $output .= '<h3>' . t('Configuration') . '</h3>';
-      $output .= '<dl>';
-      $output .= '<dt>' . t('Enabling serialization modules') . '</dt>';
-      $output .= '<dd>' . t('REST module depends on the serialization module, which provides JSON and XML representations by default. To get other serializations, you can enable modules such as the HAL module.') . '</dd>';
-      $output .= '</dl>';
-      $output .= '<dl>';
-      $output .= '<dt>' . t('Exposing resources') . '</dt>';
-      if (module_exists('config')) {
-        $output .= '<dd>' . t('Copy the following example settings to <em>rest.settings.yml</em> in the staging configuration directory, edit as needed and <a href="!url">import the new configuration</a>.', array(
-          '!url' => url('admin/config/development/sync'),
-        )) . '</dd>';
-      }
-      else {
-        $output .= '<dd>' . t('Copy the following example settings to <em>rest.settings.yml</em> in the staging configuration directory, edit as needed and import the new configuration.') . '</dd>';
-      }
-      $output .= "<dd><pre># Example configuration for enabling REST resources.
-resources:
-  # Enable the node resource.
-  'entity:node':
-    # Enable reading nodes in all formats known.
-    GET: { }
-</pre></dd>";
-      $output .= '</dl>';
-      $output .= '<dl>';
-      $output .= '<dt>' . t('Granting permissions') . '</dt>';
-      $output .= '<dd>' . t('The <a href="@permission-rest">permissions page</a> allows you to determine what user roles may access a web service operation.', array('@permission-rest' => url('admin/people/permissions', array('fragment' => 'module-rest')))) . '</dd>';
-      $output .= '</dl>';
-      $output .= '<h3>' . t('Example uses') . '</h3>';
-      $output .= '<dl>';
-      $output .= '<dt>' . t('An HTTP GET request can be used to get a node') . '</dt>';
-      $output .= '<dd><code>curl -H "Accept: application/hal+json" --include --request GET --cookie ' . session_name() . '=' . session_id() . ' ' . url('entity/node/5', array('absolute' => TRUE)) . '</code></dd>';
-      $output .= '<dt>' . t('An HTTP DELETE request can be used to delete a node') . '</dt>';
-      $output .= '<dd><code>curl --include --request DELETE --cookie ' . session_name() . '=' . session_id() . ' ' . url('entity/node/5', array('absolute' => TRUE)) . '</code></dd>';
-      $output .= '</dl>';
-      $output .= '<p>' . t('Note: Session information of the current user is shown here, make sure that you have the <a href="@permissions">permission to use the web API</a> to get and delete nodes.', array('@permissions' => url('admin/people/permissions', array('fragment' => 'module-rest')))) . '</p>';
       return $output;
   }
 }
-- 
GitLab