so I am using webapi with the latest version of odata
I am trying to sort and filter my expand,
http://services.odata.org/V4/Northwind/Northwind.svc/Orders?%24select=OrderID&%24expand=Order_Details(%24select=UnitPrice;%24orderby=UnitPrice%20desc)
not getting any errors as the data comes back with no issue, however the the orderby inside of the expand dose nothing.
is this sort allowed?
if not do you know of a workaround?
thanks
This is not supported yet, see this issue to track the progress. https://github.com/OData/WebApi/issues/557
Related
I'm looking for the equivalent of the older campaignSubscriberActivity export options. Specifically, I need to get all activity for campaign since a certain date. Is that possible in 3.0?
As I see in the 3.0 API References You cant filter the date. So you have to filter the response.
You can use
GET /reports/{campaign_id}/email-activity
https://developer.mailchimp.com/documentation/mailchimp/reference/reports/email-activity/
Use the since parameter on your requests to API 3.0.
Like Sergey Shushert said, you can use the reports endpoint to get open, click, and other activity for a campaign. The since parameter lets you filter by date. For instance, https://mailchimp.com/developer/marketing/api/open-reports/list-campaign-open-details/
does NEST support adding context information to suggestions in the current version (1.0.2)? According to this article (http://www.elasticsearch.org/blog/elasticsearch-1-2-adding-context-suggestions/)
I didn't found a way how to achieve this by using fluent API.
thanks.
Not yet. I just opened #927 to add support for this. We'll try and get to it as soon as we can.
I'm using OData V4 with ASP WebApi. I would filter an expanded collection as the new version of OData can do (http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part2-url-conventions.html - Example 90) but in my case the filter option has no effect.
I also tried to do the same thing with the Nortwhind service and the TripPin service. It works for the TriPin service, but not for Northwind service.
Here, the requests that I used :
My Service : api/odata/Customers(19037)?$expand=orders($filter=id+eq+1796) --> Doesn't work
Northwind Service : http://services.odata.org/V4/Northwind/Northwind.svc/Customers?$expand=Orders($filter=OrderID+eq+10643) --> Doesn't work
TripPin Service : http://services.odata.org/V4/TripPinServiceRW/People?$expand=Trips($filter=TripId+eq+1001) --> Does Work
Thanks for your help.
This is a feature we don't support for now.
The root cause is that the inline $filter is ignored while translating $expand.
Check method "GetPropertiesToExpandInQuery" of SelectExpandBinder.cs:
https://aspnetwebstack.codeplex.com/SourceControl/latest#src/System.Web.OData/OData/Query/Expressions/SelectExpandBinder.cs
Only expandItem.SelectAndExpand is returned while other options are ignored.
So only $select and $expand inside $expand work for now.
I have investigated how to fix it before, but since the issue is not approved,
please vote the issue Jinfu opened to draw more attention of lead team.
I reproduced the issue, and found $select inside a $expand works well. I believe this is a defect and opened a bug for it: https://aspnetwebstack.codeplex.com/workitem/2070.
I've seen Missing inverse property in asp.net webapi odata $metadata and the WebAPI $metadata I'm dealing with behaves as described in this article: it doesn't reuse associations for bi-directional navigation properties.
When using jaysvcutil 1.3.5 all navigational properties come up as $$unbound.
$data.Entity.extend('API.Models.Document', {
...
'Document_Versions': {
'type':'Array',
'elementType':'API.Models.Document_Versions',
'inverseProperty':'$$unbound' }
});
Other than manually updating the inverseProperty information is there anything to get the desired result automatically?
Update based on #Robesz answer
Manually adding inverseProperty information to the static .js converted by JaySvcUtil is doable, but I'm asking if there's an option to accomplish that with the dynamic conversion as well.
There seems to be to options
make modifications to the .NET WebAPI. Might be challenging, because their seem to be good reason for their implementation, but maybe somebody already successfully did that.
modifying the conversion XSLT that JayData using to take that behavior into account.
We've just arrived to the same results with WebAPI OData, but after editing the generated context file manually and adding the inverseProperty everything is working fine
This should be most probably handled by extending JayData's XSLT conversion. I've created an issues for that on https://github.com/jaydata/jaydata/issues/155.
I'm using the latest ASP.Net WebAPI Nightly builds (dated 2013-01-16).
I have a simple EF database first model at the moment that has two entities - Patients and Visits. Each patient can have many visits.
I'd like to be able to query for my list of patients and have the visits entities for each patient returned inline. I know that WebAPI's OData implementation doesn't yet support $expand. I'm hoping that just means that optional client-controlled expansion is not supported and that I can force expansion server-side.
At the moment I'm not getting any of the visits inline.
For example, my PatientController's() Get() method looks like
[Queryable(AllowedQueryOptions=AllowedQueryOptions.Supported)]
public override IQueryable<Patient> Get()
{
var query = this.entities.Patients.Include("Visits");
return query;
}
I've verified that the query executing against my database does indeed include the visit information.
To use a publicly available OData service as an example, if you use the service at http://services.odata.org/OData/OData.svc/, you can get a list of Suppliers. This is http://http://services.odata.org/OData/OData.svc/Suppliers.
You can also ask for a list of suppliers that includes the list of products using http://http://services.odata.org/OData/OData.svc/Suppliers?$expand=Products
Stepping through the ASP.NET code (via the symbols server) I've got to the System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer and can see that it's CreatePropertyBag method, which builds up the list of properties to be serialized, just doesn't include the navigation properties, and they don't seem to be enumerated anywhere else apart from being written out as NavigationLinks.
I'm quite new to the ASP.NET world in general and have spent a week or so getting my head around the way things work (particularly with the changes made to OData at the end of 2012 and further changes made so far in 2013).
I suspect that if the ODataEntityTypeSerializer was to be modified (I'm happy to try) to embed this extra information in the appropriate spot (within each navigation link as an nested inline feed as best I can tell) then I'd be set.
Questions:
Have I overlooked something obvious and there's a flag I can set to turn on this behaviour? I can see why, if such a flag exists, it would be off by default (EF lazy loading and this flag wouldn't get on well)
If #1 is no, is there some other ODataEntityTypeSerializer that I could use? If so, how do I switch to it?
If #2 is no, any pointers for where I should start writing my own? Is there a place I can substitute in my own serializer or do I have to maintain my own fork of ASP.NET's Extensions project (as opposed to the Runtime project)
Thanks very much!
$expand is very high on our list of things to support for OData. But as far as I know, we don't have any flag to turn it on server-side. The formatter doesn't currently allow you to substitute your own serializers either. So I'm afraid your only option in the meantime is to create a fork and add support for $expand. If you manage to get it working, please consider sending a pull request our way:
http://aspnetwebstack.codeplex.com/SourceControl/network
You can try it already in webapi nightly builds.
Here is how to install it with nuget:
http://aspnetwebstack.codeplex.com/wikipage?title=Use%20Nightly%20Builds