Will someone help me with the PHP code to authenticate my Sendgrid account connection and then delete a Marketing Campaign recipient via API?
From the help documentation, this appears to be the command line -- DELETE https://api.sendgrid.com/v3/contactdb/lists/{list_id}/recipients/{recipient_id} HTTP/1.1 -- but I can't figure out what to do with it, since it isn't regular PHP code. The only sample code I found pertained to Legacy Newletters (which I got to work) and not contacts used by Marketing Campaigns.
What are you using to interact with the API? cURL? You just need to make an HTTP
DELETE
request to the urlhttps://api.sendgrid.com/v3/contactdb/lists/{list_id}/recipients/{recipient_id}
, replacing{list_id}
and{recipient_id}
with the IDs of the list and the recipient.Here's an example of a function that will make a delete request for you with cURL: https://stackoverflow.com/a/17935536/401096