Anybody that implemented activities successfully before? (REST & PHP)

On Apr 25, 11:27 am, shalafi <shalafiraist...@gmail.com> wrote:
> 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?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"OpenSocial Application Development" group.
To post to this group, send email to opensocial-api@googlegroups.com
To unsubscribe from this group, send email to 
opensocial-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/opensocial-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to