$Search not working in odata web api 2 - odata

I am unable to determine how to get $search parameter to work for full text search in odata.
The following url indicates that it should be included in 6.1
http://blogs.msdn.com/b/odatateam/archive/2014/03/21/odata-6-1-and-odata-client-6-1-are-now-shipped.aspx
I have created a sample application using the following template
http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/create-an-odata-v4-endpoint
When I execute the odata query
http://localhost:53621/odata/PartnerMaster?%24format=json&%24top=100&%24orderby=PartnerName&%24search=Test
I receive the error message.
message=The query parameter '$search' is not supported

:) See you again. Copy the answer here to let more people aware of it.
ODL supports to parse the $search query option, however, Web API OData doesn’t support it so far.
While, in ODL, you can refer the following test cases:
https://github.com/OData/odata.net/blob/master/test/EndToEndTests/Tests/Client/Build.Desktop/TripPinServiceTests/TripPinServiceTests.cs#L515-L576
https://github.com/OData/odata.net/tree/ae0dd29c1cf430255a8ec9c4225b4745e25cad64/test/FunctionalTests/Tests/DataOData/Tests/OData.Scenario.Tests/UriParser/Search
https://github.com/OData/odata.net/tree/ae0dd29c1cf430255a8ec9c4225b4745e25cad64/test/FunctionalTests/Tests/DataOData/Tests/OData.Scenario.Tests/UriParser/SearchCombination

Related

Issues With Twitter API V2 Elevated Access and has:geo Query Parameter

I have Elevated access to the Twitter API V2, and I am working with the API in Postman to search for recent Tweets containing a keyword. I’d like to be able to add a further query parameter to only return Tweets that have a geolocation associated with them. To do this, I am adding the has:geo parameter, as shown in the below URL call:
https://api.twitter.com/2/tweets/search/recent?query=dogs lang:en -is:retweet has:geo
However, this is returning with the following error:
There were errors processing your request: Reference to invalid operator 'has:geo'. Operator is not available in current product or product packaging. Please refer to complete available operator list at https://developer.twitter.com/en/docs/twitter-api/enterprise/rules-and-filtering/operators-by-product.
From my understanding, of this page in the documentation, the has:geo search operator is only available to accounts with Elevated Access to the V2 API (which I have).
If anyone has any suggestions of how I can get around this issue, that would be much appreciated please.
If you check the detail on that page, it further explains:
Twitter API v2
- **Essential**: Available when using any Project
- **Elevated**: Available when using a Project with *Academic Research access*
I agree that it is not sufficiently clear on that page, unless you re-read it (because "Elevated" and "Academic Research" are technically different access levels for your account).
The answer is that in order to use that search operator, you would need to have Academic Research access, not just Elevated access.

OpenUI5, oData v4: How to use server-side pagination via $skiptoken

In the release notes of OpenUI5 it says that since 1.72 server side pagination is supported.
https://openui5.hana.ondemand.com/1.72.1/#/topic/25e532617b7f4b9bad842757324151ed.html
But I can't see any reference to it, how it is used, how it is activated.
My questions are in particular:
Must the $metadata contain anything special to enable that?
How to force UI5 to send a $skiptoken URL parameter
Thanks in advance

Microsoft Graph API for Education: error listing user schools

I'm trying to retrieve the educationShool list of an educationUser from Microsoft Graph per the API reference:
I am getting this error:
Error message: The request URI is not valid. Since the segment
'memberOf' refers to a collection, this must be the last segment in
the request URI or it must be followed by an function or action that
can be bound to it otherwise all intermediate segments must refer to a
single resource.
I have reproduced this issue in the Graph Explorer, if I try to send this request, I get the same error:
https://graph.microsoft.com/v1.0/education/me/schools
If I try to list the Classes (I think it should be a very similar scenario), it works ok:
https://graph.microsoft.com/v1.0/education/me/classes
Am I doing something wrong, or is this a bug in the API?
I was able to reproduce this and it looks like there may be a bug here. While that gets investigated, I can confirm that it works properly in the /beta release:
https://graph.microsoft.com/v1.0/education/me/schools
I'd suggest using /beta for this particular call if possible.
Update: This issue has been resolved and education/{users}/schools should now be working in both v1.0 and Beta versions.

Filter and orderby query parameters not working for one drive graph api

I am trying to use filter and orderby query parameters to sort or filter the results. But the API is ignoring the query parameters and returning entire results.
https://graph.microsoft.com/v1.0/sites/{site_id}/drives?orderBy=name%20desc
I'm not sure why this isn't documented in the Microsoft Graph documentation (it should be), but from the OneDrive API documentation itself:
Note that in OneDrive for Business and SharePoint Server 2016, the orderby query string only works with name and url.
I've added an issue to the documentation's repository so this issue can hopefully get resolved in the future.
Although the original OneDrive API docs/Graph Drive API docs state they support orderby, but the actual OneDrive Graph API should be have not support filtering or ordering results. So although we pass the orderby parameter, when Microsoft Graph sees a query parameter it doesn't expect, it simply ignoring the unknown filter/orderby parameter and returning us an unfiltered/default-sorted result.
My test string:
https://graph.microsoft.com/v1.0/sites/my-site-id/drives?$select=id, name,webUrl&$orderby=name%20desc
So the only suggestion for you is to vote up the existing feature request in User Voice or submit a new one.

Office 365 Sharepoint API $skip/$skiptoken functionality

Going through the documentation for the Sharepoint API (located here: http://msdn.microsoft.com/en-us/library/office/dn605900(v=office.15).aspx) I am trying to figure out how to select chunks of documents. I was expecting $skip to work, as it is implied that most OData functionality should be present, but this doesn't work. I also can't figure out whether or not $skiptoken is a valid query param. It's listed in the documentation near the bottom (without further explanation), but I can't coax the proper result out of it so far.
If somebody knows about $skip or $skiptoken or another method available for getting chunked responses back, help with this problem would be great!
EDIT: to clarify, things like API_URL/files?$orderby=url&$top=5 work, but things like API_URL/files?$orderby=url&$skip=50 do not. However, I have just found a 'next' URL in the response which appears to provide server-side paging support. I'll try to figure out the use of $skiptoken from here.
The OData V4 protocol has specified (referencing 11.2.5.7 Server-Driven Paging) that:
OData services may use the reserved system query option $skiptoken when building next links. Its content is opaque, service-specific, and must only follow the rules for URL query parts.
OData clients MUST NOT use the system query option $skiptoken when constructing requests.
Thus, the implementation of the O365 SharePoint API that it publishes $skiptoken as a query option that the client should use for excluding first few items in the queried collection is a violation of the protocol. The client should use $skip for such scenario. But it seems from the O365 spec you attached that $skip is not implemented.
If you query a entity set of the O365 service and the response payload contains a next link (a #odata.nextLink annotation in the response JSON object), then it indicates that the service has server-side paging for the entity set. Typically the next link would be a URL containing the $skiptoken query option such as http://host/service/entityset?$skiptoken=n that the client can use for getting the next page.

Resources