0

/user/me/contacts doesn't work?

I have beening using http://social.yahooapis.com/v1/user/me/contacts to get contacts, but there are some strange issues.

when using request:
GET /v1/user/me/contacts?realm=yahooapis.com&oauth_consumer_key=dj0yJmk9VHdibDFmNFZ2OFFVJmQ9WVdrOVFtMXpOVUZVTjJNbWNHbzlPV
FV6TmpZM01UYzMmcz1jb25zdW1lcnNlY3JldCZ4PTQz&oauth_nonce=94008223003026651226916750122691675512269167941226916795&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1226916795&oauth_token=ap2xqr&oauth_version=1.0&oauth_signature=OVdQYhAycLKAqOm%2FV3dAQrt5yFA%3D HTTP/1.1
Authorization: OAuth realm="yahooapis.com", oauth_consumer_key="dj0yJmk9VHdibDFmNFZ2OFFVJmQ9WVdrOVFtMXpOVUZVTjJNbWNHbzlPVFV6TmpZM01UYzMmcz1
jb25zdW1lcnNlY3JldCZ4PTQz", oauth_nonce="94008223003026651226916750122691675512269167941226916795", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1226916795", oauth_token="ap2xqr", oauth_version="1.0", oauth_signature="OVdQYhAycLKAqOm%2FV3dAQrt5yFA%3D"
User-Agent: Java/1.5.0
Host: social.yahooapis.com
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-type: application/x-www-form-urlencoded

it responses with:

HTTP/1.1 401 Authorization Required
Date: Mon, 17 Nov 2008 10:11:32 GMT
WWW-Authenticate: OAuth oauth_problem="parameter_rejected", realm="yahooapis.com"
Content-Type: application/xml
Age: 0
Transfer-Encoding: chunked
Connection: keep-alive
Server: YTS/1.17.9

124
<?xml version='1.0' encoding='UTF-8'?>
<yahoo:error xmlns:yahoo='http://yahooapis.com/v1/base.rng'
xml:lang='en-US'>
<yahoo:description>Please provide valid credentials</yahoo:description>
</yahoo:error>
<!-- ws8.socdir.re1.yahoo.com uncompressed/chunked Mon Nov 17 02:11:32 PST 2008 -->


Then I turn to delete the parameter realm="yahooapis.com" in the request, however it responses with:

HTTP/1.1 401 Authorization Required
Date: Mon, 17 Nov 2008 10:31:25 GMT
WWW-Authenticate: OAuth oauth_problem="token_rejected", realm="yahooapis.com"
Content-Type: application/xml
Age: 0
Transfer-Encoding: chunked
Connection: keep-alive
Server: YTS/1.17.9

125
<?xml version='1.0' encoding='UTF-8'?>
<yahoo:error xmlns:yahoo='http://yahooapis.com/v1/base.rng'
xml:lang='en-US'>
<yahoo:description>Please provide valid credentials</yahoo:description>
</yahoo:error>
<!-- ws10.socdir.re1.yahoo.com uncompressed/chunked Mon Nov 17 02:31:25 PST 2008 -->

0


Any one have some suggestions? Thanks.

by
5 Replies
  • Hi bjliuqi,

    I'm looking through the contact API docs and am not seeing documentation supporting "me" in a contact fetch URL: http://developer.yahoo.com/social/rest_api...s-resource.html. If I just missed it in the docs please let me know and we'll take additional steps. I wasn't able to collect my contacts either when trying this (same responses you received). What you can do is to specify the viewer guid itself (obtainable when you get a yahoo user session using something like $yahoo_user->guid). The code block I used to get a successful contacts request was something along these lines:

    CODE
    //initializes session and redirects user to Yahoo! to sign in and then authorize app
    $yahoo_session = YahooSession::requireSession(API_KEY, SHARED_SECRET);

    //get currently logged in user
    $yahoo_user = $yahoo_session->getSessionedUser();

    $response = $yahoo_session->client->get('http://social.yahooapis.com/v1/user/'.$yahoo_user->guid.'/contacts');
    if(is_null($response) || $response["code"] != 200) { echo "<h1>NOT FOUND</h1>"; }
    $contactList = json_decode($response["responseBody"]);
    var_dump($contactList);
    1
  • Jon,

    Thanks for your reply. The issue is that I can't get GUID now. Do you have a look at my smple codes I sent to your email? I got from Yahoo Document that we could get GUID via sending request: http://social.yahooapis.com/v1/me/guid. I am trying to do that using Java:

    1. get request token.
    2. launch authorization page in browser and let users to input user name & password to allow the application to access its private data, e.g, blog, connection, etc
    3. exchange token to get access token
    4. send request http://social.yahooapis.com/v1/me/guid to obtain user guid. -> Can't work.

    It seems something wrong. Could you point out where it is?

    As you mentioned below, we generally should obtain guid via Yahoo seesion, so i am confusing that in case I mention above we can't get some stuff about Yahoo session. How could we get guid via sending request http://social.yahooapis.com/v1/me/guid? For example, in step 2, I let two users to do authorization and both the users allow the application to access its data, how to deal this situation?
    QUOTE (Jon @ Nov 19 2008, 08:36 AM) <{POST_SNAPBACK}>
    Hi bjliuqi,

    I'm looking through the contact API docs and am not seeing documentation supporting "me" in a contact fetch URL: http://developer.yahoo.com/social/rest_api...s-resource.html. If I just missed it in the docs please let me know and we'll take additional steps. I wasn't able to collect my contacts either when trying this (same responses you received). What you can do is to specify the viewer guid itself (obtainable when you get a yahoo user session using something like $yahoo_user->guid). The code block I used to get a successful contacts request was something along these lines:

    CODE
    //initializes session and redirects user to Yahoo! to sign in and then authorize app
    $yahoo_session = YahooSession::requireSession(API_KEY, SHARED_SECRET);

    //get currently logged in user
    $yahoo_user = $yahoo_session->getSessionedUser();

    $response = $yahoo_session->client->get('http://social.yahooapis.com/v1/user/'.$yahoo_user->guid.'/contacts');
    if(is_null($response) || $response["code"] != 200) { echo "<h1>NOT FOUND</h1>"; }
    $contactList = json_decode($response["responseBody"]);
    var_dump($contactList);
    0
  • Sorry, busy couple of weeks :)As you mentioned below, we generally should obtain guid via Yahoo seesion, so i am confusing that in case I mention above we can't get some stuff about Yahoo session. How could we get guid via sending request http://social.yahooapis.com/v1/me/guid? For example, in step 2, I let two users to do authorization and both the users allow the application to access its data, how to deal this situation?
    0
  • Hello,

    My desktop application successfully completes the oauth flow, sends the user off to authorize my app, gets oauth_token, etc. But when I try to use my token, I get:

    <?xml version='1.0' encoding='UTF-8'?>
    <yahoo:error xmlns:yahoo='http://yahooapis.com/v1/base.rng'
    xml:lang='en-US'>
    <yahoo:description>Please provide valid credentials</yahoo:description>
    </yahoo:error>
    <!-- ws1.yosprs.sk1.yahoo.com uncompressed/chunked Wed Dec 31 12:00:35 PST 2008 -->



    I'm using http://developer.yahoo.com/oauth/guide/oau...ke-request.html as a guideline to form my request, which is to:

    http://social.yahooapis.com/v1/user/DAATE7...h_consumer_key=[hiddenForSecurity]&oauth_nonce=AHgSD&oauth_signature=EmELC7weK0xIXCGxRoOXAvOjph0%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1230753635&oauth_token=[alsohidden]



    The headers contain the authorization like so:

    GET / HTTP/1.1
    Host: social.yahooapis.com
    User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
    Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive
    Authorization: OAuth oauth_token="[hidden]" oauth_nonce="gncRL" oauth_timestamp="1230753480" oauth_signature_method="HMAC-SHA1" oauth_consumer_key="[alsohidden]" oauth_signature="omZHio3PQmrD0%2FDxwsOeXScTpnk%3D"



    So what am I doing wrong?
    0
  • please provide appropriate solution on this issue.

    0
  • Recent Posts

    in Social Directory API