PHP OSAPI createActivity Problem

0 views
Skip to first unread message

zeno

unread,
Oct 28, 2009, 8:52:20 AM10/28/09
to opensocial-client-libraries
Hey I am working on myspace using OSAPI php client. Here is the
template for myspace.

Title: ${subject} said something
Body: Testing Post from application... ${what}

The code for creating activity in php is following:

// Myspace requires some addtional things to be set.
$msParameters = array();
$msParameters[]= array('key'=>'what', 'value'=>'Yatta!!!');
$activity->setField('templateParams', $msParameters);
$activity->setField('titleId', 'template_progress');

$create_params = array(
'userId' => '@me',
'groupId' => '@self',
'activity' => $activity,
'appId' => '@app'
);
$batch->add($osapi->activities->create($create_params),
'createActivity');


// Send all batched commands
$result = $batch->execute();

If I try to create an activity without any variables in it; it works
otherwise if I introduce a variable like in above example it gives me
error. Any help please :(


Jesse

unread,
Oct 29, 2009, 3:06:13 PM10/29/09
to opensocial-cl...@googlegroups.com
Zeno-

In order to create an activity with parameters you need to create a template. Below you will find an in-depth walk-thru on how to create a template.

http://wiki.developer.myspace.com/index.php?title=Activity_Templates

Once the template is created you'd set the values for the template in the msTemplateParams.
THEN set the activity titleId equal to the name of your template.

Let me know if you have further questions,

Jesse

Jesse

unread,
Oct 29, 2009, 4:24:48 PM10/29/09
to opensocial-cl...@googlegroups.com
Zeno-

I just checked in a fix to the MySpace Activity creation code. Please grab the latest source (revision 208). There is an updated working activity example as well as code to fix any issues with creating an activity.

Please note you are still required to create a template as mentioned in my previous email.

Jesse
Reply all
Reply to author
Forward
0 new messages