In this post, we'll describe some of the operations you'll need in order to setup your Campaign using the REST API.
This is the first step in the series : REST API : Sending Email to a Segment or List of Contacts.
In our example, we're working with a Segment and an Email. In order to create our Campaign, we'll need to first identify the Segment and Email that will be used.
See picture below for details :
Please note that a complete working sample of the code is available here on Github.
Searching for Segments
Let's look at a simple example to search for and retrieve a list of Segments using the REST API.
We'll provide a function, which given a search term, page and pageSize, will return a list of matching Segments.
publicList<Segment> SearchSegments(string searchTerm,int page,int pageSize) { RestRequest request = new RestRequest(Method.GET) { RequestFormat = DataFormat.Json, Resource = string.Format("/assets/contact/segments?search={0}&page={1}&count={2}", searchTerm, page, pageSize) }; IRestResponse<RequestObjectList<Segment>> response = _client.Execute<RequestObjectList<Segment>>(request); List<Segment> segments = response.Data.elements; return segments; }
The model for the Segment object used in this sample is available here on Github.
The complete working sample is available here on Gitbhub.
Searching for Emails
We already have a post discussing how to Create and Manage Email using the REST API.
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