@@ -183,8 +183,6 @@ Sends an asynchronous request to the SparkPost API and returns a `SparkPostPromi
183183 * Type: ` Array `
184184 * Recipients to descreetly recieve a carbon copy of the transmission
185185
186- For complete list of endpoints, refer to [ API documentation] ( https://developers.sparkpost.com/api/ ) .
187-
188186## Examples
189187
190188### Send An Email Using The Transmissions Endpoint
@@ -269,6 +267,7 @@ More examples [here](./examples/):
269267- get (with retry logic)
270268
271269### Send An API Call Using The Base Request Function
270+
272271We provide a base request function to access any of our API resources.
273272``` php
274273<?php
@@ -279,17 +278,20 @@ use GuzzleHttp\Client;
279278use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
280279
281280$httpClient = new GuzzleAdapter(new Client());
282- $sparky = new SparkPost($httpClient, ['key'=>'YOUR_API_KEY']);
281+ $sparky = new SparkPost($httpClient, [
282+ 'key' => getenv('SPARKPOST_API_KEY'),
283+ 'async' => false]);
283284
284- $promise = $sparky->request('GET', 'metrics/ip-pools', [
285- 'from' => '2014-12-01T09:00',
286- 'to' => '2015-12-01T08:00',
287- 'timezone' => 'America/New_York',
288- 'limit' => '5',
289- ]);
285+ $webhookId = 'afd20f50-865a-11eb-ac38-6d7965d56459';
286+ $response = $sparky->request('DELETE', 'webhooks/' . $webhookId);
287+ print($response->getStatusCode());
290288?>
291289```
292290
291+ > Be sure to not have a leading ` / ` in your resource URI.
292+
293+ For complete list of resources, refer to [ API documentation] ( https://developers.sparkpost.com/api/ ) .
294+
293295## Handling Responses
294296The API calls either return a ` SparkPostPromise ` or ` SparkPostResponse ` depending on if ` async ` is ` true ` or ` false `
295297
0 commit comments