I have a string which could be an API call, like '/node/1'. From within my module, how do I get the API response? That is, get the json the API call would generate, but without leaving the current bootstrapped session?

There is an example at https://github.com/RESTful-Drupal/restful/wiki/Using-the-API-within-Drupal but it is for D7 and includes functions no longer in D8.

Comments

Utkarsh Harshit’s picture

Hi,
Why can't you use http_client service or Restful webservice module.
It might help you.

joe casey’s picture

That would require another full bootstrap of Drupal, which is what I'm trying to avoid.