Enables the web service interface for a specific entity type.
string|FALSE $resource_type: The resource type that should get web API enabled or FALSE to disable all resource types.
protected function enableService($resource_type) {
// Enable web API for this entity type.
$config = config('rest');
if ($resource_type) {
$config
->set('resources', array(
$resource_type => $resource_type,
));
}
else {
$config
->set('resources', array());
}
$config
->save();
// Rebuild routing cache, so that the web API paths are available.
drupal_container()
->get('router.builder')
->rebuild();
// Reset the Simpletest permission cache, so that the new resource
// permissions get picked up.
drupal_static_reset('checkPermissions');
}