You are here

public function ExampleController::createPostAdvanced in HTTP Client Manager 8.2

Create post - Advanced usage.

Return value

array The service response.

1 string reference to 'ExampleController::createPostAdvanced'
http_client_manager_example.routing.yml in modules/http_client_manager_example/http_client_manager_example.routing.yml
modules/http_client_manager_example/http_client_manager_example.routing.yml

File

modules/http_client_manager_example/src/Controller/ExampleController.php, line 189

Class

ExampleController
Class ExampleController.

Namespace

Drupal\http_client_manager_example\Controller

Code

public function createPostAdvanced() {
  $this
    ->checkTokenModule();

  // The whole HTTP Service Api Wrappers Factory is being used just to show
  // you an alternative way for accessing the api wrappers.
  $api = $this->apiFactory
    ->get('posts');

  // Here we are using an HTTP Config Request just for example purposes.
  $response = $api
    ->httpConfigRequest('create_post');
  return [
    '#type' => 'markup',
    '#markup' => '<pre>' . print_r($response, TRUE) . '</pre>',
  ];
}