This is a Drupal extension that integrates Elomentary (a PHP library that facilitates communication with Eloqua's REST API) with Drupal. It does nothing on its own, other than make Elomentary available to Drupal and authenticate API calls with configurable credentials.

Install this module if you're using another module that depends on it (like those listed below under "Ecosystem"). You might also want to use this module if you're a developer looking to more deeply integrate Drupal and Eloqua.

Ecosystem

Installation & Configuration

To better read the documentation above, you may wish to install a markdown viewer browser extension like one of the following: [chrome] [firefox]

Developer usage

Drupal 7

  // Use eloqua_rest_api_client() to get an instance of Eloqua\Client()
  $client = eloqua_rest_api_client();
  // Use the $client as prescribed by Elomentary.
  $contact = $client->api('contact')->show(123);

Drupal 8

// Pull the client factory from the service container and return a client.
$client = \Drupal::service('eloqua.client_factory')->get();
$contact = $client->api('contact')->search('*@example.com');

You can also inject the service into your own class and use it like so:

use Drupal\eloqua_rest_api\Factory\ClientFactory;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

MyClass implements ContainerInjectionInterface {

  /**
   * @var ClientFactory
   */
  protected $clientFactory;

  public function __construct(ClientFactory $clientFactory) {
    $this->clientFactory = $clientFactory;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('eloqua.client_factory')
    );
  }

  /**
   * Demonstrating use of the factory.
   */
  public function getContact($id) {
    $client = $this->clientFactory->get();
    return $client->api('contact')->show($id);
  }

}

Note, this module currently references an early snapshot of Elomentary, which only implements a subset of Eloqua's API. Work on full integration is ongoing here and contributions are welcomed and encouraged!

Project information

Releases