ERROR (100) : 参数不匹配任何可以更新的字段

ERROR (100) : Parameters do not match any fields that can be updated

我正在尝试通过我的脚本 post Facebook 页面状态作为页面(不是用户)。这returns我一个错误100。

在这里,我在获得许可的情况下从 Graph Explorer 生成临时 user_access_token:manage_pages、publish_pages

代码:

<?php
    $url='https://graph.facebook.com/v2.3/{$user_id}/accounts?access_token=USER_ACCESS_TOKEN';
    $ch=curl_init();
    CURL_SETOPT($ch,CURLOPT_URL,$url);
    CURL_SETOPT($ch,CURLOPT_RETURNTRANSFER, 1);
    $json=json_decode(curl_exec($ch));
    
    $page_access_token=$json->data['0']->access_token;
    curl_close($ch);

    $page_id='xxx';
    $message='helloworld';
    $url="https://graph.facebook.com/v2.3/{$page_id}?access_token=$page_access_token"; 
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $message);
    curl_setopt($curl, CURLOPT_TIMEOUT, 10);

    $result = json_decode(curl_exec($curl));
    var_dump($result);

 ?>

如果一切顺利,字符串“helloworld”应该会在 Facebook 页面上 posted。但这里返回错误:

object(stdClass)#5 (1) {
  ["error"]=>
  object(stdClass)#6 (3) {
    ["message"]=>
    string(61) "(#100) Parameters do not match any fields that can be updated"
    ["type"]=>
    string(14) "OAuthException"
    ["code"]=>
    int(100)
  }
}

这里有什么错误?谢谢。

您正在尝试 post 到 /<PAGE_ID>

在页面上创建 post 的正确端点是 /<PAGE_ID>/feed,记录在此处:https://developers.facebook.com/docs/graph-api/reference/v2.3/page/feed

创建 post 的基本调用的有效格式为 https://graph.facebook.com/v2.3/<PAGE_ID>/feed?message=helloworld&access_token=<ACCESS_TOKEN>