asimkumar2222 / opensocial-php-client

Automatically exported from code.google.com/p/opensocial-php-client
Apache License 2.0
0 stars 0 forks source link

Activities problem #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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?

Original issue reported on code.google.com by shalafir...@gmail.com on 25 Apr 2009 at 10:03

GoogleCodeExporter commented 9 years ago
can anyone help me?

Original comment by shalafir...@gmail.com on 28 Apr 2009 at 2:25

GoogleCodeExporter commented 9 years ago
putting in params
"appId"=>"@app"

made the trick

Original comment by shalafir...@gmail.com on 29 Apr 2009 at 9:18

GoogleCodeExporter commented 9 years ago
Thanks for posting the answer - we should modify the library to automatically 
add
"@app" in this case if it is left out.

Original comment by api.kurrik%google.com@gtempaccount.com on 14 May 2009 at 1:27

GoogleCodeExporter commented 9 years ago
'appId' => '@app' will be automatically added if the developer misses it.

Original comment by api.an...@gmail.com on 9 Jun 2009 at 9:35