无法在yammer打开的图表上打开一个打开的图形请求({"错误":["缺少必需的参数\"活动\""]})

时间:2014-10-01 06:35:49

标签: yammer

我正在阅读https://developer.yammer.com/opengraph/。并尝试创建我的应用程序。我试图在php上做一个简单的opengraph请求O得到了这个错误({"errors":["Missing required param \"activity\""]})

这是我的代码

<?php


$data_string='{
"activity":{
"actor":{"name":"Sidd Singh",
"email":"adriantest@protonmail.ch},
"action":"created",
"object": {
"url":"https://www.sched.do",
"title":"Lunch Meeting"
}
}
}';
$access_token = '4Mheyevf4FmzRPtwNUviOQ'; 
$ch = curl_init('https://www.yammer.com/api/v1/activity.json');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data_string),
    "Authorization: Bearer $access_token"
    )
);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);

//execute post
$result = curl_exec($ch);

//close connection
curl_close($ch);

echo $result;

?>

0 个答案:

没有答案