Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8861

Adding subscribers to a list in Mail Chimp 3.0 in KENTICO

$
0
0
It work with curlcurl --request POST \ --url 'https://us19.api.mailchimp.com/3.0/lists/439db5911d/members/' \ --user 'anystring:6d43f4b7e3b8271c2508ac6d3a0fc2ce-us19' \ --header 'content-type: application/json' \ --data '{@apikey@:@6d43f4b7e3b8271c2508ac6d3a0fc2ce-us19@,@email_address@:@myemail@gmail.com@,@status@:@subscribed@}' \ --include I want to create a widget to add subscribe to mailchimp JavaScriptSerializer serializer = new JavaScriptSerializer(); var info = new Info() { email_address = @myemail@gmail.com@, status = @subscribed@, apikey= @6d43f4b7e3b8271c2508ac6d3a0fc2ce-us19@ }; var infoJson = serializer.Serialize(info); string url = @@https://us19.api.mailchimp.com/3.0/lists/439db5911d/members@; HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Clear(); client.BaseAddress = new Uri(url); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(@application/json@)); var user = Convert.ToBase64String(Encoding.GetEncoding(@ISO-8859-1@).GetBytes(@anystring:6d43f4b7e3b8271c2508ac6d3a0fc2ce-us19@)); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(@Basic@, user); HttpResponseMessage response = client.PostAsJsonAsync(url, infoJson).Result; text.Text = response.ToString(); public class Info { public string email_address { get; set; } public string status { get; set; } public string apikey { get; set; } }It return status 400, anyone can help me?Here is responseStatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers: { X-Request-Id: a2269c5d-0ef0-4a81-865c-7f1fb21c3e40 Link: ; rel=@describedBy@ Connection: close Date: Mon, 06 Aug 2018 04:29:06 GMT Set-Cookie: _AVESTA_ENVIRONMENT=prod; path=/ Set-Cookie: _mcid=1.8049c88b78f20da02cd07d042d343aef; expires=Tue, 06-Aug-2019 04:29:06 GMT; Max-Age=31536000; path=/; domain=.mailchimp.com Server: openresty Content-Length: 370 Content-Type: application/problem+json; charset=utf-8 }

Viewing all articles
Browse latest Browse all 8861

Trending Articles