We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

Schedule Email Campaign

Occasional Participant

Schedule Email Campaign

I need a serious help.
Need help on scheduling campaign using asp.net. 
I have already configured my constant contact account to use api and I was success on using other api such as:

1. Retrieve Contact

2. AddContact

3. Read/Write ContactList


I was trying to schedule campaign and to do that I used HttpClient. I know have correct json data to post it. But when I make api call it always return Error:400, BadRequest.
My asp.net code looks like as below:


String jsonData = "{\"scheduled_date\":" + "\"2017-12-09T12:34:59Z\"}";
string requestPath = "emailmarketing/campaigns/"+id+"/schedules" + api;
string jsonContact = jsonData;
StringContent content = new StringContent(jsonContact, UnicodeEncoding.UTF8, "application/json");
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

HttpClient client = new HttpClient();
client.BaseAddress = new Uri(baseAddress); //baseAddress = https://api.constantcontact.com/v2/
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", bearerToken);
var response = client.PostAsync(requestPath, content).Result;


I am not sure whats going wrong in the code it always sends Error:400. Is there any other alternative to achieve it.


Thanks in advance.




There are a few different things that can cause a 400 error. What is the error response message that is being returned with the error code 400? For example, "Property was found but is not permitted at this location" or "Unable to parse JSON payload"


These will be key to determining why your call is being rejected.


David B.
Tier II API Support Engineer

Occasional Participant

Thanks for the response. I was able to fix the error. 

Developer Portal

View API documentation, code samples, get your API key.

Visit Page