Hello! I’m Moe Khosravy and run the Dallas business at Microsoft… By now, I hope you’ve had a chance to hear about Dallas and what it can do for you. (If not – please read the overviews!) In this short post, I want to show how easy it is to consume content programmatically from Dallas –starting from the initial visual exploration all the way to actually consuming the proxy classes generated by Dallas for the content brokered through our platform… I hope you enjoy!
A Quick Overview of Dallas
As you browse through the content catalog and subscribe to datasets in Dallas, you’ve probably noticed that you can visually explore and preview any service (blob, structured, real-time data) to understand how you’d like to build applications or perform analytics before you write a single line of code. In this quick post, we’ll use the Associated Press AP Online as an example of how Dallas works – showing how to preview, code, and analyze data...
In the Dallas Service Explorer, issuing a quick Preview on any configured dataset (referred to as a Series in Dallas lingo) will allow you to see the data in a friendly table view in addition to ATOM and RAW formats. (Images, Videos, and 3D model previews coming soon) To build up requests, use the question mark icons to learn more about the possible parameters, then fill in the values to explore the services. Hit Preview to visualize or hit Invoke to issue a REST call and see the ATOM/RAW data.
To analyze a particular dataset, simply fill in the parameters for the call and hit Analyze to perform instant one-click BI in Office and SQL Server. (CTP1 requires PowerPivot to be installed to leverage the one-click BI within Excel)
NewsCategories service results in the list of categories for which you can get news and media headlines as well as articles. The Id field represents the category ID that can be supplied to the other APIs to get more details. As an example, if I wanted to build a quick app to show me the latest High Tech News, I see that from the table below (or by programmatically asking for all categories), the Id I’m interested in is 32005. Using the Service Explorer, I can build up my REST URL visually by switching to the NewsByCategory Series and choosing to show a preview for category ID 32005.
Now, let’s consume this content programmatically. Note, while I’m showing the C# helper APIs that are dynamically generated for all datasets offered by Dallas, you can simply issue a REST call on any platform by including your accountID and userID in the HTTP header, as showing in the proxy class download section. Simply refresh the link, copy the resulting link to the clipboard, and copy/paste in your source to issue a secure call. Consuming Dallas content will typically cost you two lines of code but we’ll break it out to show some details. To start, download the Proxy Class and include it in your project. (You’ll need .NET Fx 3.5 SP1 to use the helper classes).
Once added, simply add a reference to the Dallas APIs:
Now, create an instance of the NewsByCategoryService by passing in your accountKey and a userID. Your account key is YOUR private key used to authenticate your calls with Dallas. This will be placed in the header of the HTTPS request and
//Instantiate the service, providing your account key and userID.
NewsByCategoryService news = new NewsByCategoryService(myAccountKey, idUser);
//Invoke the service for the High Tech News category.
//Indicate we want only Headlines by specifying “0” (or “2” for full content)
List<NewsByCategoryItem> items = news.Invoke("32005","0", 20);
myDataGridView.DataSource = items;
That’s all there is to it! So for any service in Dallas, simply:
1. Subscribe to the dataset
2. Explore the APIs through the Service Explorer
3. Download the Proxy Classes (or refer to the URL and issue secure REST calls)
4. Enjoy and provide feedback!
Call to Action:
· Developers: what content do you want to see? How would you like to get access to these? (APIs, use cases, etc)
· Content Providers: Have premium content or web services you’d like to sell globally?
Visit http://www.microsoft.com/windowsazure/dallas to learn more!