Introducing the OneNote Search API (Beta), powered by Bing

 

Hi All,

When we first started working on the API we had the vision to make OneNote the one-stop-shop for anything people want to remember - whether that be work or personal. Search is a key part of that vision and today we are announcing the availability of the OneNote Search API in Beta.

Over the last few months, we have been partnering with the folks over in Bing to integrate their search tech into our service and bring the power of full text search to the OneNote API. It's like having your own personal search engine for your private notes and memories in the cloud. And, because we are reusing the same search tech powering bing.com today, the OneNote search API has all the smarts you would expect from Bing such as: spelling forgiveness, stemming, relevance and ranking, word breaking, phrase search, etc. The search API works across notebooks so your app can find the right notes for the user no matter where they are stored. Under the covers, there is a personal index per user so searches are scoped to only the notebooks the user has access to. 

Ready to give it a shot? Here's how to get started:

1) Sign up for the Beta
Sign up so we can index your notebooks. Click the "Sign Up" button below, sign in with your Microsoft account if/when prompted, and grant read permissions to the OneNote Developer Blog App.

Note: During the Beta it could take up to 2 hours for your notebooks to get picked up by the indexer. We appreciate your patience. 

2) Try searching your notes
If you've tried other OneNote APIs in Beta it is very likely we have you covered already. Best way to find out is by trying a few search queries below. If you get some page results back, congratulations, we have indexed your notebooks and you are ready to go.

Searching across notebooks
Using the search API your app can search across all notebooks owned by the user. To do so you should ask the user to grant your app at least one of the 2 permission scopes below depending on what your app needs to do:

1) office.onenote - Use this scope if your app needs to search all pages across all notebooks the user owns. 

2) office.onenote_update_by_app - Use this scope if your app needs only to search the pages created by itself.   

To make a search call simply issue an HTTP GET to: https://www.onenote.com/api/beta/pages?search=foo, where foo is the search term you want to look for. The response will be identical to the query pages response outlined in this post
 

Searching within a section
You can also scope search queries to a particular section by making a GET request to: https://www.onenote.com/api/beta/sections/{id}/pages?search=foo , where {id} is the id of the section. 

Search and OData
Finally, you can combine the search verb with any of the OData verbs we already support  (check out this post for reference) such as filter, select, orderby, etc. You can try these and other queries using our Apigee console. For instance:

Let's say you want to scope your search to only pages created as of 6 months ago. You can do that as follows:

GET https://www.onenote.com/api/beta/pages?search=foo&filter=createdTime gt 2014-05-17 

Or perhaps you want to get the next page of search results. Then you can write your request as:  

GET https://www.onenote.com/api/beta/pages?search=foo&skip=20, where skip is the item offset. You can also use top to specify a different page size up to a max of 100 results per page. 

 

There you have it. Now you can use search in conjunction with page updatepage recall, and page query to light up some interesting scenarios. 

Coming soon:

  • Support for searching across notebooks shared with the user
  • Scope search queries to a particular notebook
  • Support for page last modified time
  • Relevance and ranking improvements

As always, we are looking for your feedback. Leave your comments below and let us know what you like and what should we add/change before releasing the OneNote Search API to production. 

Happy coding,

-Omar