In this post, we'll show you how to activate a Campaign using the REST API. This is the 3rd step in the series Sending Email to a Segment or List of Contacts.

In the last step, we created the following Campaign :

 

https://lh6.googleusercontent.com/n9dFpMJMXgkAEevEjYXr45wHaUmURmvkeCPjiJHWTEgZRvCRnNdpz3L5XkhTasAkfEObFtHuy_lOdwkeabK8yzBY76HoP9kHUXQol95Y5kAWcOn-uS8

 

Assuming the ID of the new Campaign is 1, we'll create a function that will be responsible for activating the Campaign :

 

public Campaign ActivateCampaign (int campaignId)
        {
            RestRequest request = new RestRequest(Method.POST)
                                      {
                                          Resource = "/assets/campaign/activate/" + campaignId,
                                          RequestFormat = DataFormat.Json
                                      };

            IRestResponse<Campaign> response = _client.Execute<Campaign>(request);

            return response.Data;
        }


Note that a complete sample of the code is available here on Github.

The code call this function :

 

int campaignId=1;
Campaign campaign = _campaignHelper.ActivateCampaign(campaignId);


That's all there is to it. After the call completes, your Campaign will be active.

See picture below :

 

https://lh5.googleusercontent.com/atm3sONeioTzaCS8yUaN7OiSpOkXeFulYFcZc-qvl1L5d2zsAZwGWT_JkGBAWo8bnaWXXtRP86xnoO04JDFKebTEqTzn5MZgsk7IFmo-ESia2zdoyUY

 

Please note that the code samples referenced here are my own work and something that I've put together to try and help. I'll do my best to support it, but please understand that this code is not supported by Eloqua.

 

Thanks,

Fred