Skip to content

Commit 6715347

Browse files
Merge pull request #503 from SparkPost/AC-2543
updated api docs for basic auth
2 parents 102439e + c63ed12 commit 6715347

File tree

2 files changed

+1250
-4134
lines changed

2 files changed

+1250
-4134
lines changed

content/api/index.apib

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ and follow [this guide](https://www.sparkpost.com/docs/getting-started/getting-s
1212

1313
All calls to the API need to start with the appropriate base URL:
1414

15-
| | |
16-
|-------------------|------------------------|
17-
| **SparkPost** |`https://api.sparkpost.com/api/v1` |
15+
| | |
16+
|------------------------------------------|---------------------------------------|
17+
| **SparkPost** |`https://api.sparkpost.com/api/v1` |
1818
| **[SparkPost EU](#header-sparkpost-eu)** | `https://api.eu.sparkpost.com/api/v1` |
1919

2020
For Enterprise accounts with their own endpoint, please contact your account manager for more information.
@@ -28,9 +28,10 @@ We accept just the API key:
2828
```
2929
"Authorization": "14ac5499cfdd2bb2859e4476d2e5b1d2bad079bf"
3030
```
31-
or Basic type and the API key:
31+
32+
We also support <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#basic_authentication_scheme" target="_blank">Basic authentication</a> where the `username` is the API key and the `password` is an empty string. For instance, the `Authorization` header's value is the word `Basic` followed by the base64-encoded string `14ac5499cfdd2bb2859e4476d2e5b1d2bad079bf:`.
3233
```
33-
"Authorization": "Basic 14ac5499cfdd2bb2859e4476d2e5b1d2bad079bf"
34+
"Authorization": "Basic MTRhYzU0OTljZmRkMmJiMjg1OWU0NDc2ZDJlNWIxZDJiYWQwNzliZjo="
3435
```
3536
3637
Make sure to store your API keys somewhere secure and never share them publicly.
@@ -46,16 +47,16 @@ For example:
4647
curl -v \
4748
-H "Content-Type: application/json" \
4849
-H "Authorization: 14ac5499cfdd2bb2859e4476d2e5b1d2bad079bf" \
49-
-X GET "https://api.sparkpost.com/api/v1/metrics/deliverability/aggregate?campaigns=testjob&from=2017-01-23T14:00&metrics=count_targeted,count_sent,count_accepted&timezone=America%2FNew_York&to=2017-06-23T15:50"
50+
-X GET "https://api.sparkpost.com/api/v1/metrics/deliverability?campaigns=testjob&from=2022-02-01T14:00&metrics=count_targeted,count_sent,count_accepted&timezone=America%2FNew_York&to=2022-02-02T15:50"
5051
```
5152
52-
Using the `-u` flag for authentication:
53+
Using the `-u` flag for Basic authentication:
5354
5455
```
5556
curl -v \
5657
-H "Content-Type: application/json" \
5758
-u 14ac5499cfdd2bb2859e4476d2e5b1d2bad079bf: \
58-
-X GET "https://api.sparkpost.com/api/v1/metrics/deliverability/aggregate?campaigns=testjob&from=2017-01-23T14:00&metrics=count_targeted,count_sent,count_accepted&timezone=America%2FNew_York&to=2017-06-23T15:50"
59+
-X GET "https://api.sparkpost.com/api/v1/metrics/deliverability?campaigns=testjob&from=2022-02-01T14:00&metrics=count_targeted,count_sent,count_accepted&timezone=America%2FNew_York&to=2022-02-02T15:50"
5960
```
6061
6162
### Postman

0 commit comments

Comments
 (0)