In today's post we're going to share a Campaign helper project and demonstrate how to search for and retrieve Campaigns using the API.

The complete source for the project is available here on Github.

 

Let's start by creating a new instance of the CampaignHelper :

 

CampaignHelper campaignHelper = new CampaignHelper("site", "user", "password", "https://secure.eloqua.com/API/REST/1.0/");



 

Retrieving a Campaign by ID

If you know the ID of a Campaign in Eloqua, you can retrieve it using the following operation :

 

const int campaignId = 1;
Campaign campaign = campaignHelper.GetCampaign(campaignId);



 

The model for the campaign record is available here.

 

Searching for a Campaign by Name

If you want to search for a Campaign by name, you can use the following operation :

 

IRestResponse response = campaignHelper.GetCampaign("*", 1, 100);



 

Searching for a Campaign by CRM ID

If you know the ID of your Campaign in the CRM system, you can search for it using the following operation :

 

IRestResponse response = _campaignHelper.GetCampaign("crmId='70170000000Se4h'", 1, 1);



 

Please note that the 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