问题
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.
回答1:
What are you using to interact with the API? cURL? You just need to make an HTTP DELETE
request to the url https://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
来源:https://stackoverflow.com/questions/41816612/sendgrid-how-to-delete-a-single-marketing-campaign-recipient-with-api-and-php