Hands-on Yahoo Mail Web Services API

INTRODUCTION


Web Application developers now have access to massive user presence and data from facilities such as "Yahoo Mail", "Microsoft's Windows Live" and "Google's Apps".

The business driver behind these APIs is to gain their share of eye balls and to put the best family of applications that can help keep life around us simplified and enjoyable.


Each one of these APIs come with excellent set of documentation and sample programs. However, it is rare for any set of documentation to possibly answer all the questions of the developers. So, we undertake a hands-on exposition of the APIs and this usually tends to bring out the developer connection to these APIs.

Problem Statement


a. Use Cases and System Overview

The goal here is to test drive the yahoo mail services API Version 1.0.0.0. Figure 1. above identifies typical use cases for an email service. We need to identify the use cases that we will test drive in this excercise.

One of the more interesting use cases is, "searching an emailbox". Unfortunately, yahoo mail APIs allows this only for those premieur accounts. Hence in this excercise, we shall settle for a lesser use case, namely, managing your mail folders, if you have a regular yahoo account.

**Notice that while Yahoo Mail APIs can be unleashed on a full service premieur user Account, you will have limited functionality with regular accounts.

b. Provide Feedback

We will take lessons learnt from our hands-on excercise and provide feedback to the companies through their developer network, where it may benefit even more developers.

YAHOO MAIL WEB SERVICE APIS


The Yahoo mail web services API is simply a web accessible Interface providing access to the yahoo mail facilities.

In geek speak, if you are familiar with namespaces and Interfaces, yahoo mail apis are part of a name space called YmwsSample. The later sections invoke a small subset of the API.

LIFE ACCESSING YAHOO MAIL FACILITIES


An application gaining access to the yahoo mail facilities goes through four stages. Figure 2.0 provides a birds eye view of the stages and this section explores them in more detail.


Step 1. Register your Application


As an application developer, yahoo requires you to register your application with Yahoo's Login facilities.

Yahoo End Point:

As a result of the registration, your application is provided with,

A.) An AppID

This appears to be a 40-character string. For .e.g, the following string closely resembles an AppId issued by the yahoo facilities, "V4HzGd7IkY6UOQEn0gF2za4pteR9sRPwxLCBHSA-"

B.) a secret pass phrase

This is a string that resembles to, "65ca4c0b73833687342b5d4a6d8f555d5"

Your application uses this information to later identify itself as a registered application to any of the yahoo facilities it tries to access, such as the yahoo mail or yahoo photos.

Step 2. User Authorization


Once, you are an yahoo registered application, you are one step closer to accessing the yahoo mail facilities.

a. "Establish a Data Session"

Your application needs to establish an user authorized data session with yahoo facilities prior to accessing the user data. Once your application establishes a session, it remains valid for a set time frame of about 14 days, as decided by yahoo. At the end of the session period, your application needs to re-establish a new session. Yahoo returns a token that represents the data session.

b. "Get User Credentials"

When the user authorizes access to their data, your application is provided with the equivalent of an username and password. This information needs to be passed along with every call to the Mail web service APIs. Yahoo calls them the WSSID and the auth cookie, respectively.

Step 3. Accessing the Mail Service API


The Yahoo mail web services Interface definition can be imported or referenced into your project. The interface and the namespace that it contains is named as "YWMSSample" and the "YmwsSample.com.yahooapis.mail" respectively.

In case, you are developing a C# application, Yahoo provides a pre-built DLL that has the type library defined and a sample program that calls each of these APIs.

0 comments:

Post a Comment