FAQ Database Discussion Community


Web API 2.2 - OData v4 (Manually Parsing Uri + Expanding)

odata,web-api,expand
I have an ODataController with a Get method as such: public IHttpActionResult Get(ODataQueryOptions<MyModel> queryOptions) { IQueryable<MyModel> models = _Models.AsQueryable(); // _Models Defined in Controller as List<MyModel> and is already populated with nested data for both .LevelOne and .LevelOne.LevelTwo which are two other Lists. Uri fullrequest = Request.GetRequestContext().Url.Request.RequestUri; // http://localhost:8080/odata/Root?$expand=LevelOne($expand=LevelTwo) Uri...

Office 365 API OutlookServicesClient Filter Messages Error

c#,odata,office365
I'm using OutlookServicesClient to get messages. I'm trying to get only messages received after a certain date, but here's where I receive an error. The code I use to get the mails and filter: public async Task<IReadOnlyList<IMessage>> GetMails(DateTime? MailsAfterDate) { OutlookServicesClient oc = await _OutlookAuthentificationService.GetOutlookClient(); if (oc != null) {...

Using read function of oData model in UI5

javascript,odata,sapui5,openui5
I am coding an UI5 App which consumes a given OData Service. Now I want to get the name of an account with a given account number and Display it in a table. As I can only access the account Name via /AccountInfoSet()/ShortText I tried to use a formatter function...

Odata Restlet code generation failed

java,eclipse,odata,restlet
public static void main(String[] args) { // TODO Auto-generated method stub String[] arguments = { "http://services.odata.org/V4/Northwind/Northwind.svc/", "src/com" }; Generator.main(arguments); } Output: --------------------------- OData client code generator --------------------------- step 1 - check parameters step 2 - check the ouput directory step 3 - get the metadata descriptor Starting the internal HTTP...

OData Filter for child and return parent

odata,olingo
I am developing a search function which will be powered by a OData service. It will return one or a list of Header Objects as results. Many fields that we need to search on are not in the Header Object. They are only in child Objects(Navigational Properties). What is the...

Cannot return object

c#,odata,odata-v4
I want to return this object by finding it by it's name: public class Product { public int Id { get; set; } public string Name { get; set; } public decimal Price { get; set; } public string Category { get; set; } } The controller method is: [HttpGet]...

reading OData date format in R

r,date,odata
I am reading a csv file exported from OData, and encounter a date format that looks like this: /Date(1391514600000)/. Any ideas on how to convert this into Date or POSIX in R?...

Use one field to compare to another field and filter in oData

filter,odata
Lets say I have data like this (lots of it) { "name" : "Coffee", "quantity": 100, "restock": 10 } I want to use an odata $filter to show me ONLY items where the quantity is LESS than the restock number Is it possible to do something like $filter=quantity lt restock...

Microsoft.Data.Edm vs Microsoft.OData.Edm: what is the difference?

asp.net,.net,asp.net-web-api,odata,asp.net-web-api2
Could someone please shed some light on the following question: there is Microsoft.Data.Edm namespace and Microsoft.OData.Edm namespace. Both have IEdmModel interface, EdmModelBase and EdmModel implementations, etc. The most interesting thing is that ASP.NET Web API OData package uses Microsoft.Data.Edm.Library.EdmModel internally (instance of that class is returned by ODataModelBuilder, for example)....

alphanumeric string in OData v4's function string parameter is parsed as int into string, or null

c#,asp.net-web-api,odata,odata-v4
I'm having some problems passing an alphanumeric string as a parameter for an OData function. Here is its signature: [EnableQuery] public IHttpActionResult GetForConstant([FromODataUri]string constant) and its configuration: var getForConstant = collection.Function("GetForConstant") .ReturnsFromEntitySet<BasicParameter>("Parameters"); getForConstant.Parameter<string>("constant"); and its metadata: <Function Name="GetForConstant" IsBound="true"> <Parameter Name="bindingParameter"...

Update SharePoint list entry using ListData.svc and PowerShell

powershell,sharepoint,sharepoint-2010,odata,powershell-v3.0
Is there a way to update a SharePoint 2010 list entry using PowerShell without using the SharePoint client? If so, how? To get the desired fields, I would: $url = 'http://myserver/resource/_vti_bin/ListData.svc/TheList(1234)?$select=Id,Title,StartingDate,Hours' $webRequest = Invoke-WebRequest -Uri $url -Method Get -UseDefaultCredentials [xml]$xml = $webRequest.Content $properties = $xml.feed.entry.content.properties $properties | Format-Table -Property Id,Title,StartingDate,EndingDate,Hours...

WebApi odata: Serialize long as string

javascript,asp.net-web-api,odata,wcf-data-services
I'm migrating form WCF Data Service to Web API odata v4. WCF Data Service did serilize long values in quotes: { "value":[{ "ID":"4527895973896126465" },{ "ID":"4527895973896126466" }] } Web API odata does not: { "value":[{ "ID":4527895973896126465 },{ "ID":4527895973896126466 }] } This means that I loose the precision of the 64bit number...

Query options for getting single value with the specified key in ASP.NET OData Controller

c#,asp.net,asp.net-mvc,odata
When I created OData controller with default "demo" implementation I noticed that there is query options in the method which gets a specific value with a specific Id: // GET: odata/TestModels(5) public IHttpActionResult GetTestModel([FromODataUri] int key, ODataQueryOptions<TestModel> queryOptions) { // validate the query. try { queryOptions.Validate(_validationSettings); } catch (ODataException ex)...

OData service data binding

javascript,odata,sapui5
I have a hard time with displaying data from OData model. Here is the model declaration: var oModel = new sap.ui.model.odata.ODataModel("northwind/V2/(S(ql0iexfh2tyudc5p4qhx5gdf))/OData/OData.svc"); sap.ui.getCore().setModel(oModel, "odata"); I have a destination for Northwind OData service with path "/northwind". Here is my list declarations: var oResultsList = new sap.m.List(); var oListTemplate = new sap.m.StandardListItem({ path:...

Using WebApi + Odata on an Edmx

entity-framework,asp.net-web-api,odata,edmx,asp.net-web-api-odata
We are currently looking at converting from WCF Data Services to WebApi with Odata. Our entity model is defined using an entity framework defined as an edmx. Im struggling to get the edmx working with WebApi OData due to relationships and complex properties. I'm just wondering whether someone has successfully...

Tool to visualise OData WebAPI / WCF Data Service?

odata,wcf-data-services,odata-v4,odata-v3
This question is about situation when you get access to the DataService and want to quickly explore what kind of functionality (EDM?) is available. Do we have any such tool that could help us to learn services? Something like building class diagram from the code during re-engineering...

WCF Data services remove miliseconds from DateTime when expand

entity-framework,odata,wcf-data-services
I get some strange behavior, when using WCF Data Services 5.6. In my case, I have table, with 1 column set with Concurrency=Fixed, and this column hold date time field from database, updated each time when row is edited. In case I just retrieve entity - this column has correct...

BreezeJS - Is there any way to use old style 'One controller to rule them all' with OData Web API?

asp.net-web-api,odata,breeze
I would like to expose the SQL Server Views via OData Web API but I don't want to create separate controllers for each views as there are too many of them and they will only accept GET verb for all the views. I thought I can achieve this using BreezeController...

WAAD Authentication with WebAPI OData service consumed by Excel PowerQuery

asp.net-web-api,odata,single-sign-on,azure-active-directory,powerquery
I've created a WebAPI OData 3.0 web service with an OWIN middleware, which is configured for authentication with Windows Azure Active Directory. The ODataControllers are marked with an [Authorize] attribute, and the IAppBuilder is configured as follows: app.UseWindowsAzureActiveDirectoryBearerAuthentication( new WindowsAzureActiveDirectoryBearerAuthenticationOptions { Tenant = ConfigurationManager.AppSettings["ida:Tenant"], TokenValidationParameters = new TokenValidationParameters { ValidAudience...

OData Annotations do not appear when not localhost

odata,asp.net-web-api2
I'm building an OData response by throwing a standard HttpResponseException. The exception itself is built with an HttpResponseMessage based on ODataError. new ODataError() { ErrorCode = code, Message = message, InnerError = new ODataInnerError() { Message = innerException.Message, StackTrace = innerException.StackTrace, TypeName = innerException.GetType().Name }, InstanceAnnotations = annotations }); The...

How to generate OData v4 Client for Silverlight 5?

silverlight,asp.net-web-api,odata,generator,odata-v4
We're trying to get set up with Web API 2.2 and OData v4 for ASP.NET + Silverlight 5. Initiall POC had a Unit Test project connecting using Simple.OData. This worked great. But we've been unable to set up an OData Client on Silverlight 5. Using Client Code Generator v4 and...

Browser adds $metadata to OData call

javascript,odata,sapui5
I try to consume OData service using SAPUI5 framework. When I tested my app on localhost, I did as follows: var oModel = new sap.ui.model.odata.ODataModel("proxy/http/services.odata.org/V3/(S(ql0iexfh2tyudc5p4qhx5gdf))/OData/OData.svc"); and it worked fine. But when I uploaded the app to the cloud platform, I got the following error: GET https://<accountname>.hana.ondemand.com/OData/proxy/http/services.odata.org/V3/(S(ql0iexfh2tyudc5p4qhx5gdf))/OData/OData.svc/$metadata 500 (Internal Server Error)...

OData query failing at filtering data

filter,odata
I am trying get few records by filtering odata using a filter where status not equals to bad and poor and id= 105 and id= 106 http://mywebsite.com/testService.svc/Details?$top=10&$filter=(Status ne 'Bad' and Status ne 'poor' and Id eq 105 and Id eq 106) What was my mistake this show 0 records even...

Service Stack Redis in Web Api OData add EdmEntityObject / EdmEntityObjectCollection

dynamic,asp.net-web-api,redis,servicestack,odata
We are able to add a normal POCO class to a Service Stack Redis client IRedisTypedClient<Product> objRedisTypedClientNB = redisClient.As<Product>(); IRedisList<Product> objRedisListNB = objRedisTypedClientNB.Lists["Product"]; Product objNews = new Product(DateTime.Now.Ticks.ToString()); objRedisTypedClientNB.Lists["Product"].Push(objNews); Adding products object to redis cache is fine When using dynamic web api odata v4 service, Metadata is created at runtime...

How to get only Odata.Count without value

odata,web-api
Is there anyway wherein i can get only count of the data in response payload without any value array. I am using ODataV4.0 with Webapi 2.2. Currently it returns all the values and count when i query something like: http://odata/People?$count=true I just need something like "@odata.count":1, "value":[] or without "value"....

How to filter an odata $expand query in a Web-Api controller

entity-framework,odata,web-api,asp.net-web-api2
I have got two models. A Product model: public class Product { public int Id { get; set; } public string Name { get; set; } public decimal Price { get; set; } public virtual ICollection<Categories> Categories { get; set; } } And a Categories model: public class Categories {...

BreezeJS/WebApi OData minimal metadata

asp.net-web-api,odata,breeze
I have an WebApi OData endpoint that I'm querying with BreezeJS, and I'm having an issue with the json payload. When I query the endpoint with BreezeJS, as opposed to directly querying the endpoint via url, the json payload is ~2x, and it appears to be because the response includes...

x-csrf-token validation fails on HttpPost

android,http,http-headers,odata,androidhttpclient
I have to post xml payload to an ODATA service which requires Authentication and x-csrf-token. I have two AsyncTasks. In First one has URLConnection object and fetches x-csrf-token with code below: URL obj = new URL(Util.ODATA_URL + "SO_BEATPSet"); URLConnection conn = obj.openConnection(); conn.setRequestProperty("Authorization", "Basic " + authStringEnc); conn.addRequestProperty("x-csrf-token", "fetch"); .........

Server Error in '/' Application ()

c#,.net,web-services,visual-studio,odata
I created a OData ADO.NET Framework web api which I am testing in localhost and am getting the error Line 19: if (!EventLog.SourceExists("MyService")) The StackTrace is: [SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.] System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean...

Web API 2.2 OData Controller supporting class hierarchy

c#,odata,asp.net-web-api2
I'm trying to create an ODataController that supports casting action. Let's say we have Shape class and Circle class that derives from Shape namespace NS { public abstract class Shape { int Id; int X; int Y; } public class Circle : Shape { int Radius; } } And I...

Paging in .NET Web API

c#,.net,asp.net-web-api,odata,paging
I have to do paging for an odata endpoint built using Entity Framework . I know I can do it using private ODataQuerySettings settings = new ODataQuerySettings(); settings.PageSize = myPageSize; // I keep this value in web.config of solution and options.ApplyTo(IQueryable, settings); But I am constrained not to use ApplyTo...

OData Method Routing Returns 404 not found

odata,asp.net-web-api2
I have added OData V4 to my Web Api 2 app. registered OData route in WebApiConfig register method before default route: //defining the routes for our OData service config.MapODataServiceRoute( routeName: "ODataRoute", routePrefix: "odata", model: GenerateEdmModel()); private static IEdmModel GenerateEdmModel() { var builder = new ODataConventionModelBuilder(); builder.EntitySet<Media>("Media"); return builder.GetEdmModel(); } MediaController.cs...

406 error with OData service in Visual studio

c#,asp.net-mvc,web,asp.net-web-api,odata
I have spent the past 6 hours trying to figure out why my odata service doesn't work to no avail. I keep getting a 406 error and I have tried all recommended solutions to no avail. Please help. Below is my code. public class Person { public int Id {...

Modify odata results after query

asp.net-web-api,odata
I have an ASP.NET Web API app using Entity Framework and Odata. I would like to modify the results of a query when using a GET... currently, within the controller, you effectively just pass the EntityFramework data entities back to the Odata handlers... [EnableQuery] public IQueryable<myEntity> GetLineItem() { return db.myEntities;...

OData v4 Web API 2.2 deep level expand not working

asp.net-web-api,odata
The situation I'm trying to expand "Item" to three levels: Item.Product.Model.Type So I call this nested query options url: http://xxx/api/Items?$expand=Product($expand=Model($expand=Type)) I Get a warning that the max depth of 2 has been reached so I set the suggested MaxExpansionDepth attribute to 3. But then, the "Type" property is not returned!...

Web API 2.2 - ApiController to ODataController (changing Content Type after setting Formatter)

iframe,odata,web-api,content-type
I have a Web API 2.2 controller that is under conversion to use OData v4. In the ApiController I am able to do this: HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, MyObject); response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html"); return ResponseMessage(response); Which sends back a Http Status Code of 201 - Created, with an object serialized...

The complex type 'MyData.AssetReading' refers to the entity type 'MyData.Asset' through the property 'Asset'

entity-framework,asp.net-web-api,odata,edmx,asp.net-web-api-odata
Looking at setting up Web API odata and trying to expose the data out of our edmx to it. The problem is that every time i add an entity to the OdataConventionBuilder I get a big nasty error message on load saying: The complex type 'MyData.AssetReading' refers to the entity...

Error in exposing an Entity with ODataService

odata,olingo
while I'm Passing an entity in the URL its saying ... Could not find an entity set or function import for 'Books'. I'm trying to expose an "ODataService" of book and publisher in Java. Code is very long. so can you suggest me what might be the possible cause for...

OData Query: Getting several rows based on a column criteria

rest,asp.net-web-api,odata,asp.net-web-api-odata
I have a table that holds an attribute field and its corresponding value. For an instance several attributes are applicable, and I would like to return a specific set of attributes for this instance. |Attribute|Value| ---------- | A | 1 | ---------- | B | 2 | ---------- | C...

Using A Service DB Context as WebApi OData Context

c#,wcf,odata,asp.net-web-api2
I'm trying create a OData service using Webapi 2. I've already created a working example that works with a local context. Now, I want to use a Context Provided from a seperate WCF Service. WebApiConfig.cs: public static void Register(HttpConfiguration config) { config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id...

Enforce ordering of OData items even when $top is used

linq,entity-framework,asp.net-web-api,odata,iqueryable
I have a DbSet<Items> collection. The primary key is a Guid. I don't want to order by this primary key. I want to order by an editable decimal property named "Order". The code I have is very simple, and it works great until the user puts a "$top" parameter into...

Breezejs, OData can't see navigation property entity in client for many to many relationship

angularjs,asp.net-web-api,odata,breeze
I'm working on many to many relationship for BreezeJS/WebAPI/OData like this: Metadata: and get data with dataContext.Users.Include("Customers") is fine: but why in result user object doesn't have customers navigation property: I read this article but no luck still can't use user.customers() I'm totally stuck, please help me. Thanks in advance....

How to configure OData end point in a self-hosted Web API application

c#,odata,asp.net-web-api2,owin,self-host
I'm building an OWIN self-hosted Web API 2 service. I need for this service to expose OData end points. The traditional IIS-hosted method involves App_Start/WebApiConfig.cs: using ProductService.Models; using System.Web.OData.Builder; using System.Web.OData.Extensions; public static class WebApiConfig { public static void Register(HttpConfiguration config) { // New code: ODataModelBuilder builder = new ODataConventionModelBuilder();...

passing odata $filter in httr GET request

r,odata,httr
looking to pass $filter criteria using odata in R's httr package, but keep getting an 'Error 400. The request is badly formed'. I'm able to paste the url/$filter in my browser and obtain results ok, and am also to obtain results in R without the $filter. It's just using the...

Odata web api 404 error

asp.net-web-api,odata
I am new to odata. I have builded a web api with a controller as shown below: using System.Data.Entity; using System.Data.Entity.Infrastructure; using System.Web.OData.Routing; namespace HelloWebApi.Controllers { public class TestsController : ODataController { // // GET: /Product/ ProductsContext db = new ProductsContext(); private bool TestExists(int key) { return db.tests.Any(p => p.key==...

Accessing JSON object in SAPUI5 via xsodata

javascript,json,odata,sapui5
I try to access the value of my json objects in sap ui5, but the getproperty function cannot access the required data. But, at first, I have created a xsodata file with some service definitions, e.g. "CUSTOMER_ATTR_G3" as "Customers"; Then I try to get these data in view.js file with...

Every OData Service will provoide metadata document?

odata
I'm a little bit confused that metadata doucment in OData Service. As odata-v4.0-part1-protocol doc mentioned, there are two well-defined resources that describe its data model, a service document and a metadata document. I want to know if that means both of these two resources must be implemented during development of...

Decimal Filtering Using AngularJS $http

javascript,angularjs,odata
I have this snippet of code $http({ method: 'GET', url: url, params: params, timeout: timeout || deferred.promise }) In params I have a $filter property. In the dataset I am filtering I have a decimal property called foo. If I set $filter to "foo eq 100" I get the correct...

Is it possible to renounce the key property of a Olingo EntityType

java,odata,olingo
Is a key value mandatory while setting up an EntityType? This may sound a little odd but I have a case where a key is unnecessary. So I was asking myself if I can get rid of these code lines. List<PropertyRef> keyProperties = new ArrayList<PropertyRef>(); keyProperties.add(new PropertyRef().setName("KEY")); Key key =...

Optemizing basic auth: Save user authentification for follow up requests

asp.net-web-api,odata,asp.net-web-api2
I'm using the this tutorial to secure my Web-API calls with basic auth. Basically it checks if there is a auth header on the request and then proves this header against a database: public static bool CheckPassword(string user, string password) { //Do a Database checkup if(CheckDB(user,password)) { //if true, set...

Cannot implement multiple GET methods in WebApi OData

asp.net-web-api,odata
I'm using OData V3 with MVC4 Web API project .NET4. The WebAPI register method is: public static void Register(HttpConfiguration config) { config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{action}/{id}", defaults: new { id = RouteParameter.Optional } ); config.Formatters.JsonFormatter.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.None; ODataConventionModelBuilder builder = new ODataConventionModelBuilder(); builder.EntitySet<ClientModel>("ODClient");...

Why would an making my ODataController have a plural name stop it from working

c#,asp.net-web-api,odata
I'm creating a simple project to test out features in Entity Framework. On the front end I want to have a SPA application which interacts with the server using OData API. I set up my first ODataController as below public class BlogPostsController : ODataController { private readonly IBlogPostService _blogPostService; public...

WebApi OData Delete routing convention

c#,asp.net-web-api,routing,odata
I have a MVVM project. For the model I use a EF6.0.0 code first and WebApi. In general everything works fine but for one thing. When I do a delete the following URL is composed http://localhost:50346/Recruiters/Addresses(guid'5d778c9d-56b2-449b-b655-22489e01636d')/CIP.Models.Domain.Addresses and this results in a 404 error. So I've created an routing convention like...

400 Respone from OData service using Java client

java,odata
The www.odata.org website demonstrates how to consume OData services 'in 6 steps'. I'm stuck on Step 3 of the examples located directly on the homepage. I am purposely using only the standard Java 7 libraries. The below code produces a 400 response. I have verified that the URL is correct...

oData's skip() and top() pulling entire record set before filtering

mongodb,asp.net-web-api,odata,mongodb-csharp,asp.net-web-api-odata
i have an oData enabled web api function [EnableQuery()] public IQueryable<StoreCommand> Get() { return _storeCommandService.GetAllStoreCommands().AsQueryable(); } the service layer calling Mongodb based Repository pattern's implementation. public IEnumerable<StoreCommand> GetAllStoreCommands() { return _uow.StoreCommands.GetAll(); } where GetAll is implemented in Repository layer like public IList<TEntity> GetAll() { return _collection.FindAllAs<TEntity>().ToList(); } where _collection is...

Upload file to SharePoint 2010 using PowerShell and the OData API

powershell,sharepoint,sharepoint-2010,odata,powershell-v3.0
I'm attempting to upload a file to SharePoint 2010: Function Add-Attachments() { [CmdletBinding()] Param( [Parameter(Mandatory=$True)] [int]$Id, [Parameter(Mandatory=$True)] [string[]]$Paths ) BEGIN {} PROCESS { $url = "http://server/resource/_vti_bin/listdata.svc/TheList($Id)/Attachments" Foreach ($Path in $Paths) { Write-Verbose "Attaching $Path ..." $headers = @{ 'Slug' = "TheList|$Id|$(Split-Path $path -Leaf)" } $Payload = @{filename=(Split-Path $path -Leaf);filecontent=([IO.File]::ReadAllBytes($path))} Invoke-WebRequest...

“EnableBreezeQuery is not an attribute” error mesage

odata,breeze,asp.net-web-api2
After updating "Microsoft ASP.NET Web API 2.2 for OData" package to version 5.4.0 I get an error "EnableBreezeQuery is not an attribute" when applying the attribute on an Action of an ApiController. Is there a Fix for that? I am using breeze 1.5.3 . Thanks...

SharePoint oData API Only Returns 1000 Records

sharepoint,odata,sharepoint-2013,wcf-data-services
I am trying to query a SharePoint 2013 list using the Rest API for all items in the list. The problem is it only returns 1000 records max and I need to get all of the records. I am using the oData v4 API and auto generated service references for...

How to specify url for $resource for oData v4

angularjs,odata,asp.net-web-api2
I'm following damienbod's series on webapi and odata4 where the odata url to query a single product would be: http://localhost/odata/Products(5) The question is, how do I structure my $resource url in angular to map to this url? I've tried return $resource(appSettings.serverPath + "/odata/Products(:id)" but this breaks when I want to...

oData SharePoint Add List Item Containing Value Properties

c#,sharepoint,sharepoint-2010,odata,wcf-data-services
How do you save "Value" and "DataServiceCollection" objects that are part of another SharePoint list item? These are the only properties in my model that are not getting saved. The generated Food SharePoint model has these sort of properties: public class Food { DataServiceCollection<FoodIngredientValue> Ingredient; FoodStateValue State; string _StateValue }...

Where should I store WebAPI controllers inside ASP.NET-MVC 5 project?

asp.net-mvc,asp.net-web-api,odata
I have completed an ASP.NET-MVC5 application(website) where I have lot of MVC controllers: I would like to extent the functionality of my application by exposing WEB API with OData. For instance I would like to create another controller for Person model class, but this time it should be Web API...

What is meaning of in OData Metadata?

odata
After I went through OData doc, I still do not understand the meaning of <FunctionImport>. What is that used for? Some one said that "Function imports are used to perform custom operations on a JPA entity in addition to CRUD operations. For example, consider a scenario where you would like...

Does TableQuery support OrderBy?

c#,azure,odata,windows-azure-storage
I can't figure out how to add a OrderBy clause to a TableQuery with Azure Table Storage. According to their documentation Azure supports OData $orderby. If I try to hack it by adding $orderby=PartitionKey to the TableQuery Where clause the '$' is HTTP-encoded and I get a 400 server error...

what is the json format for delta in MVC Data v4?

asp.net-mvc,odata,asp.net-web-api2
I have a controller: public class PostsController : ODataController { public IHttpActionResult Post(Post post) {} public IHttpActionResult Put([FromODataUri] int key, Delta<Post> patch) {} } The Post entity has only 2 fields: an int Id and a string Content. The following jsonmessage is working fine with POST action: { content: "dasdasd678678678"...

Suffix “.svc” on url for odata service

asp.net-web-api,odata,asp.net-web-api-odata,odata-v4
This might be a stupid question, I have just a little confusion on the suffix .svc on ODATA service, since most of examples I see always have suffix .svc at root URL, example: http://services.odata.org/V4/Northwind/Northwind.svc/ Or even on ODATA document example: When building ODATA on ASP.NET Web Api, I see that...

How to use authentication with self hosted WCF OData service

c#,wcf,authentication,odata,wcf-data-services
I have an WCF DataService that runs inside a console application with DataServiceHost I can sucessfully start my host and query my WCF DataService with this code public void Start() { var uri = new Uri("http://localhost:12345/Products"); var host = new DataServideHost(typeof(ProductsDataService), uri); if (host.Description.Behaviors.Find<ServiceMetadataBehavior>() == null) host.Description.Behaviors.Add(new ServiceMetadataBehavior()); if (host.Description.Behaviors.Find<ServiceDebugBehavior>()...

Is oData accepted across by developers outside of asp? [closed]

asp.net,open-source,odata
I'm working on developing API requirements. oData looks very promising. However, searching for oData turns up results primarily related to ASP.NET. Is oData widely accepted by the development community, (meaning php, Python, Ruby, etc.) or is it primarily used by Microsoft devs? Thanks, TK...

Access SharePoint expanded properties

powershell,sharepoint,sharepoint-2010,odata,powershell-v3.0
I'm accessing a SharePoint lists has an associated stakeholder entity--I'm having difficultly accessing the stakeholder's properties. The 'primary' content's properties are located on xpath /feed/entry/content/properties/*. The stakeholder's properties are located on xpath /feed/entry/link/inline/entry/content/properties/*. Assuming that I include the stakeholder's name in the odata query: http://server/list/_vti_bin/listdata.svc/TheList?$select=Id,Title,Stakeholder/Name&$expand=Stakeholder How do I reference the...

Migrating from WCF Data Services to WebApiOdata

entity-framework,odata,wcf-data-services,edmx,asp.net-web-api-odata
We are currently looking at migrating from WCF Data Services to WebApiOData. The problem that I see is that we have to create a method within a webApi controller for every single table/view that we have that we need to query from the client. The entity model is defined in...

Odata Parsing $metadata

wcf,odata
I'm Hosting an OData Service which exposes certain tables and properties from my DB. I can Request the Metadata for the DB using the [hosturl]?$metadata property. which return the table names and columns in XML format. I was wondering if there is a built in OData class to parse this,...

Simple.OData.Client - Unable to invoke Action that accepts entity collection parameter

odata,asp.net-web-api2,simple.odata
I get error "The parameter 'wheels' is of Edm type kind 'Collection'. You cannot call CreateCollectionWriter on a parameter that is not of Edm type kind 'Collection'." Below are details of my setup: Web API 2.2 OData v4 service : I have defined Action in WheelsController class in my...

OData query option $count in $expand not working

asp.net-web-api,odata,asp.net-web-api-odata,odata-v4
I tried to use $count in an $expand like this query .../OData/Foo(1)?$expand=Bars($count=true) However count is no where to be found in the result. { "...": "...", "Bars": { "...": "..." } } No error either. I'm using ASP.NET Web API OData 5.4, which is using OData v4. What gives? Not...

How To Parse ODATA Error

c#,asp.net,.net,error-handling,odata
<?xml version="1.0" encoding="utf-8"?> <m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <m:code /> <m:message xml:lang="en-US">An error occurred while processing this request.</m:message> <m:innererror> <m:message>Exception has been thrown by the target of an invocation.</m:message> <m:type>System.Reflection.TargetInvocationException</m:type> <m:stacktrace></m:stacktrace> <m:internalexception> <m:message>An...

List of Collection Names in oData

c#,xamarin,odata,simple.odata
I am little of confused how to get list of collection names from the following odata service http://services.odata.org/V4/Northwind/Northwind.svc/ I just want to get a list of all of the available collection names in the service And then I'd like to let the user choose which collection to view information for,...

Retrieving entities from a one to many relationship (Odata)

c#,.net,linq,odata,one-to-many
Summarizing, I have two main tables: Company and Employees, with a one-to-many relationship between them: employees belongs to a company. The Company entity has a property called Employees, which allows to get the employees who belongs to the specific Company. If I type in the browser this URL, it works...

OData not working behind router with port address translation (port forwarding)

odata,asp.net-web-api2,firewall,nat,portforwarding
I have two applications hosted on different computers : An OData web site APP1 on PC1 A basic MVC application APP2 on PC2 My router (my.server.com) is configured to forward following request : *:10080 to PC1:80 *:20080 to PC2:80 I used Microsoft.OData.Client library to generate OData context and use it...

Database error in web api

c#,sql,linq,asp.net-web-api,odata
I am trying to create an odata endpoint for a table valued function in sql database. I get the exception: The specified type member is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported. I am sure with my code and unable to...

Applying Distinct to OData query

c#,odata,asp.net-web-api-odata,odata-v4
I want to get a list of distinct values from my OData endpoint. But distinct or group by isn't supported yet. My URI query looks something like this GET /odata/Products?$select=foo & $top=10 & $count=true & distinct=true My Controller [EnableQuery] public IQueryable<FooBarBaz> Get(ODataQueryOptions<FooBarBaz> queryOptions, bool distinct) { //I've tried the following...

Does Apache Olingo support Oracle database

oracle,odata,olingo
I want to expose Oracle database data with an Odata endpoint.I tried using JayData server on node.js but it currently supports only mongo db but not oracle.So before I start trying connecting Oracle with Apache Olingo I would like to know if someone has already been this path.Please advise

Webapi Update Multiple Records

asp.net-web-api,odata
Which is the best approach for updating multiple records at a time using ASP.NET Web API and OData against an Entity Framework database? Let's suppose we have a table in our database with a "State" field, and we want to do something similar to this SQL statement: "UPDATE Table set...

oData v4 (6.1.0) nested $filter in $expand

c#,asp.net,asp.net-web-api,odata
I have an asp.net 4.5 Web Api oData v4 service that is working really well but I have encountered a problem today with nested $filters in $expand. It says here that OData V4 supports nested filters in $expand. The request below return People and all their trips with Name "Trip...

Error missing the extra metadata for an update/delete entity

rest,odata,sharepoint-2013,breeze
when saving (updating) opr delete Entities the "missing the extra metadata for an update/delete entity" Error is thrown. Breeze.Angular" version="1.1.1" Breeze.Angular.Directives" version="1.3.10" Breeze.Angular.SharePoint" version="0.10.0" Breeze.Client" version="1.5.3" Breeze.DataService.SharePoint" version="0.10.0" Breeze.Metadata.Helper" version="1.0.8" Read the Entites is no problem. When debugging breeze.labs.dataservice.sharepoint.js line 297 function updateEntityNode... metadata is obtained by Sharepoint, etag and...

WebAPI AND Odata V4 issue: ComplexType containing Entities

asp.net-web-api,odata
I am getting following error while adding relationship inside the complex type. How can I fix this issue. I binged and read that it was issue with OData V3 but not in OData V4. The complex type 'Microsoft.OneIM.ActiveIncident.Contracts.IncidentImpact' refers to the entity type 'Microsoft.OneIM.ActiveIncident.Contracts.ImpactedService' through the property 'ImpactedServices'. at System.Web.OData.Builder.ODataConventionModelBuilder.MapComplexType(ComplexTypeConfiguration...

Duplicate columns in odata metadata

entity-framework,odata,asp.net-identity
I am trying to export Asp.Net Identity classes in the OData metadata. Now the the IdentityUserLogin class contains three primary keys which are not marked with [Key] attribute. When the metadata is generated, the key definition is missing in the output <EntityType Name="IdentityUserLogin"> <Property Name="LoginProvider" Type="Edm.String"/> <Property Name="ProviderKey" Type="Edm.String"/> <Property...

Passing Authentication from WebApp to WebAPI using BreezeJS

odata,breeze,asp.net-web-api2,single-page-application,azure-active-directory
I am having two web applications, one a SPA using AngularJS + BreezeJS and the other a WebAPI. We are building authorization in the WebAPI and the results get filtered based on user access. We want the user to sign-in into organization Azure AD in the SPA and pass the...

solution architecture for an OData / Web API based .Net project

c#,asp.net,asp.net-web-api,odata
so far in my office i have developed a number of small and medium sized .Net web based applications where i used to architect them something like this - Web layer (.Net Web APIs) Controllers, filters Services (contains business logic) IServices Repository (gets data from database using entity framework /...

OData Endpoint with .NET

c#,asp.net,visual-studio-2013,odata,web-api
I am trying to create an odata endpoint for a table valued function in a database. I am sure with the code, however upon running the application i get the error Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to...

IEnumerable> to IQueryable

c#,linq,datatable,odata
I have an application that lets a user dynamically query any OData service and return to them the specific columns they requested inside of a grid. After weeks of research, I ended up using Simple.OData.Client to query the service. In order to get data back, I have model that defines...

Bound function call returns InvalidOperationException

c#,asp.net,odata,odata-v4,t4-template
I'm following this OData V4 tutorial and now have a problem with the bound function MostExpensive. This function is bound to the Productscollection and is registered in WebApiConfig.Register() like suggested in the tutorial: ODataConventionModelBuilder builder = new ODataConventionModelBuilder(); builder.Namespace = "ProductService"; builder.EntityType<Product>().Collection.Function("MostExpensive").Returns<decimal>(); There is only described a rudimentary client for...

How to wisely combine shingles and edgeNgram to provide flexible full text search?

regex,elasticsearch,lucene,odata,analyzer
We have an OData-compliant API that delegates some of its full text search needs to an Elasticsearch cluster. Since OData expressions can get quite complex, we decided to simply translate them into their equivalent Lucene query syntax and feed it into a query_string query. We do support some text-related OData...