This API allows customers to retrieve a single count for a every domain in their account. This allows customers to identify domains based on a stat. (IE: Most active, Most Bounces, etc..)
GET /accounts/totals
Parameter | Description |
---|---|
event | Name of the event to retrieve stats for; can repeat |
timestamp | The timestamp you wish to retrieve stats for (Format is 'Mon, 26 Jan 2018 17:00:00 UTC') |
resolution | The resolution you wish to retrieve (Valid options are 'hour', 'day' , 'month') |
GET http://api.mailgun.net/v3/account/totals?event=accepted
{
"resolution": "day",
"stats":{
"mg.example.com":[
{
"time": "Tue, 22 Jan 2019 00:00:00 UTC",
"accepted":{"incoming": 0, "outgoing": 0, "total": 0}
}
]
},
"timestamp": "Tue, 22 Jan 2019 00:00:00 UTC"
}
The service that implements this call will have to perform the following
- Given the account id provided by flagman header
X-Account-ID
make a call to the registry server to retrieve a list of domain names and ids for this account. - Make a call for each domain id to a data provider to retrieve stats for each individual domain by id.
- Compile the results into a JSON payload, resolving domain id's back to names before returning the result.
Notes: Step 2 should be performed by sending requests for each domain simultaneously and asynchronously waiting for responses. If the service is talking with scout, or is talking directly with cassandra this is the most effecient and performant method.
- (thrawn01) Putting this API in scout is not presupposed, it can as easily and performantly be implemented in another service, provided the other service can make simultaneous async calls to scout. However, I leave that decision to the analytics team, as they will need to deal with scouts additional dependency on the registry service.