When working with OData (Open Data Protocol) APIs, performance and efficiency are key — especially when dealing with large datasets or complex entities. One often-overlooked but powerful feature in OData V4 is the ability to use header options to control and reduce the response payload.
This tells the OData service that the client does not need a full entity response body after performing certain operations, such as POST, PATCH, or PUT.
By default, when you create or update an entity, the server typically returns the entire updated record in the response body. For large entities, this can significantly increase network traffic and processing time.
Using the Prefer: return=minimal header signals that only an HTTP 204 (No Content) response is required — effectively reducing the payload to near zero.
Example:
--batch
Content-Type: multipart/mixed; boundary=changeset
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 112
POST Entity HTTP/1.1
Content-Type: application/json
prefer:return=minimal
{
"Attribute1" : "Value1",
"Attribute2" : "Value2"
}
--changeset--
--batch--
Response
HTTP/1.1 204 No Content
Content-Length: 0
When It’s Useful
This optimisation is particularly valuable in scenarios such as:
- Bulk data uploads or updates — When creating or updating thousands of records, eliminating unnecessary response bodies saves bandwidth and time.
- Mobile or IoT applications — Reducing payload sizes minimises data usage and speeds up communication.
- Backend integration or batch operations — When responses are not required for further logic, this header helps streamline API interactions.