Saturday, May 29, 2010

Import Yahoo Contacts To your Application

HI..
I got the contacts Successfully

If u have to get u have to get the console like this..Hope it may help u..

U will get the response from yahoo like this
{oauth_expires_in=3600, oauth_authorization_expires_in=872618929, oauth_token_secret=66010cfec37f5b1121a6c18869bd30bd037824ac, oauth_session_handle=AG6dzkvNFiwHTLHGkoAq.NqnOogQHCBmq2M0UEI9xFu9bzIPIZU-, xoauth_yahoo_guid=QJDSW7OMO4XUM7PHUPD3YMKUKM,

oauth_token=A%3D1r_o0i7njjnX.ZY.....{hidden for clear view}.....HfKRxOYdCwqS1h}

after decode oauth_token= A=1r_o0i7njjnX.Z.....{hidden for clear view} ......CwqS1h

with the decode u have to create base signature
while creating base String u must follow alphabetic order i.e

oaup.setOAuthConsumerKey(key);
oaup.setOAuthNonce(OAuthUtil.getNonce());
oaup.setOAuthSignatureMethod("HMAC-SHA1");
oaup.setOAuthTimestamp(OAuthUtil.getTimestamp());
oaup.setOAuthToken(URLDecoder.decode(accMap.get("oauth_token"),"utf-8")); //any encoding method u can use "ustf-8"

u have to create the base string with version.version must be encode like this %26oauth_version%3D1.0

base string will be look like this

Base String GET&http%3A%2F%2Fsocial.yahooapis.com%2Fv1%2Fuser%2FQJDSW7OMO4XUM7PHUPD3YMKUKM%2Fcontacts%3Bcount%3Dmax&oauth_consumer_key%3Ddj0yJ.....{hidden for seq}...k1qWXQ5%26oauth_nonce%3D20771471391078%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1274864453%26oauth_token%3DA%253D1r_o0i7njjn.....{hidden for clear view}......qS1h%26oauth_version%3D1.0

with this base string u have to create signature...form consumer secret,token secret

Signature after Encode Tfl1PIz0ygajusoyXohUQfr0hJA%3D

All of this information can sen to headers i Used Headers

Authorization: OAuth
realm="http%3A%2F%2Fyahooapis.com%2F",
oauth_consumer_key="dj0yJmk9TVIyQ.........{Hidden for Seq}.................dCZ4PWQ5",
oauth_nonce="20771471391078",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1274864453",
oauth_token="A%3D1r......{Hiden for clear view}.....wqS1h",
oauth_version="1.0",
oauth_signature="Tfl1PIz0ygajusoyXohUQfr0hJA%3D"

Hope this may works for u

By doing this you will get.I Succeeded by doing this way