Activities list returns 500 Internal Server Error

5 views
Skip to first unread message

shalafi

unread,
Apr 25, 2009, 6:27:30 AM4/25/09
to OpenSocial - OpenSocial Application Development
I've setup the osapi php client on my project.
I can for example query the logged user or his friends.

I'm using Google Friend Connect as my provider.

Like:
$batch=$this->osapi->newBatch();
$user_params=array(
"userId"=>"@me", // query the logged user
"groupId"=>"@self" // get logger users information
);
$batch->add($this->osapi->people->get($user_params),"self");
$response=$batch->execute(); // execute the job
$this->user=$response["self"]; // store the user for feature access
return $response["self"];

This works out for me.

The problem is that i can't read activities nor create one:

$batch=$this->osapi->newBatch();
$user_params=array(
"userId"=>"@me", // query the logged user
"groupId"=>"@self" // get logger users information
);
$batch->add($this->osapi->activities->get
($user_params),"userActivities");
$response=$batch->execute(); // execute the job
print_r($response);

the response is:

Array
(
[userActivities] => osapiError Object
(
[errorCode:private] => 500
[errorMessage:private] => <HTML>
<HEAD>
<TITLE>Internal Server Error</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Internal Server Error</H1>
<H2>Error 500</H2>
</BODY>
</HTML>
[response] =>
)
)

Also trying to create one:

// Create an activity (you could add osapiMediaItems to this btw)
$batch=$this->osapi->newBatch();
$activity = new osapiActivity(null, null);
$activity->setTitle('osapi test activity at ' . time());
$activity->setBody('osapi test activity body');
$create_params = array(
'userId' => "@me",
'groupId' => '@self',
'activity' => $activity
);
$batch->add($this->osapi->activities->create($create_params),
'createActivity');
$result = $batch->execute();
print_r($result);

The response is:

Array
(
[createActivity] => osapiError Object
(
[errorCode:private] => 400
[errorMessage:private] =>

..
<H1>Bad Request</H1>
Your client has issued a malformed or illegal request.

Is it something with my code or the provider?

shalafi

unread,
Apr 28, 2009, 2:55:46 AM4/28/09
to OpenSocial - OpenSocial Application Development
Anybody that implemented activities successfully before? (REST & PHP)

Chris Chabot

unread,
Apr 28, 2009, 3:40:53 PM4/28/09
to opensoc...@googlegroups.com
Hey Shalfi,

I've checked with the GFC team, and they mentioned that it needs the app id to be set to '@app', but then it should work ok; Creating and retrieving activities is supported by GFC.

Hope that helps!

   -- Chris

shalafi

unread,
Apr 29, 2009, 5:18:00 AM4/29/09
to OpenSocial - OpenSocial Application Development
thanks

"appId"=>"@app"

made the trick

Chris Chabot

unread,
Apr 29, 2009, 8:10:26 AM4/29/09
to opensoc...@googlegroups.com
Awesome, glad to hear it.

I'll make a mental note to add an example for that so others will have an easier time at it

Thanks for the feedback,

   -- Chris
Reply all
Reply to author
Forward
0 new messages