Reputation: 1326
I'm just learning a little bit about APIs and I just wanted to figure out how I could schedule an API to make a specific call automatically. The situation that I would like to solve is this: I'm using SendGrid to help me to deliver mail from a contact form on my website, but I've been noticing that some emails aren't delivered but are saved on sendgrid's servers for 7 days. I'd like to use their API to save all of the email records into a database on my website so I can review them every so often to find out if there are any that emails that haven't come through.
The only way I know how to do this is to create a website like this:
$records = connection_to_sendgrid_database;
foreach ($records as $record) {
if ($record->id is not in this database) {
add the whole record into the database;
}
}
And then I would have to visit this page every 7 days to make sure I'd get all of the email records.
I'm sure there's a better way of doing this. Unfortunately I don't know much about programming applications that could do it for me, but it seems like automatic API calls must be something that's done all the time. Could someone tell help me to understand how this would normally be done?
Thanks so much for your help!
Upvotes: 3
Views: 1569