How to remove __metadata from OData v2 responses - odata

I can see that OData v4 has support for reducing the metadata/urls that get returned, but I was wondering if OData v2 supports anything. I cannot see anything in the spec, but not sure if I just missed it or not.

No, OData v2 simply does not have a lightweight JSON serialization.

Related

Querying OData api from Redux

I have a Web API using OData that I need to query. The client application is a SPA built with React/Redux, but it looks as if most data service libraries such as isomorphic-fetch do not support OData. Can BreezeJS be useful for me in this situation? Or OLingo's ODataJs? Any examples, tutorials, resources on using these or any other OData clients with Redux? AFAIK, I just need a the client library to query an OData source and support promises. And as far as the data I get back from the server, I just need simple json objects; no need for models that support binding.
I've seen discussions of Breeze + Angular/Backbone, but can it support Redux/React?
I doubt that either Breeze or ODataJS supports ES6, so if i had to wrap them in a ES6 module, would they still function properly?
Maybe it helps if you consider that OData isn't that far off from REST. If it's just about pulling the data from a OData service, you won't need much more than jQuery.getJSON and Breeze will work too. However, if you want to do it the fancy way, and want you app to introspect the meta-model and such, you should have a look at datajs or olingo.

How to document OData endpoints (swagger, swashbuckle, other)?

What is the best way of documenting OData endpoints?
Is there a way to use Swashbuckle for it?
Yes, try Swashbuckle.OData. It adds Swashbuckle support for ODataControllers.
See it in action here: http://swashbuckleodata.azurewebsites.net/swagger
Yes, we are trying to support it like yaml -> Swagger, yaml -> csdl ..
But it will need time to implementation, you can see a prototype and track there https://github.com/OData/model-first
I actually got something working for this using the IDocumentFilter function within Swashbuckle. I answered a similar question on the GitHub repo for Swashbuckle. Check out my response here (it's either at bottom or toward bottom):
https://github.com/domaindrivendev/Swashbuckle/issues/149
I've posted an example of a working IDocumentFilter implementation that you could leverage to get your OData endpoint set up in the Swagger ui.
Asp NET and Asp NET Core Api Versioning
You can use Api Versioning (as it extends ApiExplorer with Odata information) for both WebApi and AspNetCore.
There are samples available for both:
WebApi
Asp Net Core
This sample how it integrates well with Swashbuckle/Swagger ui.
The easiest way to do that I found is to convert OData definition to Open API spec using https://github.com/oasis-tcs/odata-openapi
Then import the spec document into swagger is very easy.

OpenUI5 Support for OData v4?

I was trying to use OpenUI5 with a .NET OData v4 Web API service. It looks like the client embeds the "Max OData Service Version" header with the HTTP request by default and my service doesn't like that. Additionally, documentation notes support for v2 experimental v3.
Does anyone know when support for v4 is expected?
Thanks so much!
There are people working on the v4 support, but don't expect it to be available in the next few months.
Currently a new version of the v2 model is being implemented that has performance optimizations and better batch support, after that one is finished I guess the v4 support will be an important part of the agenda.
OData V4 finaly just got released.
https://sapui5.netweaver.ondemand.com/sdk#docs/api/symbols/sap.ui.model.odata.v4.ODataModel.html
But keep in mind what Jens Ittel said:
[...] Due to its limited feature scope, we will not recommend to use
the first of these releases of the model implementation for productive
usage. [...]

Data fetch using OData API in ios

I an new in iPhone.Currently i am working on OData based web service. But i am little confusing with how to call webservice and getting response with OData.I have below information with me.
The metadata of this service is located at :
http://enumbler.azurewebsites.net/odata/$metadata
and Base url is :: http://enumbler.azurewebsites.net/odata/User
Can anyone help me to solve this?
Thanks in advance.
I'm not familiar with IOS, but I may help with common way to consume OData services. Take one OData sample service TripPin, if you want to get all airlines, you can simple calling http://services.odata.org/V4/TripPinService/Airlines. The response is in JSON payload, you can consume this either directly dealing with JSON or use some OData client libraries for IOS. One difference your service and the sample service has may be that TripPin is OData V4 and your service is OData V3. Maybe your service doesn't support JSON but ATOM payload, but you can deal with either way I mentioned above. For more detailed information of OData, you can go directly to OData.org. Hope I helped you with part of your problem.

Breeze: $expand not working with breeze/web api2

We migrated to webapi 2 and $expand is not working anymore on collections. We are using NHibernate with breeze 1.4.7.
When we try to expand a collection, it simply returns an empty array. The odd part is that the generated sql follows the usage of the expand keyword.
The same code is working as expected with web api v1
Is it a bug in the web api 2 version of breeze?
This is a bug. MS changed some of the OData handling in WebApi 2, and our NH support didn't change with it.
The fix is in 1.4.8 (expected to be out tomorrow). We apologize for the inconvenience.

Resources