Skip to content

Unmodifiable Requests

While Offline OData may alter requests as needed, you can mark some requests as unmodifiable so Offline OData will never alter them.

Queued requests are uploaded and executed in First In, First Out (FIFO) order. There is normally no combining of requests, for example, multiple requests that update the same entity are not combined. However, during error handling, requests that are in an error state may be combined with new requests to remedy the error. Further explanation of error handling is found in Handling Errors and Conflicts. If specific requests against the OData service should not be combined, developers must indicate this with the unmodifiableRequest request option set to true when such requests are executed.

For example, the status of an event must be created in the NEW state. If you are to combine any updates (for example changing the state to IN PROCESS) with the create, the create may fail should the state not be NEW. Therefore, the first create request must be unmodifiable. This code illustrates how to mark a request as unmodifiable.

// Declare a new event
Event event = new Event(false);

// Set properties for the event
...

// Make the request for creating the new event unmodifiable
OfflineODataRequestOptions options = new OfflineODataRequestOptions();
options.setUnmodifiableRequest(true);

// Create the new event. This request cannot be combined with other requests
Service.createEntity(newEvent, HttpHeaders.empty, options);
/// Declare a new event
let newEvent = Event(withDefaults: false)

/// Set event properties
...

/// Create the new event with the unmodifiableRequest option. This request cannot be combined with other requests
let options = OfflineODataRequestOptions()
options.unmodifiableRequest = true
try service.createEntity(newEvent, options: options)

Last update: April 14, 2021