Classic ASP Requires Chilkat v11.0.0+
Classic ASP
Constant Contact V3: Delete a contact by ID
See more Constant Contact Examples
Use the ID of the contact selected for deletion. Deletion removes all list memberships and sets the deletion timestamp. Unsubscribing is a separate operation that changes permission to send. A successful delete returns HTTP 204 with an empty body. To bring the record back, see Restore a deleted contact. Authorize the app first and use the same credential store.
Constant Contact developer guide
Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
' Assumes Chilkat is unlocked. See Global Unlock Sample.
set vault = Server.CreateObject("Chilkat.Secrets")
vault.Location = "local_manager"
vault.AutoSplit = 1
set entry = Server.CreateObject("Chilkat.JsonObject")
success = entry.UpdateString("appName","ConstantContactV3")
success = entry.UpdateString("service","OAuth2")
success = entry.UpdateString("username","my-account")
set tokens = Server.CreateObject("Chilkat.JsonObject")
loaded = vault.GetSecretJson(entry,tokens)
If (loaded <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( "Run the desktop authorization example using this account and store.") & "</pre>"
Response.End
End If
If (tokens.JsonTypeOf("access_token") <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( "The saved authorization has no access token.") & "</pre>"
Response.End
End If
set http = Server.CreateObject("Chilkat.Http")
http.RequireSslCertVerify = 1
http.AuthToken = tokens.StringOf("access_token")
set resp = Server.CreateObject("Chilkat.HttpResponse")
' Obtain the selected contact ID from the email lookup example.
success = http.SetUrlVar("contactId","CONTACT_ID")
success = http.HttpNoBody("DELETE","https://api.cc.email/v3/contacts/{$contactId}",resp)
If (resp.StatusCode = 404) Then
Response.Write "<pre>" & Server.HTMLEncode( "Contact ID not found in this account.") & "</pre>"
Response.End
End If
If ((success <> 1) Or (resp.StatusCode <> 204)) Then
Response.Write "<pre>" & Server.HTMLEncode( "Expected HTTP 204. Received " & resp.StatusCode) & "</pre>"
If (resp.StatusCode = 401) Then
Response.Write "<pre>" & Server.HTMLEncode( "Refresh the saved access token or authorize again.") & "</pre>"
End If
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( "Contact deleted and list memberships removed.") & "</pre>"
%>
</body>
</html>