Getting Accepted Events / Applying Accepted Event Filter
c1am opened this issue · 4 comments
With PHP, I'm able to get stored events using the params below flawlessly. I try to change the 'event' => 'stored' to 'event' => 'accepted' but it doesn't seem to work and I'm wondering if anyone might know if there's something else in the code I need to change?
$url = "https://api.mailgun.net/v3/" . $this->mgDomain . "/events";
if (!empty($page_url)) {
$url = $page_url;
} else {
$url_params = array(
'event' => 'stored',
'recipients' => $curr_journaling_email,
'limit' => $limit,
'begin' => (date("d M Y H:i:s", strtotime($dt_start)) . " EST"),
'end' => (date("d M Y H:i:s", strtotime($dt_end)) . " EST"),
'pretty' => 'yes'
);
$url .= "?" . http_build_query($url_params);
}
$headers = array(
"Authorization: Basic " . base64_encode("api:" . $this->get_mg_key()),
"Accept: message/rfc2822"
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($curl);
$responseArray = json_decode($result, true);
Thank you in advance!
Hello @c1am
Do you have logs in your dashboard for the same period ?
Here is my example
I have logs
And after request with the code from library
$queryString = array(
'limit' => 100,
'pretty' => 'yes',
'event' => 'accepted'
);
# Issue the call to the client.
$result = $mgClient->events()->get($domain, $queryString);
I got my results
Also want to mention that I do no have a header of Accept
And my url looks next /v3/my-domain/events?limit=100&pretty=yes&event=accepted
@c1am Hello. Do you have any updates ?
Close the issue due to inactivity
Hello @oleksandr-mykhailenko, I've found out the solution was changing 'recipients' for stored events to 'recipient' for accepted events.