How can Intergate mailchipm api in asp.net wcf service.

81 views
Skip to first unread message

Rajnish Pandey

unread,
Feb 18, 2014, 5:02:32 AM2/18/14
to mailchimp-...@googlegroups.com
I have tired to implement mail-chimp in asp.net wcf  service for subscribe user email when he register in my site by iPhone.
I have download asp.net sample code use in web application it is working fine. But when we tried to implement same code in asp.net wcf service it give me error message "The remote server returned an error: (500) Internal Server Error."

I have used following code for post in wcf service.

 var bytes = Encoding.UTF8.GetBytes(data)
 using (var client = new WebClient())
  {
        client.Headers.Add("Content-
Type", "application/json");
       var response= client.UploadData("https://us7.api.mailchimp.com/2.0/0f6g65h03n/subscribe.json/","POST", bytes);
         return Encoding.Default.GetString(response);
  }

help me that how can I solve my issue.

Colt

unread,
Feb 18, 2014, 4:32:40 PM2/18/14
to mailchimp-...@googlegroups.com
Hey Rajnish,

While I'm not an expert on asp.net taking a look at the line containing the post data it appears that there is an invalid URL being used.

You'll want to post directly to the API via the API url which you did have, https://<dc>.api.mailchimp.com/2.0/GROUP/METHOD.returntype

In this case if you're trying to use list subscribe on our us7 datacenter, you'd want to try something like this for your post URL: https://us7.api.mailchimp.com/2.0/lists/subscribe.json 

Ending that URL in .json will designate your return data type
Reply all
Reply to author
Forward
0 new messages