If you are using SparkPost for email delivery and wish to check message events, you can view message events information using the Wget utility, which is available for Linux, OS X, and Microsoft Windows systems. The man page for the command on a CentOS Linux system is here and the home page for the utility is at GNU Wget. Alternatively, for information on how to use curl, instead, see SparkPost - Addresses Associated With Bounced Email.
To download message events information for the last hour using the SparkPost
application programming interface (API) with Wget, you can use a command
similar to wget https://api.sparkpost.com/api/v1/message-events?events=bounce,out_of_band --header="Authorization: my_API_key" --header="Accept:
application/json"
where my_API_key is an API key provided to you
by SparkPost. However, if you haven't granted access to message events for
that key, you will receive a "ERROR 403: Forbidden" error as shown below.
The API key, which in this case is a dummy key, is provided by sending a
custom header that includes Authorization: my_API_key
:
$ wget https://api.sparkpost.com/api/v1/message-events?events=bounce,out_of_band --header="Authorization: d12cc66a1a29755ef10fc1a1450d96dc23495970" --header="Ac cept: application/json" --2016-09-04 21:44:34-- https://api.sparkpost.com/api/v1/message-events?events=bounce,out_of_band Resolving api.sparkpost.com (api.sparkpost.com)... 54.191.102.120, 54.69.65.44, 52.40.18.107 Connecting to api.sparkpost.com (api.sparkpost.com)|54.191.102.120|:443... conne cted. HTTP request sent, awaiting response... 403 Forbidden 2016-09-04 21:44:39 ERROR 403: Forbidden. $
To grant a key permission to access message event data, log into your SparkPost account at the SparkPost website, then click on Account, select API Keys and for an existing or new API key check the check box next to "Message Events: Read-only".
[ More Info ]