I've seen various mentions of classic ASP samples in the forum, but where are they?
Any links i've found seem to go to 404 pages.
Are there any classic ASP samples?
Hey Brian, after our recent API update we removed the classic ASP sample, and plan on releasing a new version of it here in the next week or two. We'll announce it in the blog when it's available.
Has there been any progress on updating these ASP samples ?
I'm also desperate for these...!
I got bored waiting, so i put this together which seems to work OK for me. Thought it might help others.
I have this code as part of a "checkout" process...
' if the customer has indicated they want to be added to the mailing list, then call Campaign Monitor and add them
If Request.Form("chkAddToMailingList") <> "" Then
CM_API = addSubscriber(getListKeyFromCourseBookingId(Request.Form("MM_recordId")), Request.Form("strContactEmail"), Request.Form("strRecipientName"))
Basically, if the customer has ticked the box to be added to the mailing list it calls the function addSubscriber() and passes the mailing list key, the email address and name.
The addSubscriber function looks like this...
Function addSubscriber(strListKey, strEmail, strName)
postdata = "<?xml version=""1.0"" encoding=""utf-8""?>"
postdata = postdata & "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
postdata = postdata & "<soap:Body>"
postdata = postdata & " <Subscriber.Add xmlns=""http://api.createsend.com/api/"">"
postdata = postdata & " <ApiKey>ADD YOUR API KEY HERE</ApiKey>"
postdata = postdata & " <ListID>" & strListKey & "</ListID>"
postdata = postdata & " <Email>" & strEmail & "</Email>"
postdata = postdata & " <Name>" & strName & "</Name>"
postdata = postdata & " </Subscriber.Add>"
postdata = postdata & "</soap:Body>"
postdata = postdata & "</soap:Envelope>"
xmlhttp.open "POST","http://api.createsend.com/api/api.asmx" ,false
xmlhttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
xmlhttp.setRequestHeader "SOAPAction", """http://api.createsend.com/api/Subscriber.Add"""
set xmlhttp = nothing
Thanks bmbwd57, this helped me at lot. It seems CM is missing 'offiical' samples for classic ASP. I know it's an older technology but a lot of my client websites do use it. Any plans for the samples mentioned above CM? It looks like there used to be one but it got removed?
I've replied to your direct support request too, but thought I'd put a quick wrap up here. Using the first two resources to get basic xml requests going, you should then be able to use our documentation to to see what structure xml the endpoints for each method expect.