Reputation: 316
Can someone help me what is the right mailgun API call to get the count of delivered messages between custom start and end date.
I have been trying with this but getting empty result:
curl.exe --user "api:key-XXXX" -G https://api.mailgun.net/v3/mydomain.com/stats/total -d event="delivered" -d start-date="Mon, 16 May 2016 00:00:00 GMT"
The maingun API documentation is here: https://documentation.mailgun.com/api-stats.html
MailGun support team is repeatedly pointing to the documentation but nobody is ready to provide me the workable API call. It is also surprising to see that MainGun administrative portal don't facilitate users to see number of emails sent between a range of dates!!! Anyway...
Upvotes: 1
Views: 908
Reputation: 44
An old one, but I'd like to answer for future reference.
MailGun support team is repeatedly pointing to the documentation but nobody is ready to provide me the workable API call.
They are correct - everything is in docs. In your particular case you are passing data with -d
parameter, but you should use --data-urlencode
instead (as shown in their API examples). Correct call:
curl --user "api:key-XXXX" -G https://api.mailgun.net/v3/mydomain.com/stats/total --data-urlencode event="delivered" --data-urlencode start-date="Mon, 16 May 2016 00:00:00 GMT"
Also, you might consider use start
parameter instead of legacy start-date
(recommended in their documentation).
It is also surprising to see that MainGun administrative portal don't facilitate users to see number of emails sent between a range of dates!!! Anyway...
At the moment of writing this answer, there is a Reporting tab that shows detailed stats for each type of event. It also allows you to select desired date range and filter results.
Upvotes: 1