Welcome Developers!

in

Welcome!

in

Posting an Activity

Last post 03-01-2011 12:16 PM by Joel. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 02-23-2011 10:50 PM

    • Amol
    • Not Ranked
    • Joined on 11-13-2010
    • Posts 10

    Posting an Activity

    Hi All,

    I am trying to post an activity on my friends page using the SDK provide by : https://github.com/myspace/myspace-iphone-sdk

    The method I am using is :
    /* * OpenSocial v0.9 Activities
    * Resource: http://opensocial.myspace.com/roa/09/activities/@me/@self?
    * Details: http://wiki.developer.myspace.com/index.php?title=OpenSocial_v0.9_Activities
    * Description: Create Activity
    * @param mixed $personId current Person Id
    * @param mixed $externalId external Id
    * @param integer $title title of the activity
    * @param integer $body body of the activity
    * @param dictionary $templateParams Dictionary parameter
    * @param string $titleid titleId of the activity
    * @return object of php object representing the url of newly created activity
    */


    public function createActivity($personId, $externalId, $title, $body, $templateParams, $titleId){
    $externalId="562938786";
    $title="test";
    $body="I am ravi here";
    $templateParams="";
    $titleId="11111";
    echo $this->restV9->createActivity($personId, $externalId, $title, $body, $templateParams, $titleId);
    }


    Please let me know if I am correct with the parameters :
    $personId => Is my profile ID with myspace
    $externalId =>Is my FRIENDS profile ID with myspace
    $templateParams => I an bot sure what this should be, so left it blank
    $titleId="11111" => even not sure what this should be....


    1. I am able to connect to MySpace import contacts and fetch updates.

    2. But when I post a message, I get the below error


    [error] [client 220.227.236.18] PHP Fatal error: Uncaught exception 'MySpaceException' with message 'Requested --> http://opensocial.myspace.com/roa/09/activities/562938918/@self? \r\nResponse:

    \r\n\r\n

    \r\n\r\n\r\n::myspace response::@2011-02-24T06:38:47+00:00\r\n_____________________________________________\r\n:: contentType :: \r\n\r\n\r\n:: status :: \r\n404\r\n\r\n:: headers :: \r\nHTTP/1.1 404 Not Found\r\nServer: Microsoft-IIS/7.5\r\nX-Server: 806986a7d69f098f27de34c5f2b81dd8e3771a905ad33120\r\nX-PoweredBy: Nerd Rage\r\nDate: Thu, 24 Feb 2011 06:39:16 GMT\r\nContent-Length: 131\r\n\r\n:: body :: \r\n{"statusCode":"404","statusDescription":"No REST endpoint was found for this request. Please check the URI and HTTP method used."}\r\n\r\n:: raw :: \r\nHTTP/1.1 404 Not Found\r\nServer: Microsoft-IIS/7.5\r\nX-Server: 806986a7d69f098f27de34c5f2b81dd8e3771a905ad33120\r\nX-PoweredBy: Nerd Rage\r\nDate: Thu, 24 Feb 2011 06:39:16 GMT\r\nContent-Length: 131\r\n\r\n{"statusCode":"404","statusDescription":"No REST endpoint was found for this request. Please check the URI and HTTP method used."}\r\n\r\n' in /var/ in /var/www/html/contaxz/app/vendors/myspace/context/MySpaceContext.php on line 475, referer: http://linux.aress.net/contaxz/contacts/viewContactProfile/5205


    Please suggest

    Thanks
    Filed under:
  • 02-24-2011 12:47 AM In reply to

    • Amol
    • Not Ranked
    • Joined on 11-13-2010
    • Posts 10

    Re: Posting an Activity

    I tries another way but still no luck

    $REST = 'http://api.myspace.com/1.0/activities/@me/@self/150086';
    $method = 'POST';
    $body = '{"externalId":"562938918","id":"myspace.com.activity.-1","title":"osapi test activity at","body":"osapi test activity body","templateParams":{"msParameters":[{"key":"friend","value":"562938786"},{"key":"content","value":"hello there this is my template param content"}]},"titleId":"Template_4"}';


    $response = $this->context->makeOAuthRequest( $REST,
    NULL,
    $method,
    array('Content-Type' => 'application/json'), $body
    );


    The Error returned

    [error] [client 220.227.236.18] PHP Fatal error: Uncaught exception 'MySpaceException' with message 'Requested --> http://api.myspace.com/1.0/activities/@me/@self/150086 \r\nResponse:

    \r\n\r\n

    \r\n\r\n\r\n::myspace response::@2011-02-24T08:44:31+00:00\r\n_____________________________________________\r\n:: contentType :: \r\napplication/json\r\n\r\n:: status :: \r\n401\r\n\r\n:: headers :: \r\nHTTP/1.1 401 Unauthorized\r\nCache-Control: private\r\nContent-Type: application/json\r\nServer: Microsoft-IIS/7.5\r\nX-Server: f0f3cb6afa6fa4816ed88d147840b5d38b36161213f184f2\r\nx-opensocial-error: ApplicationId obtained from the URI {appId} segment does not match the caller's applicationId.\r\nAccept: */*\r\nHost: api.myspace.com\r\nCLIENT-IP: 220.227.236.30\r\nX-PoweredBy: Nerd Rage\r\nDate: Thu, 24 Feb 2011 08:44:59 GMT\r\nContent-Length: 0\r\n\r\n:: body :: \r\n\r\n\r\n:: raw :: \r\nHTTP/1.1 401 Unauthorized\r\nCache-Control: private\r\nContent-Type: application/json\r\nServer: Microsoft-IIS/7.5\r\nX-Server: f0f3cb6afa6fa4816ed88d147840b5d38b36161213f184f2\r\nx-opensocial-error: ApplicationId obtained from the URI {ap in /var/www/html/contaxz/app/vendors/myspace/context/MySpaceContext.php on line 475, referer: http://linux.aress.net/contaxz/contacts/viewContactProfile/5205
  • 03-01-2011 12:16 PM In reply to

    Re: Posting an Activity

     Did you check the obvious - an appID mismatch as stated in the error message?

     

    thanks,

    Joel

Page 1 of 1 (3 items)