Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

The RESTful Web Services module now exposes entities on their canonical path, meaning that JSON or XML resources share the same canonical path with the HTML representation of an entity. Example: the HTML, JSON or XML representations of node 1 are available at /node/1. The routing system will determine the request format by examining the HTTP Accept header to deliver the resource representations. Example: a usual web browser request to /node/1 with Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 will return the standard HTML page of a node. A web service consumer request to /node/1 with Accept: application/hal+json will return the HAL JSON representation of the node.

Web service consumers need to change the URI paths from /entity/{entityType}/{id} to the canonical path of the entity. Example for nodes: /entity/node/{id} changes to /node/{id}.

Before

use Guzzle\Http\Client;
$client = new Client('http://drupal-8.localhost');
// If in a Drupal environment use the HTTP client service.
$client = \Drupal::httpClient()->setBaseUrl('http://drupal-8.localhost');
$request = $client->get('entity/node/1');
$request->addHeader('Accept', 'application/hal+json');
$response = $request->send()->json();
print_r($response);

After

use Guzzle\Http\Client;
$client = new Client('http://drupal-8.localhost');
// If in a Drupal environment use the HTTP client service.
$client = \Drupal::httpClient()->setBaseUrl('http://drupal-8.localhost');
$request = $client->get('node/1');
$request->addHeader('Accept', 'application/hal+json');
$response = $request->send()->json();
print_r($response);

More information on performing web service client requests can be found in the REST module documentation.

Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done

Comments

rszrama’s picture

Fantastic change; great work everyone. : )