The OData Server module exposes entities, like nodes and users, through the OData Producer Library for PHP. Properties and core fields are supported, and the module can be configured to limit the bundles, properties, and fields that are exposed through the server. Hooks are provided for developers to add support for their custom field modules. Most of the read-only conventions of the OData specification are supported.

Sponsored by R2integrated.

Dependencies

The OData Server module depends on the Libraries module. You will also need to download the OData Producer Library for PHP and place this in the sites/(all|default)/libraries directory.

About OData

OData is an open specification for RESTful web services. It describes conventions developers can use to query data from the web service. An example OData request would look like this:

http://example.com/odata.svc/Node__Article?$filter=status eq true&$orderby=changed asc

The response might look like this:

{

    "d": {
        "results": [
            {
                "__metadata": {
                    "uri": "http://example.com:80/odata.svc/Node__Article(nid=302)",
                    "type": "Drupal.Node__Article"
                },
                "taxonomy_term__tags__field_tags": {
                    "__deferred": {
                        "uri": "http://example.com:80/odata.svc/Node__Article(nid=302)/taxonomy_term__tags__field_tags"
                    }
                },
                "user__user__uid": {
                    "__deferred": {
                        "uri": "http://example.com:80/odata.svc/Node__Article(nid=302)/user__user__uid"
                    }
                },
                "nid": 302,
                "title": "Aliquip Ideo Metuo",
                "uid": 1,
                "status": true,
                "created": "/Date(1335344529)/",
                "changed": "/Date(1335808663)/",
                "promote": false,
                "body": "<p>Aliquam incassum praemitto typicus. Acsi ad brevitas iaceo patria praesent valde velit. Ad antehabeo capto consectetuer diam dolus ymo.</p>\n",
                "field_publication_date": "/Date(1234471515)/",
                "field_somelist": "1",
                "field_is_cool": false,
                "field_tags": {
                    "__metadata": {
                        "type": "Collection(Edm.Int32)"
                    },
                    "results": [
                        8,
                        8
                    ]
                },
                "field_example": {
                    "__metadata": {
                        "type": "Collection(Edm.Double)"
                    },
                    "results": [
                        0,
                        0,
                        0.1,
                        0
                    ]
                }
            },
        ]
    }
}

For more information, check out the documentation.

*IMPORTANT: The OData URI conventions specify a filter for paging through data as "$skiptoken". But for unknown reasons, in the php library required by this module, this has been changed to "$skip". The library was written by Microsoft not this modules author so this eccentricity will not be changed.

Project information

Releases