WebApi icon indicating copy to clipboard operation
WebApi copied to clipboard

"Deep Insert" requests with Prefer: return=representation header does not return expanded graph.

Open OnurGumus opened this issue 8 years ago • 5 comments

According to OData V4 spec:

11.4.2.2 Create Related Entities When Creating an Entity

A request to create an entity that includes related entities, represented using the appropriate inline representation, is referred to as a “deep insert”. Media entities, whose binary representation cannot be represented inline, cannot be created within a deep insert. ... On success, the service MUST create all entities and relate them. If the request included a return Prefer header with a value of return=representation and is applied by the service, the response MUST be expanded to at least the level that was present in the deep-insert request.

However this is not what's happening. I am sending a deep request and the response message does not include expanded graph.

OnurGumus avatar Jan 13 '16 14:01 OnurGumus

Anything new about this item?

victorperez2911 avatar Jan 02 '18 21:01 victorperez2911

I am also facing to this issue.

maximpashuk avatar Sep 20 '18 11:09 maximpashuk

As a workaround I use "Prefer" as "return=minimal" and use Location header to get url, which I can use to return entity with all required selects\expands.

maximpashuk avatar Sep 20 '18 11:09 maximpashuk

This issue is still present in 7.x. Any plans to fix it?

VirusQuartirus avatar Mar 11 '20 16:03 VirusQuartirus

Somewhat related: https://github.com/OData/WebApi/issues/356

I also tried to work-around this issue by adding Prefer: return=representation in the POST request header and explicitly add $expand=MyNavigationProperty in the query string, but the response still doesn't include the expanded navigation property.

I'm using Microsoft.AspNetCore.OData 7.5.12

icnocop avatar Oct 22 '22 23:10 icnocop