How to access the JSON response of a POST request sent to XDataServer by using TXDataWebDataSet.ApplyUpdates method?


I want to access the JSON response received after a POST request sent to XDataServer from a WebCore client App by using TXDataWebDataSet.ApplyUpdates method. So, that I can update the local webdataset instead of re-fetching the newly added or updated data again from XDataServer by using a separate request.

I am using Entity model in XDataServer to return data to Webcore client app.
Then at Webcore client app side, I am adding new data to XDataWebDataset instance and calling TXDataWebDataSet.ApplyUpdates method to update the data. As I checked the browser Network, it sends a POST request to XDataServer and also returns a JSON response with new ID and data. But I could not find a way to access the JSON response.

POST request on calling ApplyUpdates method.



Below is the response I get after success..

But, I could not find any way to access the JSON response?
So that I can update the client webdataset with the returned JSON response.

Please help me.

I have checked some code and tried AfterApplyUpdate event as well but it seems not returning all the updated data.

procedure TfrmCustEditor.webdsCustAfterApplyUpdates(Sender: TDataSet; Info: TResolveResults);

the console log was.

Here, I can see the CUSTNO value but not CUSTNOID value but in JSON response from network tab I can see all update values and want to access those values.

Currently, the only way to get access to the raw JSON response of a request is using the OnResponse event of the TXDataWebConnection component.

Of course, that event is fired for all the requests performed by such component.

Thanks, I checked and able to get the response on TXDataWebConnection.OnResponse event but it would be great if we can get the same in TXDataWebDataSet.ApplyUpdates event as well in future.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.