In our previous post, we introduced Eloqua's REST API with examples in .Net, Python, PHP, Ruby, Node.js, and Java These posts were meant to demonstrate how easy it is to work with a RESTful API. In today's post, we'll introduce some building blocks to help make things even easier.


All request libraries for Eloqua's API are now available on Github :

  1. eloqua-request : a Node.js repository for making requests to Eloqua's REST API
  2. eloqua-ruby-request : a Ruby repository for making requests to Eloqua's REST API
  3. eloqua-php-request : a PHP repository for making requests to Eloqua's REST API
  4. eloqua-python-request : a Python repository for making requests to Eloqua's REST API
  5. eloqua-csharp-samples : a repository of open source API samples in C#
  6. eloqua-csharp-client : a Rest client written in C# for Eloqua's API
  7. eloqua-java-request : a Rest client written in Java for Eloqua's API


If you're new to Github, you can find everything you need to get started here, including instructions on how to get the code. Please note that we're working on similar libraries in Ruby and C#, coming soon!


Let's look at how simple it is to make requests using these libraries.



Using the Node.js request library :

var Eloqua = require('eloqua-request');
var eloqua = new Eloqua('site', 'user', 'pw', 'baseUrl');
eloqua.get('/API/REST/1.0assets/emails?search=Demand*&page=1&count=50&depth=minimal', function(err, response){



Using the Ruby request library :

eloquaRequest ='site', 'user', 'password')
response = eloquaRequest.get('/assets/emails?search=Demand*&page=1&count=50&depth=minimal')



Using the PHP request library :

$eloquaRequest = new EloquaRequest('site', 'user', 'password', 'baseUrl');
$response = $eloquaRequest->get('/API/REST/1.0/assets/emails?search=Demand*&page=1&count=50&depth=minimal', $data);



Using the Python request library :

import sys
from eloqua_request import EloquaRequest

request = EloquaRequest('site', 'user', 'password')
response = request.get(url, None)



Using the C# rest client :


Create Client
var client = new Eloqua.Rest.Api.ClientLibrary.Client("site", "user", "pass"); 


GET (list)
List<Email> emails = client.Assets.Email.Get("searchTerm", pageNumber, pageSize);  


Email email = new Email() { ... };  
email = client.Assets.Email.Post(Email);  


Email email = new Email() { ... };  
email = client.Assets.Email.Put(Email);  


int emailId = 1;  


We hope that you'll find these helpful.