Get Started with Event Knowledge API in C#
In this tutorial, we will build a Windows WPF application that explores the Event Knowledge Service by specifying a date, using a Wikipedia entity name or providing an event ID.
Table of Contents
- Visual Studio 2015
- A Microsoft Cognitive Services API Key
- Get the client library and sample code
- Microsoft Event Knowledge NuGet Package
Before using Event Knowledge Service, you must sign up and obtain a EventKnowledge API subscription key. See Subscriptions. Both the primary and secondary key can be used in this tutorial.
The EventKnowledge API client library is a thin C# client wrapper for Microsoft Cognitive Services (formerly Project Oxford) EventKnowledge REST APIs.
You may download the client library and sample code via SDK. The downloaded zip file needs to be extracted to a folder of your choice, many users choose the Visual Studio 2015 folder.
Start Microsoft Visual Studio 2015 and select File > Open > Project/Solution.
Starting in the folder where you clone the repository, go to EventKnowledge > Windows > Sample-WPF Folder.
Double-click the Visual Studio 2015 Solution (.sln) file EventKnowledgeAPI-WPF-Samples.
Press Ctrl+Shift+B, or select Build > Build Solution.
After the build is complete, press F5 to run the sample.
Locate the text edit box saying "Paste your subscription key here to start" on the top right corner. Paste your subscription key. You can choose to persist your subscription key in your machine by clicking "Save Key" button. When you want to delete the subscription key from the machine, click "Delete Key" to remove it from your machine.
Click on "Select Scenario" to use samples of different scenarios, and follow the instructions on screen.
Example results for each scenarios are shown below.
Get Trending Events by Date
Get Events by Wikipedia Entity
Get News in Given Event
In this tutorial you’ve learned the basic functions of Event Knowledge Service. More SDKs and samples can be found in here.