Search code examples
coldfusionsendgridcfmlcfclucee

Coldfusion Sendgrid API for call "re-subscribe" user email


  • Application Server : ColdFusion 11 & Lucee
  • OS : Windows 2012

Trying to call sendgrid API for re-subscribe user, sendgrid giving most of the languages code examples on sendgrid website but there is not example available for coldfusion. please find attached code and error screen shoot.

ERROR: Sendgrid API call

Code:

<cfhttp url="https://api.sendgrid.com/api/stats.getAdvanced.json" method="POST" result="returnStruct">
<cfhttpparam name="api_user" value="myAccountUserName" type="formfield">
<cfhttpparam name="api_key" value="mykeyExAmPlE" type="formfield">


Solution

  • <cfhttp url="https://api.sendgrid.com/v3/asm/suppressions/global/emailAddress@unsub.com" method="delete" result="returnStruct3"> <cfhttpparam name="Authorization" value="Basic #ToBase64('accountUserName:AccountPassword')#" type="header"> </cfhttp>