datajs– Using OData From Within the Browser
The datajs API currently contains two main functions:
OData.read = function (url | request, [success(data, response)], [error(error)], [handler], [httpClient], [metadata])
OData.read is used to retrieve data from an OData-enabled service as an AtomPub feed or a JSON document. The library uses a RESTful convention, accessing each resource through an URI. The developer may specify a handler for errors, and another for content received from the service.
OData.request = function (request, [success(data, response)], [error(error)], [handler], [httpClient], [metadata])
OData.request is used to add new data, to update or to delete existing data. Besides functionality similar to OData.read, OData.request can be used to send data in batches.
datajs uses XMLHttpRequest to make network calls by default, but a different HTTP client can be used.
Microsoft plans to enhance datajs to access HTML5 functionality in the future such as the local storage provided by IndexedDB.
OData is offered by Microsoft under the Microsoft Open Specification Promise (OSP), and currently implemented by Microsoft across a number of Azure services, by Netflix, Facebook, ebay and others. datajs is offered under the MIT License (MIT).
Chris Mattmann Apr 15, 2014