0

Presence Not Working With the App

I am a Yahoo Profiles member, but when the library calls getPresence the response body is...

"Resource not found: User needs to be a Yahoo! Profiles user to enter\\/update status"

I have a Yahoo Profiles account, and everything else with the library seems to be returning as normal. Is there something special I need to do to use getPresence?

by
2 Replies
  • Hi Henry,

    I was just able to get my presence data using this code:

    <?php

    require('yosdk/lib/Yahoo.inc');

    //@ref http://developer.yahoo.com/social/php_guid...s/mysocial.phps

    // Define constants to store your API Key (Consumer Key) and Shared Secret (Consumer Secret)
    define("API_KEY","{your api key here}");
    define("SHARED_SECRET","{your secret here}");

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

    // The YahooSession object $yahoo_session uses the method getSessionedUser to get a YahooUser object $yahoo_user
    $yahoo_user = $yahoo_session->getSessionedUser();

    $presence = $yahoo_user->getPresence();

    var_dump($presence);

    /*
    object(stdClass)#11 (5) {
    ["id"]=>
    string(19) "661227152749157..."
    ["starttime"]=>
    string(20) "2008-11-20T03:45:49Z"
    ["endtime"]=>
    string(0) ""
    ["src"]=>
    string(5) "yahoo"
    ["value"]=>
    object(stdClass)#13 (1) {
    ["status"]=>
    string(26) "Connection suggestions rox"
    }
    }

    */
    ?>

    Please post back if you have any trouble.

    Erik


    QUOTE (HenryS @ Nov 21 2008, 11:40 AM) <{POST_SNAPBACK}>
    I am a Yahoo Profiles member, but when the library calls getPresence the response body is...

    "Resource not found: User needs to be a Yahoo! Profiles user to enter\\/update status"

    I have a Yahoo Profiles account, and everything else with the library seems to be returning as normal. Is there something special I need to do to use getPresence?
    0
  • <?php

    require('yosdk/lib/Yahoo.inc');

    // Your consumer key goes here.
    $consumerKey = "MY_API_KEY";

    // Your consumer key secret goes here.
    $consumerKeySecret = "MY_API_SECRET";

    // Your application ID goes here.
    $applicationId = "myappid";

    // Get a session first. If the viewer isn't sessioned yet, this call
    // will redirect them to log in and authorize your application to
    $session = YahooSession::requireSession($consumerKey, $consumerKeySecret,$applicationId);

    // Get the currently sessioned user. That means the user who is
    // currently viewing this page.
    $user = $session->getSessionedUser();

    // Load the profile for the current user.
    $profile = $user->loadProfile();

    // Fetch the presence for the current user.
    $presence = $user->getPresence();

    ?>

    I tried it without passing the app id, still showed nothing for the presence when I dump it and the same returned error...

    [responseBody] => {"error":{"description":"404 Not Found","detail":"Resource not found: User needs to be a Yahoo! Profiles user to enter\\/update status"}}\n)\n



    QUOTE (Erik @ Nov 21 2008, 01:45 PM) <{POST_SNAPBACK}>
    Hi Henry,

    I was just able to get my presence data using this code:

    <?php

    require('yosdk/lib/Yahoo.inc');

    //@ref http://developer.yahoo.com/social/php_guid...s/mysocial.phps

    // Define constants to store your API Key (Consumer Key) and Shared Secret (Consumer Secret)
    define("API_KEY","{your api key here}");
    define("SHARED_SECRET","{your secret here}");

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

    // The YahooSession object $yahoo_session uses the method getSessionedUser to get a YahooUser object $yahoo_user
    $yahoo_user = $yahoo_session->getSessionedUser();

    $presence = $yahoo_user->getPresence();

    var_dump($presence);

    /*
    object(stdClass)#11 (5) {
    ["id"]=>
    string(19) "661227152749157..."
    ["starttime"]=>
    string(20) "2008-11-20T03:45:49Z"
    ["endtime"]=>
    string(0) ""
    ["src"]=>
    string(5) "yahoo"
    ["value"]=>
    object(stdClass)#13 (1) {
    ["status"]=>
    string(26) "Connection suggestions rox"
    }
    }

    */
    ?>

    Please post back if you have any trouble.

    Erik
    0

Recent Posts

in YAP