cancel
Showing results for 
Search instead for 
Did you mean: 

How to handle Olingo v2 single call that would overwrite complete table contents?

GregMalewski
Contributor
0 Kudos

Customer requirement is to have the document-like behavior for the list of the items. It means that the user can play (modify, delete or insert entry) with the list and only after pressing “Save” the list is stored in the backend. All changes before pressing save are only stored in the local model.

Here is how the structure of the tables in the backend could look like:

The assumption is that the Model table contents should be kept in sync with what user has in frontend by single odata call at “Save” button press. The odata call would overwrite the complete set of entries for each BrandID in Model table. For example in order to make the change that would look in the frontend like this:

Frontend would send the following call:

PUT /cars-sample/Service.svc/Brands('Audi')
HTTP/1.1Host:
localhost:8081Content-Type:
application/json
{  
   "Model" :
   [  
      {
           "ModelName": ""
      },
      {    
           "ModelName": "X3"  
      },  
      {    
           "ModelName": "X6"
      }  
   ]
}

The question is: how to set up this call in olingo v2?

Accepted Solutions (1)

Accepted Solutions (1)

RalfHandl
Product and Topic Expert
Product and Topic Expert
0 Kudos

OData V2 does not support replacing of arrays/lists with PUT. Instead you have to send a batch request containing a change set with DELETE requests for list items that have to be removed, PUT/PATCH requests for list items that have to be changed, and POST requests for list items that have to be created.

"Deep update" has only recently been introduced with OData V4.01.

GregMalewski
Contributor
0 Kudos

Thank you for your help

Answers (0)