Xojo Plugin Requires Chilkat v11.0.0+
Xojo Plugin
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 Xojo Plugin Downloads
Dim success As Boolean
success = False
// Assumes Chilkat is unlocked. See Global Unlock Sample.
Dim vault As New Chilkat.Secrets
vault.Location = "local_manager"
vault.AutoSplit = True
Dim entry As New Chilkat.JsonObject
success = entry.UpdateString("appName","ConstantContactV3")
success = entry.UpdateString("service","OAuth2")
success = entry.UpdateString("username","my-account")
Dim tokens As New Chilkat.JsonObject
Dim loaded As Boolean
loaded = vault.GetSecretJson(entry,tokens)
If (loaded <> True) Then
System.DebugLog("Run the desktop authorization example using this account and store.")
Return
End If
If (tokens.JsonTypeOf("access_token") <> 1) Then
System.DebugLog("The saved authorization has no access token.")
Return
End If
Dim http As New Chilkat.Http
http.RequireSslCertVerify = True
http.AuthToken = tokens.StringOf("access_token")
Dim resp As New 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
System.DebugLog("Contact ID not found in this account.")
Return
End If
If ((success <> True) Or (resp.StatusCode <> 204)) Then
System.DebugLog("Expected HTTP 204. Received " + Str(resp.StatusCode))
If (resp.StatusCode = 401) Then
System.DebugLog("Refresh the saved access token or authorize again.")
End If
Return
End If
System.DebugLog("Contact deleted and list memberships removed.")