Reputation: 124
We are using the Microsoft ASP.NET Web API for Odata v4.0 package for constructing an OData service based on the DynamicEdmModelCreation project of ODataSamples-master. We want that our own resources response with the @odata.id and the @odata.editLink annotations like this one(currently our responses only comes with the @odata.context annotation):
{
"@odata.context": "http://services.odata.org/V4/.../TripPinServiceRW/$metadata#People",
"@odata.nextLink": "http://services.odata.org/V4/.../TripPinServiceRW/People?%24skiptoken=8",
"value": [
{
"@odata.id": "http://services.odata.org/V4/.../TripPinServiceRW/People('russellwhyte')",
"@odata.etag": "W/\"08D316E3F5DF36AF\"",
"@odata.editLink": "http://services.odata.org/V4/.../People('russellwhyte')",
...
}
This example comes from the odata official page http://www.odata.org/ and can be requested with this url
http://services.odata.org/V4/(S(l4xyndr2pr1j1usz3cetf5zp))/TripPinServiceRW/People
Upvotes: 2
Views: 1411
Reputation: 2925
On the client, set the Accept
request header to application/json;odata.metadata=full
.
Upvotes: 3