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
29
votes
1 answer

415 Unsupported Media Type - POST json to OData service in lightswitch 2012

I am getting 'error 415: Unsupported Media Type' when posting to an OData service when using JSON. Solution at the bottom of this rather long post. I can GET using JSON but as soon as I try and POST I get this error. I can also GET/POST using XML…
PaddleFish
  • 293
  • 1
  • 3
  • 6
29
votes
7 answers

How do I resolve the error "Attempt by security transparent method 'System.Web.Http.GlobalConfiguration.get_Configuration()

I have created a solution with two projects: A MVC 4 and a Class Library. The solution compiles and runs fine. I then install-package 'Microsoft.AspNet.WebApi.OData -pre to pull in OData WebApi functionality. When I do, I get the following error…
Daniel
  • 3,021
  • 5
  • 35
  • 50
28
votes
6 answers

How to properly integrate OData with ASP.net Core

I'm trying to create a new ASP.NET Core project with a "simple" web api using OData and EntityFramework. I have previously used OData with older versions of ASP.NET. I have set up a controller with only a simple get function. I've managed to get it…
Sli
  • 291
  • 2
  • 4
  • 6
28
votes
1 answer

How do I use OData Expand like a SQL join?

I'm trying to figure out how to accomplish the equivalent of: select * from Users u inner join Comments c on c.UserId = u.Id where Id = 1569 (table aliases for better sql readability) ...on the StackOverflow OData endpoint. How would this url be…
Factor Mystic
  • 26,279
  • 16
  • 79
  • 95
27
votes
2 answers

Unable to filter messages by recipient in Microsoft Graph Api. One or more invalid nodes

I am trying to get a list of messages that are filtered by recipient from Microsoft Graph API. The url I am using for the request is: https://graph.microsoft.com/beta/me/messages?$filter=toRecipients/any(r: r/emailAddress/address eq '[Email…
Dave
  • 3,676
  • 4
  • 28
  • 39
27
votes
2 answers

Dynamic odata service in C# from runtime data layer

I'm trying to create a dynamic odata service from tables in my tables which are not known till runtime. So at the start of my web application, a user selects a database and in C# I find all the tables in that database. Now the hard part is I want…
james Makinde
  • 943
  • 3
  • 17
  • 36
27
votes
2 answers

Web API OData media type formatter when using $expand

I'm trying to create a MediaTypeFormatter to handle text/csv but running into a few problems when using $expand in the OData query. Query: http://localhost/RestBlog/api/Blogs/121?$expand=Comments Controller: [EnableQuery] public IQueryable
geekboyUK
  • 498
  • 4
  • 14
27
votes
2 answers

Web API OData V3 `$inlinecount` fails

I am using the out of the box ValuesController in a ASP.NET Web API application public class ValuesController : ApiController { // GET api/values [Queryable(PageSize = 1)] public IQueryable Get() { return new…
tom
  • 1,822
  • 4
  • 25
  • 43
26
votes
2 answers

is it possible to Query an Odata service and expand Child of Child entities?

This sounds rather simple (and maybe I'm missing the obvious here) but I can't find a solution. I know I can query an entity and return one, or many direct child entities doing this: var query = from c in…
Andreas
  • 681
  • 1
  • 8
  • 16
25
votes
1 answer

Plain Web API or Web API and OData?

I'm starting a project that has to expose a RESTful service that will be consumed by a wide variety of clients of several OSs. I'm reading about Web API and OData using Web API and it's hard for me to decide what to use, the plain Web API or the…
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
25
votes
1 answer

WebAPI 2.2 does not support substringof function

I've a WebAPI 2.2 service with OData support. My controller has an action which returns an IQuerable, but I'm unable to use $filter=substringof function even if I allow all functions. [Authorize] public class MyController :…
BuddhiP
  • 6,231
  • 5
  • 36
  • 56
24
votes
4 answers

How to in-code supply the password to a connection string in an ADO.Net Entity Data Model

I've been following this tutorial on how to create an OData service. http://www.hanselman.com/blog/CreatingAnODataAPIForStackOverflowIncludingXMLAndJSONIn30Minutes.aspx And it works flawlessly ... but, in the Entity Data Model Wizard, when it asks…
saunderl
  • 1,618
  • 2
  • 16
  • 31
24
votes
11 answers

No non-OData HTTP route registered

I followed this tutorial to create a WebAPI REST service. After that, I could load the list of all contacts by pointing at http://baseaddress/api/Contacts. Then I added the following code in the Register method in WebApiConfig.cs in order to enable…
Teejay
  • 7,210
  • 10
  • 45
  • 76
24
votes
8 answers

Create annotation to a contact entity in Microsoft Dynamics CRM by API

This question is related to Microsoft Dynamics CRM 2015, that I'm calling through API. I create contact entity: POST [organization URI]/api/data/contacts Content-Type: application/json; charset=utf-8 Accept: application/json { "emailaddress1":…
24
votes
6 answers

Is it really worth mixing AngularJS and or KendoUI?

Recently, in working with AngularJS, I really like many of the features, like creating custom abstract data factories, etc. KendoUI also has similar features like MVVM, SPA routes, etc. that AngularJS offers, so I'm curious about what the benefits…
ElHaix
  • 12,846
  • 27
  • 115
  • 203