Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

odata_client

3 sites Security covered
View on drupal.org

Introduction

OData client implements configuration entity for OData servers, IO functions to OData collections and Drupal format OdataQuery object.

This module makes it possible to integrate Drupal with e.g. Microsoft Dynamics CRM.

Requirements

The module requires the following libraries:
saintsystems/odata-client: ^0.2.4
league/oauth2-client: ^2.4
thenetworg/oauth2-azure: ^1.4

Installation

Install as you would normally install a contributed Drupal module. Visit:
https://www.drupal.org/documentation/install/modules-themes/modules-8
for further information.

Configuration

Go to /admin/structure/odata_server and create new server configuration

Usage

After made a server configuration name default able to connect to server:

$odata_client = \Drupal::service('odata_client.io');
$odata_client->connect('default');

Change collection:

In configuration can define the default collection but may to change it:
$odata_client->setCollection('People');

Find an element by key:

Return the data of element key ‘russellwhyte’:
$result = $odata_client->find('russellwhyte');

Count elements in collection:

Return elements count the collection:
$result = $odata_client->count();

Create new element:

Create new element in collection:

$data = array (
  'UserName' => 'teresa',
  'FirstName' => 'Teresa',
  'LastName' => 'Gilbert',
  'Gender' => 'Female',
  'Emails' => 
  array (
    0 => '[email protected]',
    1 => '[email protected]',
  ),
  'AddressInfo' => 
  array (
    0 => 
    array (
      'Address' => '1 Suffolk Ln.',
      'City' => 
      array (
        'CountryRegion' => 'United States',
        'Name' => 'Boise',
        'Region' => 'ID',
      ),
    ),
  ),
);
$result = $odata_client->post($data);

Get data from collection:

Return max 4 elements FirstName and LastName columns where FirstName is Teresa, sort by LastName descending:

$query = \Drupal::service('odata_client.query');
$query->connect('default')
    ->fields(['FirstName','LastName'])
    ->condition('FirstName', 'Teresa')
    ->orderBy('LastName', 'desc');
    ->range(0, 4);
$result = $query->execute();

Activity

Total releases
1
First release
Mar 2025
Latest release
1 year ago
Release cadence
Stability
0% stable

Releases

Version Type Release date
3.1.0-alpha2 Pre-release Mar 17, 2025