0

Import Contacts :: Javascript / JSON

Hey,

I'm writing this post after 3 hours of trying to understand where the heck I start from.

I'm using asp & javascript in my website,
and I can't understand how do I import contacts from any account who entered and granted access to my website.

I did it in Gmail and it was easy but I feel lost in Yahoo!.
Too much information, I'm drowning, help!

All I wanna do is popup that goes to yahoo, asks the user to grant me access to his contacts and returns a JSON array with their info.

please help.
I'm lost!

by
5 Replies
  • I too am having trouble with the Import contacts API. I am able to get all the way to an access token, but once there, when I try to use the given xoauth_yahoo_guid in the "http://social.yahooapis.com/v1/user/{0}/contacts" url, I get unauthorized errors. I have tried adding in the oauth tokens, both the ones from the request token and from the access token, but I still get an unauthorized error. Here is what my code looks like for building the url, and I use the basic OAuthBase class that was made for C#. Note, building it this way worked for every other step in the OAuth sequence. This is in a method that took an AccessToken class called token:

                OAuthBase oauth = new OAuthBase();

                 Uri uri = new Uri(string.Format("http://social.yahooapis.com/v1/user/{0}/contacts", token.xoauth_yahoo_guid));
                 string nonce = oauth.GenerateNonce();
                 string timeStamp = oauth.GenerateTimeStamp();
                 string sig = ConsumerSecret + "%26" + token.oauth_token_secret;

                 StringBuilder sbAccessToken = new StringBuilder(uri.ToString());
                 sbAccessToken.AppendFormat("?oauth_consumer_key={0}&", ConsumerKey);
                 sbAccessToken.AppendFormat("oauth_signature_method={0}&",
                             "PLAINTEXT"); //HMAC-SHA1
                 sbAccessToken.AppendFormat("oauth_signature={0}&", sig);
                 sbAccessToken.AppendFormat("oauth_timestamp={0}&", timeStamp);
                 sbAccessToken.AppendFormat("oauth_version={0}&", "1.0");
                 sbAccessToken.AppendFormat("oauth_token={0}&", token.oauth_token);
                 sbAccessToken.AppendFormat("oauth_nonce={0}&", nonce);
                 sbAccessToken.AppendFormat("oauth_session_handle={0}", token.oauth_session_handle);
    0

  • I am not getting Request Token (get_request_token)
     but getting error as File not found

    Somebody please respond.
     
    0
  • I forgot to mention that I'm using Java now

    QUOTE (Liby @ 29 Dec 2011 3:38 AM)
    I am not getting Request Token (get_request_token)
     but getting error as File not found

    Somebody please respond.
     
    0


  • QUOTE (Liby @ 29 Dec 2011 3:39 AM) I forgot to mention that I'm using Java now

    QUOTE (Liby @ 29 Dec 2011 3:38 AM)
    I am not getting Request Token (get_request_token)
     but getting error as File not found

    Somebody please respond.

    --------------------
    may be will help

    try to use wget , curl or lynx , then it will also download body of response where you will able to see error code .
     
    0
  • Kevin, did you find a solution to your problem? I am facing the same issue. Any help would be appreciated.

    Thanks
    -Awais


    QUOTE(Kevin @ 9 Nov 2011 4:20 PM)
    I too am having trouble with the Import contacts API. I am able to get all the way to an access token, but once there, when I try to use the given xoauth_yahoo_guid in the "http://social.yahooapis.com/v1/user/{0}/contacts" url, I get unauthorized errors. I have tried adding in the oauth tokens, both the ones from the request token and from the access token, but I still get an unauthorized error. Here is what my code looks like for building the url, and I use the basic OAuthBase class that was made for C#. Note, building it this way worked for every other step in the OAuth sequence. This is in a method that took an AccessToken class called token:

                OAuthBase oauth = new OAuthBase();

                 Uri uri = new Uri(string.Format("http://social.yahooapis.com/v1/user/{0}/contacts", token.xoauth_yahoo_guid));
                 string nonce = oauth.GenerateNonce();
                 string timeStamp = oauth.GenerateTimeStamp();
                 string sig = ConsumerSecret + "%26" + token.oauth_token_secret;

                 StringBuilder sbAccessToken = new StringBuilder(uri.ToString());
                 sbAccessToken.AppendFormat("?oauth_consumer_key={0}&", ConsumerKey);
                 sbAccessToken.AppendFormat("oauth_signature_method={0}&",
                             "PLAINTEXT"); //HMAC-SHA1
                 sbAccessToken.AppendFormat("oauth_signature={0}&", sig);
                 sbAccessToken.AppendFormat("oauth_timestamp={0}&", timeStamp);
                 sbAccessToken.AppendFormat("oauth_version={0}&", "1.0");
                 sbAccessToken.AppendFormat("oauth_token={0}&", token.oauth_token);
                 sbAccessToken.AppendFormat("oauth_nonce={0}&", nonce);
                 sbAccessToken.AppendFormat("oauth_session_handle={0}", token.oauth_session_handle);
    0

Recent Posts

in Contacts