Question about writing

Sep 12, 2011 at 10:14 AM



I have a question regarding write functions.

As of now I find it a bit complex to do writing to an odata service.

Wouldn't it be nice to retrieve the data with datajs and then operate on this data and finally simply call

e.g. datajs.write(modifiedData)

 and hand over the modified data.

Something like an easy to use API would be nice.

Is this possible or planned?


Sep 12, 2011 at 6:40 PM

Hi Joe82,

Thank you for your feedback and yes we have considered having such higher level services.  Right now, the library is very low level in this regard and that is intended because of how the OData protocol works.  Reading is always the same operation in OData; however, writing is done by different methods with siginficantly different outcome.  Writing to an OData endpoint is done via http requests with specific verbs: POST for inserting a new item, PUT for a full update of an item and MERGE (through tunneling) for differential update of an item.  These different ways of "writing" to an OData service require either that the user selects what operation wants to do or have a change tracking mechanism that allows the library to determine the correct HTTP verb to use.

We will give more consideration to such a feature when planning the next changes to dataJS.


Alex Trigo.