Visual basic version of API

284 views
Skip to first unread message

Heather

unread,
Feb 28, 2012, 10:56:37 AM2/28/12
to MailChimp API Discuss
I am not a techie, but I can manipulate VB code. I want to create a
routine that allows any of my clients to upload a selection of
contacts from an Access database (our product "CONTACTfile") to
MailChimp by a click of a button. (At the moment, they export to .csv
or Excel, and then upload as a separate process.) The routine (I
guess) will need to identify who they are, log them on, then upload a
previously-created set of contact records stored in an Access query
(or table if necessary). Do you have any such code? I have created a
similar set for another company, but couldn't get it to work without
their help, and as yet they have not given it... perhaps you can? It
would be so neat, for both our organisations, if we could provide
this!

Here's the code so far. It doesn't work because i couldn't figure out
how to stream an xml file. Also, it has a unique API for each user,
which isn't really what's needed, although it would be OK if you're
prepared to provide them as required:
Function UploadData(StrAPIKey, strXml)
Dim xmlhttp, sResponse, xmllength
On Error GoTo Error_UploadData
Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST", "http://etc", False
xmlhttp.setRequestHeader "Content-Type", "application/xml"
xmlhttp.setRequestHeader "ApiKey", StrAPIKey
xmllength = Len(strXml)
xmlhttp.setRequestHeader "Content-Length", xmllength
xmlhttp.send "Body=" & strXml
sResponse = xmlhttp.responseText
Set xmlhttp = Nothing
UploadData = sResponse
Exit Function
Error_UploadData:
SendMessage = "Error"
MsgBox "There has been a problem with uploading. Please check that
you have an Internet Connection.", , "Error"
End Function

jesse

unread,
Feb 28, 2012, 11:00:32 AM2/28/12
to MailChimp API Discuss
Um, that doesn't work because it's not supported and you kind of just
made up the functionality. Things to do to get started:

* read the intro sections here that talk about endpoints, input/output
parameters, etc. http://apidocs.mailchimp.com/api/1.3/
* take a look at the .Net wrappers if you can use that -
http://apidocs.mailchimp.com/api/downloads/#dotnet
* if not, take a look at the classic ASP examples -
http://apidocs.mailchimp.com/api/downloads/#examples


jesse

Heather

unread,
Mar 1, 2012, 6:22:37 AM3/1/12
to MailChimp API Discuss
If VB isn't supported then I might as well give up! Please let me
know if the situation changes.
Reply all
Reply to author
Forward
0 new messages