Exact text searches with the Microsoft Graph API - microsoft-graph-api

Can we do exact text searches using the the Microsoft Graph API?
I know the endpoint for search is:
GET /me/drive/root/search(q='{search-query}')
The documentation is unclear about what to pass into the search query (q) parameter.
The query text used to search for items. Values may be matched across several fields including filename, metadata, and file content.
I have tried double quote formats
https://graph.microsoft.com/v1.0/me/drive/root/search(q='"Bob Bowen"')
and '+' formats
https://graph.microsoft.com/v1.0/me/drive/root/search(q='Bob+Bowen')
I'm running these queries using the "Try it" button on the Microsoft Graph Explorer and I'm expecting them to return nothing because the words "Bob Bowen" shouldn't exist in the sample drive. But I'm always getting some document hits, because the exact text search isn't working.

I just happened to have
IDriveItemSearchRequestBuilder searchRequest = graphServiceClient.Me.Drive.Root.Search(searchFile);
var searchResult = searchRequest.Request().GetAsync().Result.ToList();
In other variants, authorization error

Related

Using period / dot when searching users by email on Microsoft Graph API and ODATA return no results

I'm using Microsoft Graph API to get all users from my directory that have their email address starting with a given value.
All is working well except when my value contains a period / dot. In this case, the Graph API returns no result.
How can I search all users with their email starting by a given value containing a period / dot.
Here's an example.
The following request works fine:
https://graph.microsoft.com/v1.0/users?$filter=startsWith(displayName, 'john')
The following request (containing a dot in the odata query) returns no results
https://graph.microsoft.com/v1.0/users?$filter=startsWith(displayName, 'john.d')
I already tried to encode the dot / period with %2E and it does not work:
https://graph.microsoft.com/v1.0/users?$filter=startsWith(displayName, 'john%2ed')
Does anybody know how I can do that ?
Thanks !
Based on my test, dot should work in this filter query.
If we want to search the users by email. we could $filter the field mail not the field displayName.
https://graph.microsoft.com/v1.0/users?$filter=startsWith(mail, 'john.d')

How to get yahoo finance stock data?

I have created and API on deevloper.yahoo.com and in yql console https://developer.yahoo.com/yql/console.
Tick show community table and search for finance.
I got result of stock data.Here I got exact data for historical data in josn and xml format.
Link for historical data yahoo.finance.historicaldata.
like I got all data
http://finance.yahoo.com/q/hp?s=AAPL+Historical+Prices and rest query for this stock is
yql?q=select%20*%20from%20yahoo.finance.historicaldata%20where%20symbol%20%3D%20%22YHOO%22%20and%20startDate%20%3D%20%222009-09-11%22%20and%20endDate%20%3D%20%222010-03-10%22&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=
when I try to other stocks like yahoo.finance.balancesheet and other stock
I see the parameter I send in url is wrong specially where condition in other stock option
Can any one tell what will be exact url for other stock option.
What you appear to want is:
https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.historicaldata where symbol = "YHOO" and startDate = "2009-09-11" and endDate = "2010-03-10"&format=json&diagnostics=true&env=store://datatables.org/alltableswithkeys&callback=
You can feed that URL to, for instance, wget, and it will return a blob of JSON.
Where did I get that URL? I started the YQL Console with Show Community Tables checked. Next, I entered your query (the q parameter in the above) and received back valid looking JSON. Finally, I went down to the bottom of the page, where it says THE REST QUERY in green, and copied the URL out of the box.

Dailymotion Graph API Search string

I am unable to get Dailymotion Graph API to do a search on a multiple word term. For example:
https://api.dailymotion.com/videos/?search=%22glacier+national+park%22&page=1&limit=3
Will still search on each word separately.
If I &sort=relevance, then it is fine, but if I'd like to sort differently, it will pull titles with only the word "national" in them, and not restrict to the full term.
Their own Graph API tool mimics this:
https://www.dailymotion.com/doc/api/explorer#/video/list
It almost seems like it is a bug, but prolly I'm just not finding the right syntax.
TIA!
Good news, you can do a search on multiple terms by using quotes around words.
Hence your request:
https://api.dailymotion.com/videos/?search=%22glacier+national+park%22&page=1&limit=3
should return what you're looking for!

Google Drive Api not returning results by descending order of number of occurrences of word

I am using Google Documents List API for searching within documents.
Searching on the google drive ui returns results with most number of occurences of words first. But with api it returns the results with last uploaded date first.
This is the URL which i am using https://docs.google.com/feeds/default/private/full?q=search+term
I also tried with https://docs.google.com/feeds/default/private/full?q=search+term&desc=true but this gave the same results that we were getting earlier i.e. by last uploaded date first.
Can someone guide me with what additional parameters i should be adding to the url
You can use the orderBy query parameter to order the Documents List Feed by certain criteria:
last-modified: Default value, sort by last modified date.
last-accessed: sort by last accessed date.
title: sort by title (this is what you're looking for.
starred: sort documents by their "starred" attribute.

YQL documentation for the google.news search and the "geo" key

Someone know some documentation of Yql Google News Search? I am trying understand the "geo" key values for the search.
This link show a example for the search.
Thanks and sorry for my bad english.
Cleber.
For details of the usage of the different keys on the YQL google.news table, see the source API's documentation.
In this case that can be found in the Google News Search API - JSON Developer's Guide, and the geo key is described as:
This optional argument tells the News Search system to scope search results to a particular location. With this argument present, the query argument (q) becomes optional. You must supply either a city, state, province, country, or zip code as in geo=Santa%20Barbara or geo=British%20Columbia or geo=Peru or geo=93108.
It goes on to say:
When using the geo property, please note the following:
Make sure the location you supply exists within the scope of your chosen news edition. For example, if you specify geo=Quebec for the Canadian edition of Google news, you probably won't get good results.
You can't combine geo with the topic property.
Some editions of News Search don't support the geo parameter. To test if geo works with a specific edition,
Go to that edition's landing page (for example, news.google.ca)
Click Add a Section.
In the Add a Local Section box on the right side of the page, enter a search query relevant to your desired location (for example, Quebec). You should now see a Local Results pane on the edition homepage.
If the Local Results pane is populated with results, you can use the geo parameter for that region.

Resources