Hello dear team,
I need an elementary example PHP code for adding and deleting contacts from my lists. But I can’t find anything besides using some Blue SDK anywhere on your website.
I need something trivial like:
$contactData = array(‹ first_name › => … ‹ last_name › => ‹ email › => … );
$apiKey = 'MY-API-JEY';
$apiUrl = 'https://api.brevo.com/v3/lists/2/contacts';
$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($contactData));
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey,
));
$response = curl_exec($ch);
curl_close($ch);
Whatever I try, I always get a « Key not found » error.
(And need some API example for the delete).
Thank you so much!