Questions tagged [odata]

The Open Data Protocol (OData) is a standardized protocol for building REST APIs. OData specifies many best practices for REST APIs, including a terse, hypermedia-oriented JSON format. Use this tag for all specification versions (v2, v3, v4.x).

The Open Data Protocol (OData) is a standardized protocol for building REST APIs. It is a web protocol for querying and updating data, which can be freely incorporated in various kinds of data access applications

OData v4 specifies many best practices for REST APIs including a terse, hypermedia-oriented JSON format.

OData v4 is an OASIS Standard, with more than 20 companies participating on the technical committee. Microsoft, SAP, Salesforce, and many other companies are strong advocates of the protocol as a solution to an otherwise fragmented REST API landscape.

This same standardization allows generic hypermedia clients to consume the service. , and are well known data clients that have support for consuming OData.

7563 questions
42
votes
1 answer

What is the difference between OData, JsonAPI, GraphQL?

I have used OData in my career quite a bit and now few of my colleagues from different teams recommended we move to JsonAPI and GraphQL as its not tied to Microsoft. I don't have much experience in both these query languages. As far as i know OData…
Navap
  • 1,050
  • 9
  • 18
41
votes
5 answers

How to escape a single quote to be used in an OData query?

I am using OData to query my database. The following line of code works fine when “adapterName” just contains text. ds.query('/DataAdapters?$filter=Name eq \'' + adapterName + '\'', ifmgr_CreateAdapter_Step1, onGenericFailure, ''); If “adapterName”…
Retrocoder
  • 4,483
  • 11
  • 46
  • 72
41
votes
2 answers

Caching Data in Web API

I have the need to cache a collection of objects that is mostly static (might have changes 1x per day) that is avaliable in my ASP.NET Web API OData service. This result set is used across calls (meaning not client call specific) so it needs to be…
atconway
  • 20,624
  • 30
  • 159
  • 229
38
votes
13 answers

WebAPI and ODataController return 406 Not Acceptable

Before adding OData to my project, my routes where set up like this: config.Routes.MapHttpRoute( name: "ApiById", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional }, …
Ivan-Mark Debono
  • 15,500
  • 29
  • 132
  • 263
37
votes
5 answers

OData $filter with items in a $expand

I have given some web services to access informations. The first thing that i have tries to expand a node . And i have done that successfully with following…
Null Pointer
  • 9,089
  • 26
  • 73
  • 118
37
votes
2 answers

Select distinct values with odata

I'm trying to create a call to odata webservice that would select only distinct values of some property. Is there any good example of how to do this?
igorti
  • 3,828
  • 3
  • 22
  • 29
35
votes
9 answers

how to return json format from ODATA?

I know ODATA can return json but not sure if I have to use an attribute or interface to do so. I want it to do just like http://odata.netflix.com/Catalog/Titles?$format=JSON but my odata service doesn't return JSON. When I call it like…
wil
  • 853
  • 2
  • 10
  • 24
35
votes
1 answer

What's the right HTTP status code for a response when I can't perform a DELETE due to a FK constrain?

What would be the right response I should give to the users when they try to DELETE an entity on a datasource sitting behind a rest/odata api, and the operation cannot be performed due to a foreign key constrain? Is it a bad request? A not…
cazala
  • 871
  • 7
  • 7
32
votes
6 answers

How to deserialize oData JSON?

I am trying to use the Northwind OData service: http://services.odata.org/V3/OData/OData.svc/Products?$format=json and deserialize it to a collection of products: using (var client = new HttpClient()) { HttpResponseMessage response =…
Graeme
  • 2,597
  • 8
  • 37
  • 50
31
votes
1 answer

OData with ServiceStack?

I just saw ServiceStack and I am considering building a service with it. Is it possible to serve OData feeds with service stack so that I'd be able to expose IQueryable and query it from the client?
Shaddix
  • 5,901
  • 8
  • 45
  • 86
31
votes
1 answer

OData filter options (handle null or empty values)

We are using $filter system query option in OData to execute filters where the filter value is sent in at runtime. As an example the OData URL would be like this: http://services.odata.org/Northwind/Northwind.svc/Customers?$filter=CustomerID eq…
Venki
  • 2,129
  • 6
  • 32
  • 54
30
votes
5 answers

Is there a LIKE operator in odata filter?

I'm trying to filter my data through OData where the field FileRef contains lets say "/The root path/folder/subfolder", I tried with substringof like so: $filter=substringof("sites/my folder/subfolder", FileRef) But it seems doesn´t work, so I…
Emmanuel Villegas
  • 1,374
  • 3
  • 12
  • 19
30
votes
12 answers

How to get Web API OData v4 to use DateTime

I have a fairly large data model that I want to expose using Web API OData using the OData V4 protocol. The underlying data is stored in a SQL Server 2012 database. That database has many DateTime columns in it. As I was wiring it up I got an error…
Vaccano
  • 78,325
  • 149
  • 468
  • 850
30
votes
3 answers

OData query $filter conditions and case-sensitivity

Does OData specify whether filter conditions on string fields are to be evaluated case-sensitively or case-insensitively? Example: (from the docs) /Suppliers?$filter=Address/City eq 'Redmond' Is this expected to be case-sensitive or not? If I want…
eseib
  • 323
  • 1
  • 4
  • 6
29
votes
5 answers

Are there any alternatives to OData?

OData is used by Netflix and in many of Microsoft's products (servers: CRM, Sharepoint, SQL Server; clients: Excel). While OData is interesting, it has it's own set of benefits and trade-offs. I've designed and build a custom search engine for…
Chris Weber
  • 5,555
  • 8
  • 44
  • 52