@@ -183,8 +183,6 @@ Sends an asynchronous request to the SparkPost API and returns a `SparkPostPromi
183
183
* Type: ` Array `
184
184
* Recipients to descreetly recieve a carbon copy of the transmission
185
185
186
- For complete list of endpoints, refer to [ API documentation] ( https://developers.sparkpost.com/api/ ) .
187
-
188
186
## Examples
189
187
190
188
### Send An Email Using The Transmissions Endpoint
@@ -269,6 +267,7 @@ More examples [here](./examples/):
269
267
- get (with retry logic)
270
268
271
269
### Send An API Call Using The Base Request Function
270
+
272
271
We provide a base request function to access any of our API resources.
273
272
``` php
274
273
<?php
@@ -279,17 +278,20 @@ use GuzzleHttp\Client;
279
278
use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
280
279
281
280
$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]);
283
284
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());
290
288
?>
291
289
```
292
290
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
+
293
295
## Handling Responses
294
296
The API calls either return a ` SparkPostPromise ` or ` SparkPostResponse ` depending on if ` async ` is ` true ` or ` false `
295
297
0 commit comments