220 likes | 359 Views
This presentation, delivered to the Indy .NET Developer's Association by Denise Gosnell, discusses the essentials of professional development through the utilization of Web APIs. Based on her book, it covers various APIs from Google, eBay, PayPal, Amazon, and others, emphasizing practical usage, calling methods, and creating your own API. Gain insights into the technologies that enable interaction with web services, including REST, SOAP, and XML, while also learning how to call these APIs from mobile devices and office environments. The source code for the presentation is available for download.
E N D
Professional Development with Web APIs Presented To: Indy .NET Developer’s Association By: Denise Gosnell denise@denisegosnell.com July 14, 2005
Based On Topics In My New Book: • Professional Development with Web APIs • Google, eBay, PayPal, Amazon.com, MapPoint, UPS, FedEx (April 2005) • This Presentation Is Available For Download from www.denisegosnell.com/news.html • The Source Code for the book is available for download from www.wrox.com.
Outline of Topics • What Is A Web API? • Google API • MapPoint API • Amazon.Com APIs • eBay API • PayPal API • Other APIs • Calling From Mobile Devices and Office • Creating Your Own API
What Is a Web API? (Chapter 1) • Series or collection of web services • Sometimes used interchangeably with “web services” • Examples: Google API, Amazon.Com APIs
How Do You Call a Web API? • XML web services can be invoked in one of three ways: • Using REST (HTTP-GET) • URL includes parameters • Example: http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&SubscriptionId=YOURIDGOESHERE&Operation=ItemSearch&SearchIndex=Books&Keywords=Denise%20Gosnell • Using HTTP-POST • You post an XML document • XML document returned • Using SOAP • More complex, allows structured and type information
The Google API (Chapter 2) • Available Using SOAP with HTTP • Limited to 1000 Calls Per Day • Obtain a Developer Key and Developer’s Kit From: • www.google.com/apis/ • Query Syntax: • doGoogleSearch (Key, SearchString, Start, MaxResults, Filter, Restrict, SafeSearch, lr, ie, oe) • Returns only 10 results at a time – have to change the start index to specify which ones to retrieve • doGetCachedPage (Key, URL) • doSpellingSuggestion (Key, Phrase)
The MapPoint API (Chapter 3) • Can Be Called Using SOAP with HTTP • Examples of Supported Features: • Addresses • Reverse Geocoding • Finding Nearby Places • Custom Locations • Map Rendering • Points of Interest • Evaluation Account / Developer Account: http://www.microsoft.com/mappoint/webservice/default.mspx
The Amazon.Com APIs (Chapter 4) • There Are Currently 3 Amazon.Com APIs • Amazon E-Commerce Service (ECS) • Alexa Web Information Service (AWIS) – programmatic access to www.alexa.com web crawl data • Simple Queue Service • All 3 Can Be Called Using SOAP or HTTP-GET(REST) • Info About These 3 Can Be Found At: http://www.amazon.com/gp/browse.html/102-3193582-7147314?%5Fencoding=UTF8&node=3435361 • Sign Up For Subscription ID at: http://www.amazon.com/gp/aws/registration/registration-form.html • Mention www.a9.com which uses one or more of Amazon.com APIs above
Amazon.Com Demo • Create a New VB.NET WinForms Project • Add a reference to the Amazon.com API (Project | Add Web Reference): http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl • Then, add the following code to your VB.NET WinForms project: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim AmazonProductData As New _ TestAmazonWebService.Amazon.AWSECommerceService Dim AmazonSearch As New TestAmazonWebService.Amazon.ItemSearch Dim AmazonResponse As New _ TestAmazonWebService.Amazon.ItemSearchResponse Dim AmazonRequest(1) As _ TestAmazonWebService.Amazon.ItemSearchRequest 'Developer/Subscription Code AmazonSearch.SubscriptionId = "YOUR ID GOES HERE" 'We are only making one request, not batching multiple requests 'Thus element 0 of the array is all we need to assign and work with AmazonRequest(0) = New _ TestAmazonWebService.amazon.ItemSearchRequest AmazonRequest(0).SearchIndex = "Books" AmazonRequest(0).Keywords = “Denise Gosnell"
Amazon.Com Demo (continued) 'assign the search object to the request object with the assigned parameters AmazonSearch.Request = AmazonRequest 'run the search and populate the response AmazonResponse = AmazonProductData.ItemSearch(AmazonSearch) Dim item As New TestAmazonWebService.Amazon.Item Dim strOutput As String strOutput = "Search results for keyword(s): " & AmazonRequest(0).Keywords & " in " & AmazonRequest(0).SearchIndex & ":" & vbCrLf & vbCrLf 'loop through the results For Each item In AmazonResponse.Items(0).Item strOutput = strOutput & item.ItemAttributes.Title & vbCrLf & vbCrLf Next 'display the results in a message box MsgBox(strOutput) End Sub
The eBay API (Chapter 5) • eBay API can be called using HTTP-POST or SOAP • Sandbox (Test) and Live Environments • Supports most popular features: • Retrieve Auction Listings • Retrieve Customer Reviews • Retrieve Status of Auction • Add New Auction Listing • Retrieve Winning Details • Join Developer Program and Obtain Account: http://developer.ebay.com
The PayPal API (Chapter 6) • PayPal API can be called using SOAP • Sandbox (Test) and Live Environments • Supports several features: • GetTransactionDetails • TransactionSearch • RefundTransaction • MassPay • Join Developer Program and Obtain Account: http://developer.paypal.com
Demo – Combining APIs (from Chapter 11 Case Study) • Uses Google To Retrieve Top 5 web Sites That Mention Your Customer • Uses MapPoint To Retrieve Map And/Or Driving Directions To Customer Location
Other APIs (Chapter 7) • InterFax Fax API • http://www.interfax.net/en/dev/index.html • UPS API • http://www.ec.ups.com/ecommerce/gettools/prodcompanies.html • FedEx API • http://www.fedex.com/us/solutions/wis/index.html (some require DLLs) • Bloglines API • http://www.bloglines.com/services/
Finding More Web APIs • UDDI Directory • http://uddi.microsoft.com • BindingPoint Web Site • http://www.bindingpoint.com • Various Other Locations On Internet
Calling From Mobile Devices (Chapter 8) • Use .NET Compact Framework In Visual Studio.NET To Target Pocket PCs and SmartPhones • Just Select Project Type In VS.Net • http://www.microsoft.com/windowsmobile • eMbedded Visual Tools • Use To Create Separate From VS.Net • Web Services For Palm • http://pluggedin.palmone.com/regac/pluggedin/WebServices.jsp
Calling From Microsoft Office (Chapter 9) There Are At Least 3 Ways To Call Web API From Microsoft Office Programs: • VBA • Example in Excel using VBA and HTTP/GET (REST) • VBA using SOAP • requires Web Services Toolkit (available for free download from Microsoft) • Using .NET • requires Visual Studio Tools for Microsoft Office System – must purchase
Creating Your Own APIs (Chapter 10) • Create New ASP.NET Web Service Project from VS.NET • Add Code • Test The Web Service Using Built-In Testing Utility In Web Browser • Call Web Service From Another Program Using Protocols You Enabled For Service • Can Also Convert Existing .NET App To Web Service By Wrapping With WebMethod Attribute