Comment on page
Making a request
use Strata\Data\Http\Http;
$api = new Http('https://example.com/api/');
If you need to setup any See authentication
To make a request use a concrete method from the data provider, these are different for different types of providers. See data providers for documentation.
an available Data class. RestApi supports things like get and post, GraphQL has a query method. Full details on available methods appear below.
$response = $api->get('posts');
HTTP requests only run once you access data. For example:
$item = $response->getContents();
At this point the HTTP request is made and if an error occurs an exception is thrown.
Last modified 8mo ago