Skip navigation
1 2 3 4 5 Previous Next

Code It

141 posts
fsakr

Securing your Software

Posted by fsakr May 17, 2013

This was originally posted in the Tips and Tricks thread and I thought it would be helpful to share with the Code It group.

 

The best way to secure your product, is building security in from the start. Most businesses view security as a priority, but software developers rarely apply this in their daily work and often find security vulnerabilities too late in the development lifecycle. Large organizations typically require exhaustive security requirements while smaller companies may cover only the essentials and both can provide very different levels of security. The problem is : big or small, we're all exposed to the same vulnerabilities and whether you're building web applications or server side architectiure, security should play an integral part of the software lifecycle.

 

Almost all software security vulnerabilities are the result of poor design and engineering. Programmers focus on building features and sometimes defer security to separate departments in the organization - those focused on security. While these teams are great, they don't have the same insight into the design or visibility into the source code. Developers are ultimately responsible for securing their software. As the complexity of the software increases, so does the trouble in managing the risk. To make life easier, build in security from the requirements phase (use cases and abuse cases) to the final stage of analysis of feedback received from the field (security breaks).

 

When planning and building software, it helps to understand how an attacker thinks and how they would exploit it. Attackers are pragmatic and tend to have a lot of free time. If functionality is about what an application can do, security is about what an application should not do. Software developers should know and understand the most commonly used attack patterns and should be familiar with more comprehensive lists applicable to their space. Knowledge is the best defense.

 

The following list is not exhaustive, but covers some of the most common types of attack patterns :

Cross-site scripting (XSS)

Cross-site request forgery (CSRF)

Argument injection (SQL injection)

Command delimiters

Simple script injection

Failure to handle errors

Race Conditions

HTTP query strings

User-supplied variable

URL encoding

Direct access to executable files

Sessions and blind trust

User controlled filename

Parameter expansion

Relative path traversal

Buffer overflow

Programs that access resources

 

There are many techniques to prevent these attacks, including threat modeling, good coding standards, code reviews, static code analysis, runtime monitoring, and many more. Traditionally, the focus of software security was on the OS and network layers, but recently more attention is focusing on web applications and browsers. As a developer, the best thing to do is be aware and build security in at every stage.

 

Software security can be a thankless job. When the system is secure, everything behaves as expected and you’re rarely noticed. But as soon as an attack occurs, all the lights will shine on you.

 

Better be prepared.

 

Fred

We are pleased to announce that version 1.0 of the open source C# Rest client is now available via NuGet. And sources, documentation as well as a community site are now hosted on Codeplex.

 

Documentation | Community

 

 

 

For anyone currently using the sources on Github, note that we’ll continue to maintain both sites, but NuGet will be the recommended source for using the client in your own projects.

 

Getting the C# Rest Client via NuGet

  1. Using the NuGet Package Manager Console :
    • Install-Package Eloqua.Api.Rest.ClientLibrary
  2. Using Visual Studio 2012
    • Right-click on the project's references
    • Select "Manage NuGet Package..."
    • Search for "Eloqua Client"

 

 

We hope that you find this helpful and please let me know if you have any questions.


Thanks,

Fred

 

Disclaimer

Please note that these are my own tools and are meant to help developers build on the Eloqua platform and while I am happy to answer questions and provide support, note that Eloqua is not responsible for and cannot support this product.

Now that you've built your Cloud Connector, it's time to get your service "installed" in Eloqua, so that it can be chosen in the cloud connector step on the Canvas or in Program Builder.

 

Let's take a look at how an Eloqua Customer Administrator manages cloud connectors in the application.

 

Under Setup...Database, there is an icon titled Cloud Connector.

CloudConnectorSetup.PNG

Clicking on this icon will take you to the Cloud Connector Management area.

CloudConnectorManagement.png

 

On this screen, you will see the Current Registered Services table.  This is where you want your new connector to appear, as it is these connectors that appear in the select list on the program step.


In order to register a new cloud connector service, the Customer Administrator will need the following three (3) pieces of information:

 

    • Service Name - a name for the connector (this is the friendly name that will show in the drop-down when setting up the step)
    • Service URL: the URL to your configuration page.  This URL must ask for STEP_ID and COMPANY.  When the user clicks the configuration button from the step, Eloqua will call your URL and pass the Step ID and Eloqua Company to you as parameters.

               For Example: https://myconnectorservice.com/config.aspx?StepID={STEP_ID}&Company={COMPANY}

    • Unique Id:  a unique name for your connector (this must be unique in the Current Registered Services table/list.

 

Once your service (connector) is "installed", when the user creates a Cloud Connector step, they will see your connector in the list, and be able to select it, then click the configuration button to set it up.

Canvas2.png

You can then take the STEP_ID and COMPANY parameters that were sent, and use those to aid in the configuration.  This eliminates the need for the user to provide your app with the Company and Step, which would be needed if they were using the Manual setup (by clicking the check-box instead of selecting from the list).

 

Things to keep in mind:

 

  • Only an Eloqua Customer Administrator can see and access the Cloud Connector Management area in an Eloqua install.
  • Your URL *MUST* request the STEP_ID and COMPANY, but you can choose whether or not to use it.
  • You do not need to install your connector in Eloqua, this is optional.  The user can check the Manual box, and then go to your setup page on their own and enter the Step ID and other required information.

In previous posts, we looked at Eloqua API How To: Create and Retrieve a Data Card and Eloqua API How To: Mapping a Data Card to a Contact.  This time we will look at how to Update an existing Custom Data Object (or Data Card).

 

The code below will show you how to first retrieve the Data Card we want to update, modify a field value, then write that back to Eloqua.  Finally, we will pull back the DataCard and check the new value to confirm it was updated successfully.

 

Once again, I will be assuming that the code found Connecting to the Eloqua API - Generic Setup is being used to establish a connection to the Eloqua API.  It is also assumed that you know the ID of both the Data Card Set and Data Card that you wish to update, as well as the internal name of any field(s) to be updated.

 

As before, we will be using the EloquaService API. For more information on which API to use for specific functions, see Eloqua SOAP API - Which one do I use?.

 

Now, the code...

 

   class UpdateDataCard
    {
        static void Main()
        {
               var dataCardIDs = new int[1];
               string oldVal = "";
            
               try
               {
                    var service = new EloquaInstance("instance", "userid", "password");

                    // Build a DataCardSet Entity Type object - (the ID is the ID of an existing DataCardSet in Eloqua)
                    EntityType entityType = new EntityType { ID = 55, Name = "DataCardSet", Type = "DataCardSet" };

                    // Set the ID of the DataCard Entity
                    dataCardIDs[0] = 301677;

                    // Create a new list containing the fields you want populated
                   List<string> fieldList = new List<string>();

                    // Add the DataCard’s Title to the field list (this is the field we will update)
                   fieldList.Add("Title1");

                    // Build a Dynamic Entity array to store the results
                    DynamicEntity[] retrievedEntities;

                    // If the field list is empty - the request will return all Entity Fields
                   // Otherwise, only fields defined in the field list are returned
                   retrievedEntities = service.ServiceProxy.Retrieve(entityType, dataCardIDs, fieldList.Count == 0 ? null : fieldList.ToArray());

                    // Make sure a result was found
                    if (retrievedEntities.Length > 0)
                    {
                         foreach (DynamicEntity dynamicEntity in retrievedEntities)
                         {
                             //Save the old value so that we can confirm the change
                             oldVal = dynamicEntity.FieldValueCollection["Title1"];
                             //Update the value
                             dynamicEntity.FieldValueCollection["Title1"] = "A new value!";
                         }

                         //Perform the Update
                    service.ServiceProxy.Update(retrievedEntities);

                       Console.WriteLine("DataCard Updated Successfully!");
                    }

               //Now, pull the card again to make sure it updated
                retrievedEntities = service.ServiceProxy.Retrieve(entityType, dataCardIDs, fieldList.Count == 0 ? null : fieldList.ToArray());

               // Make sure a result was found
                if (retrievedEntities.Length > 0)
                {
                    foreach (DynamicEntity dynamicEntity in retrievedEntities)
                    {
                        Console.WriteLine(String.Format("Title was changed from \"{0}\" to \"{1}\"", oldVal, dynamicEntity.FieldValueCollection["Title1"]));
                    }
                         // Customize your own error handling
                  }
            catch (System.ServiceModel.FaultException ex)
            {
                // Catch Service Model Fault Exceptions
                Console.WriteLine(String.Format("Reson: {0}", ex.Reason.ToString()));
                Console.WriteLine(String.Format("Fault Type: {0}", ex.GetType().ToString()));
                Console.WriteLine(String.Format("Fault Code: {0}", ex.Code.Name.ToString()));
            }
          catch (Exception ex)
            {
                // Catch System Exceptions
                Console.WriteLine(String.Format("Exception Message: {0}", ex.Message.ToString()));
            }

            // Wait for user input before stepping out.
            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();

        }
    }


When the program is run, a console window will pop up showing the results as seen below.


fileCUserstfields.png

fsakr

Eloqua API Chart

Posted by fsakr Jan 3, 2013

The following chart identifies some API operations available with different versions of the Eloqua product. Please note that the document is not exhaustive.

 

 

E10E9RESTSOAP
Core ObjectsCreateRetrieveUpdateDeleteCreateRetrieveUpdateDelete
Accounts

X

X

X

X

X

X

X

X

XX
Activities

X

X

XX
Campaigns

X

X

X

X

X

X
Contacts

X

X

X

X

X

X

X

X

XX
Contact Fields

X

X

X

X

X

XX
Contact Lists

X

X

X

X

X

X
Content Sections

X

X

X

X

X
Custom Objects Metadata

X

X

XX
Custom Objects Data

X

X

X

X

X

X

XXXX
EmailsX

X

XXX

X

XXX
Email Deployment

X

X

 

 

X

 

XX
Forms

X

X
Form DataX

X

XX

X

X

X

X

XX
Landing Pages

X

X

X

X

X
Microsites

X

X

X

X

X
Prospects

X

X

X

X

X
Users

X

X
VisitorsXXXX

X

X

X

X

X

 

We hope that you find this helpful.

Recently, one of our partners developed a Ruby client for the Eloqua API.

 

If you are using Ruby to build on the Eloqua platform, you will definitely want to check it out.

 

Code is available here kapost/eloqua_api · GitHub

 

Gem is publicly available here eloqua_api | RubyGems.org | your community gem host

 

Happy coding!

 

Please note, this code is not supported by Eloqua, as it was developed by a third party.

In this post, we'll show you how to retrieve Activity data using the SOAP API. We'll assume that you're already familiar with how to connect to the API, but please see the following post (Connecting to the API) for more information.

 

The API exposes activities for the following assets :

  • Email
    • Email Open
    • Email Send
    • Email Subscribe
    • Email Unsubscribe
    • Email Click Through
  • Form
  • Web

 

The response for each activity will include a dictionary of details, related to the activity type.

 

For example, the Email Send activity will contain the following details :

  • Email Web Link
  • Email Name
  • Email Recipient ID
  • Subject Line

 

Let's look at a quick sample for retrieving some Email Send Activities :

 

We'll start by creating a new instance of the Eloqua Service :

 

            // Create a new instance of the service proxy
            var service = new EloquaService.EloquaServiceClient();
            service.ClientCredentials.UserName.UserName = "site\\user";
            service.ClientCredentials.UserName.Password = "password";

 

Next, we'll execute a request to list all of the Activity Types available :

 

            var types = service.ListActivityTypes();
            foreach (var type in types.ActivityTypes)
            {
                Console.WriteLine(type);
            }

 

Note that you will need to have a known Contact in order to retrieve activity data. Let's look at a simple request to retrieve a Contact by their email address :

 

            // Search for and identify a known Contact
            var entityType = new EntityType() { Type = "Base", Name = "Contact" };
            var queryResult = service.Query(entityType, "C_EmailAddress=fred.sakr@eloqua.com", null, 1, 1);
            var entity = queryResult.Entities[0];

 

Next, we'll build a list of Activity Types that we want to retrieve for this contact. In our example, we'll request Email Send activities :

 

            // Define the list of Activity Types to query for
            var activityTypes = new List<ActivityType>();
            activityTypes.Add(ActivityType.EmailSend);

 

We'll also provide the start and end date for the Activity data :

 

            // Define start and end dates for Activities
            var startDate = DateTime.Now.AddMonths(-3);
            var endDate = DateTime.Now;

 

Finally, we'll invoke a request to retrieve the activity data for this Contact :

 

            // Execute a request to retrieve a list of Activities
            var activityResult = service.GetActivities(entity, activityTypes.ToArray(), startDate, endDate);

 

And we'll loop through and write the data to the console :

 

            foreach (var item in activityResult)
            {
                Console.WriteLine("Activity Type: " + item.ActivityType);

                // Activity Details
                foreach (var detail in item.FieldValueCollection)
                {
                    Console.WriteLine(detail.Key + " : " + detail.Value);
                }
            }


 

We hope that you find this helpful.

 

Thanks,

Fred

Important:  Documentation for this topic is available in our new Oracle Eloqua Developer Help Center.


Eloqua recently made some infrastructure changes in support of additional data centers.  To support these additional data centers, a new API endpoint was created to allow you to interface with Eloqua regardless of where the Eloqua install is located.  In this post we share details of this new endpoint.

 

Until now, almost all customers resided in the same production environment.  The API could therefore be accessed using the base URL of https://secure.eloqua.com.  In the coming months, new customers will be deployed in the new data centers, and some customers may move between data centers, and will therefore have a different URL than what you have seen in the past.

 

What does this mean to you as a developer?

 

Depending on the Eloqua customer that is trying to use your app, your API calls may no longer work!

 

Here's the good news...

 

There is now an endpoint that allows you to determine the URL for your API calls.  This endpoint is https://login.eloqua.com/id.

 

The endpoint, when called with basic authentication or The specified item was not found., will return details about the URLs for the various APIs.

 

Here's how to use it:

 

Request (basic authentication):

GET https://login.eloqua.com/id HTTP/1.1
Authorization: Basic XXXXX

 

Response (success):

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 824

 

{
    "site": {
        "id": 42,
        "name": "MyTestInstall"
    },
    "user": {
        "id": 314,
        "username": "TJ.Fields",
        "displayName": "TJ Fields",
        "firstName": "TJ",
        "lastName": "Fields",
        "emailAddress": "tj.fields@eloqua.com"
    },
    "urls": {
        "base": "https://www05.secure.eloqua.com",
        "apis": {
            "soap": {
                "standard": "https://www05.secure.eloqua.com/API/{version}/Service.svc",
                "dataTransfer": "https://www05.secure.eloqua.com/API/{version}/DataTransferService.svc",
                "email": "https://www05.secure.eloqua.com/API/{version}/EmailService.svc",
                "externalAction": "https://www05.secure.eloqua.com/API/{version}/ExternalActionService.svc"
            },
            "rest": {
                "standard": "https://www05.secure.eloqua.com/API/REST/{version}/",
                "bulk": "https://www05.secure.eloqua.com/API/Bulk/{version}/"
            }
        }
    }
}

Now that you have the URLs for the API(s), you can use them in your code.


Response (failure):

HTTP/1.1 200 OK

Content-Type: application/json; charset=utf-8

Content-Length: 20

 

"Not authenticated."


Your applications must cache the data they need from the /id endpoint for the duration of the user's session or for a reasonable period of time:

 

They must not call the /id endpoint once per API call, as there will be throttling or rate-limiting imposed on the /id endpoint to prevent this behavior:

 

Tip: When calling this endpoint from a  Cloud Connector or Cloud Component app,  if an API call fails with a 401, your application should call the /id endpoint again to determine whether the 401 was the result of the user's credentials/token being invalidated, or the result of the site being moved to a different data center.  If the /id endpoint returns a failure, your application should stop making API calls.  If the /id endpoint returns a success, your application should retry the API call at the new address in the response.

 

Here's a quick flowchart showing the fallback process:

image.png

 

 

Interactive applications can respond to 401s using this process, or by simply logging the user out.

 

Frequently Asked Questions

 

  • Q: What URL should I use?
    • A: Use login.eloqua.com/id to determine your base URL, and use the base with your existing calls.
  • Q: What permissions do I need to call login.eloqua.com/id?
    • A: The user calling login.eloqua.com/id needs, at a minimum, the API Users and Advanced Users - Marketing permissions.

 

 

If you have any questions, post a Discussion to Code It!

In previous posts about building cloud components, specifically in reference to the renderInstance endpoint, we touched on the ability to receive additional parameters from the Cloud Components framework.

 

By adding extra query string parameters to your endpoint address, an Asset ID, Contact ID, or Visitor ID can be passed by the Eloqua platform into your application.

 

As an example, let's look at the following endpoint address.

 

https://mycompany.com/ccpservice/components/render/{Id}&assetId={AssetId}&contactId={ContactId}&visitorId={VisitorId}

 

Notice that, in addition to the {Id} parameter, this service is requesting values be merged into {AssetId}, {ContactId}, and {VisitorId}.  When the Eloqua landing page is rendered, and this endpoint is called, the landing page ID (AssetId), Eloqua contact ID of the page visitor (ContactId), and Eloqua visitor ID (VisitorId) will be passed to your application.  (Note: The contact ID and visitor ID will only be populated if the page visitor is a known Eloqua contact or cookied visitor)

 

Once your application receives these values, you can use them to "personalize" your component.  For instance, using the contact ID or visitor ID and the Eloqua API, you could look-up other information on the page visitor and use that to display targeted content.  Or, if you are a video provider, you could use this information to track viewing data, and build a Feeder to pass the data back into Eloqua.

 

As you can see, there are many possibilities, and I think you'll agree that this is a pretty powerful capability.

 

Keep this in mind when you are building your component!


In case you missed the post, I thought this one was worth mentioning again.

 

There is now a great reference guide available that describes how to Import and Export data using Eloqua's Bulk API (an extremely powerful new RESTful API for performing bulk operations).

 

You can find the document here: Eloqua Bulk API 1.0: Importing and Exporting Data

 

Happy coding!!!

When it comes to building cloud connectors, one of the most frequently requested features is the ability to have Eloqua *push* notifications out to an app, instead of having to go through the process of polling for members.

 

Well, I am very happy to report that the Eloqua platform development team is currently working on a framework for doing exactly this.

 

There are still few details, and a release date is not yet available, but it should work something like this:

 

When setting up your cloud connector within Eloqua, you will have the ability to specify a "callback" URL.  When an Eloqua program runs, and a Cloud Connector step is encountered, it will call this URL and notify you that your step now has members ready for processing by your app.  You can then take this information and call into the step to retrieve the members and process them accordingly.  Instead of polling on a scheduled basis, your app can simply wait until it is called in order to act.

 

I will post further updates as I have them, but thought I'd share this bit of really good news!

We recently added an open source PHP Rest Client to help make requests to Eloqua's API a little easier. In today's post, we'll show you how to create and manage Landing Pages using the client.

Let's start by including and instantiating a new instance of the client :

 

// include the Rest client
include_once('lib/eloquaRequest.php');
$client = new EloquaRequest('site', 'user', 'password', 'https://secure.eloqua.com/API/REST/1.0/');

 

Next, let's define a class to represent a Landing Page record :

 

class LandingPage
    {
        public $createdAt;
        public $createdBy;
        public $htmlContent;
        public $id;
        public $name;
        public $updatedAt;
        public $updatedBy;
    }

 

Note that the HTML Content property is a complex type, represented by the following class :

 

class RawHtmlContent
    {
        public $type;
        public $html;
    }

 

Search Landing Pages

The following sample invokes a GET request to search for Landing Pages matching "Demand*" :

 

$list = $client->get('assets/landingPages?search=Demand*&count=50&page=1&depth=complete');

 

Create a Landing Page

The following sample creates a new Landing Page object and invokes an HTTP POST request to create the record :

 

$lp = new LandingPage();
$lp->name = 'sample landing page';
$htmlContent = new RawHtmlContent();
$htmlContent->html = '<html><head></head><body>sample content</body></html>';
$lp->htmlContent = $htmlContent;
$response = $client->post('assets/landingPage', $lp);

 

Update a Landing Page

The following sample invokes an HTTP PUT request to update an existing Landing Page.

 

$updatedLP = new LandingPage();
$updatedLP->id = $response->id;
$updatedLP->name = 'updated sample name';
$updatedLP = $client->put('/assets/landingPage/' . $updatedLP->id, $updatedLP);

 

Delete a Landing Page

The following sample invokes an HTTP DELETE request to delete an existing Landing Page

 

$client->delete('/assets/landingPage/' . $updatedLP->id);

 

We hope that you find this helpful.

 

Thanks,

Fred

fsakr

Eloqua REST API - User Access

Posted by fsakr Oct 20, 2012

In a previous post, we introduced the Rest API with an overview of Email management and deployment. In today's post, we'll introduce the User record.

 

URL : GET /system/user/{id}?depth={depth}

 

public class User
    {
        public List<string> betaAccess { get; set; }
        public List<string> capabilities { get; set; }
        public int? defaultContactViewId { get; set; }
        public string emailAddress { get; set; }
        public int? id { get; set; }
        public string loginName { get; set; }
        public string name { get; set; }
        public List<ProductPermission> productPermissions { get; set; }
        public List<TypePermissions> typePermissions { get; set; }
}
  

 

The user record contains information such as the beta access flags that are enabled as well as the areas of the application the user can access.

The sample project contains methods for retrieving a user and searching for lists of users. Note that a user create operation is not yet supported in the API.

 

A new open source project containing samples and helper methods for working with the user object is available here on Github.

Let's look at a sample json representation of the user object :

 

"type": "User",
      "id": "9",
      "createdAt": "1260902519",
      "createdBy": "8",
      "depth": "complete",
      "description": "John Smith",
      "name": "John Smith",
      "updatedAt": "1350572309",
      "updatedBy": "9",
      "betaAccess": [    
        "archiving_campaigns",
        "chatter_inside",
],
      "capabilities": [
        "mailer.updateContacts"
      ],
      "company": "OrionTest",
      "defaultAccountViewId": "100124",
      "defaultContactViewId": "100084",
      "emailAddress": "john.smith@eloqua.com",
      "loggedInAt": "1350686543",
      "loginName": "John.Smith",
      "preferences": {
        "type": "UserPreferences",
        "isMasterViewDocked": "false",
        "timezoneId": "64"
      },
      "productPermissions": [
        {
          "type": "ProductPermission",
          "productCode": "SecureHypersites"
        },
        {
          "type": "ProductPermission",
          "productCode": "EngageiPad"
        },
        {
          "type": "ProductPermission",
          "productCode": "EngageWeb"
        }
      ],
      "typePermissions": [
        {
          "type": "TypePermission",
          "objectType": "Campaign",
          "permissions": {
            "type": "TypePermissions",
            "create": "true",
            "read": "true"
          }
        },
        {
          "type": "TypePermission",
          "objectType": "Email",
          "permissions": {
            "type": "TypePermissions",
            "create": "true",
            "read": "true"
          }
     }
}
   

 

We hope that you find this helpful.

 

Thanks,

Fred

In a previous post, we demonstrated how to Search for Contacts using the Rest API. In today's post, we'll show you how to update a Contact's email address.

A complete sample project containing all of the code samples and model definitions is available here on Github.

 

The sample project on Github contains helper methods for the following operations :

  • Retrieve a single Contact
  • Search for a list of Contacts
  • Create and Update a Contact
  • Delete a Contact

 

Let's start by looking at the definition of a Contact record in the API :


public class Contact
    {
        public string accountName { get; set; }
        public string address1 { get; set; }
        public string address2 { get; set; }
        public string address3 { get; set; }
        public string businessPhone { get; set; }
        public string city { get; set; }
        public string country { get; set; }
        public string emailAddress { get; set; }
        public string firstName { get; set; }
        public int? id { get; set; }
        public string lastName { get; set; }
        public bool? isSubscribed { get; set; }
        public bool? isBounceBack { get; set; }
        public string salesPerson { get; set; }
        public string title { get; set; }
        public List<FieldValue> fieldValues { get; set; }
    }

 

Let's now look at the steps to update a Contact's email address using the API. We'll first need to identify the contact record.

There are two ways you can do this:

  1. Known Contact ID
  2. Search for the Contact

 

If you already know the ID of the contact you're working with, you can use the following method to retrieve the contact :

public Contact GetContact(int id)
        {
            var request = new RestRequest(Method.GET)
                              {
                                  Resource = "/data/contact/" + id
                              };

            var response = _client.Execute<Contact>(request);
            return response.Data;
        }


If you need to discover or search for your contact record, you can use the following method :

public RequestObjectList<Contact>SearchContacts(string searchTerm,int page,int pageSize)
        {
            var request = new RestRequest(Method.GET)
                              {
                                  Resource =
                                      string.Format("/data/contacts?depth=complete&search={0}&page={1}&count={2}",
                                                    searchTerm, page, pageSize)
                              };

            var response = _client.Execute<RequestObjectList<Contact>>(request);
            return response.Data;
        }


Finally, the project contains a method to update your contact record :

 

public Contact UpdateContact(Contact contact)
        {
            var request = new RestRequest(Method.PUT)
                              {
                                  Resource = "/data/contact/" + contact.id,
                                  RequestFormat = DataFormat.Json
                              };
            request.AddBody(contact);

            var response = _client.Execute<Contact>(request);
            return response.Data;
}


We hope that you find this helpful.


Thanks,

Fred


In a previous post, we discussed how to Send Email using the Rest API. In today's post, we'll discuss how to retrieve the statistics for your email deployment.

For a reference as well as a complete sample project on working with and sending Emails using the Rest API, please see the following Github repository.

 

Sending an Email using the API can be done by submitting a POST request to the following endpoint :

The response from the Post request will contain the unique ID for this deployment.

 

Once the email has been delivered, we can query the same endpoint (GET https://secure.eloqua.com/API/REST/1.0/assets/email/deployment/{id}) to retrieve a some statistics regarding the email delivery.

The EmailDeployment object contains a property that defines these statistics : EmailDeploymentStatistics

 

public class EmailInlineDeployment : EmailDeployment
    {
        public int? clickthroughCount { get; set; }
        public List<Contact> contacts { get; set; }
        public int? openCount { get; set; }
        public int? sendFromUserId { get; set; }
        public List<EmailDeploymentStatistics> statistics { get; set; } 
    }

 

Let's look at the EmailDeploymentStatistics object in detail.

 

public class EmailDeploymentStatistics
    {
        public string bouncebackType { get; set; }
        public int? clickThroughCount { get; set; }
        public string emailAddress { get; set; }
        public long? lastClickThrough { get; set; }
        public long? lastOpen { get; set; }
        public int? openCount { get; set; }
        public long? sentAt { get; set; }
    }

 

We hope that you find this helpful. Please note that the REST API is not yet public and the code samples referenced here are my own work. I'll be glad to support it, but please understand that Eloqua will not be able to support this code.

 

Thanks,

Fred

Filter Blog

By date: By tag: