2016-08-06 19 views
2

我在facebook上的兩個應用程序中,一個可以調用API調用,另一個不能調用 我檢查了配置並且這些設置都是一樣的 你能HEL我「message」:「不支持的post請求。ID不存在的對象,由於缺少權限而無法加載

例如:?https://graph.facebook.com/860599774051206/?access_token=APP_ID|APP_SECRET

https://graph.facebook.com/860599774051206/[email protected][860599774051206]test&access_token=APP_ID|APP_SECRET&method=post

的錯誤是:

{ "error": { "message": "Unsupported post request. Object with ID '860599774051206' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at developers.facebook.com/docs/graph-api", "type": "GraphMethodException", "code": 100, "fbtrace_id": "BRW7BqFeEER" } }

感謝

+0

可以在這裏發佈一些代碼嗎? – deltaskelta

+0

嗨。問題是與Facebook的API調用。如果我在應用程序中使用此調用,則可以使用其他應用程序不工作。我相信問題是在Facebook應用程序中的一個設置,但我不明白這個設置 –

+0

不受支持的GET/POST請求幾乎總是意味着你要麼使用錯誤的ID(記住,用戶ID是應用程序範圍的!),或者不要擁有必要的權限。 – CBroe

回答

1

解決: 任何應用程序可以改變USER_ID

在應用程序中的user_id是962084030569446,在其他860599774051206

Thakns所有。

+0

真棒!這個答案應該是一個被接受的答案。 – pradeep

0

就我而言 - 我不得不使用應用程序ID來獲取使用me/accounts的頁面列表。

一旦我確定了我想要發佈消息的頁面,我必須使用頁面ID來提供page-id/feed

這解決了這個問題。

例如:

$response = $fb->get('/me/accounts', (string)$selBehRow1["fb_app_access_token"]); 
    foreach ($response->getDecodedBody() as $allPages) 
    { 
     foreach ($allPages as $page) 
     {    
      if (isset($page['id']) && $page['id'] == $selBehRow1['fb_page_id']) 
      { // Suppose you save it as this variable 
       $appAccessToken = (string) $page['access_token']; 
       break; 
      } 
     } 
    } 

    $response = $fb->post(
     //this is wrong: '/'.$selBehRow1["fb_app_id"].'/feed', 
     '/'.$selBehRow1["fb_page_id"].'/feed', 
     array(
      "message" => "$msg", 
      "link" => "$link", 
      //"picture" => "http://www.example.net/images/example.png", 
      "name" => "$name", 
      "caption" => "$caption", 
      "description" => "$description" 
     ), 
     $appAccessToken 
    ); 
} 
1

雖然無關OP問題,我想我會作出貢獻,我發帖時到離線活動端點https://graph.facebook.com/v2.8/<business_id>/events得到這個錯誤。我從一個node.js應用程序成功發佈了,然後將這個方法移植到我們的Linnworks訂單管理系統的.Net實現中時,出現了這個錯誤。

橫空出世,我打錯認爲雲在表單數據的access_token參數,即

System.Collections.Specialized.NameValueCollection formFields = new System.Collections.Specialized.NameValueCollection(); 
formFields.Add("accessToken", accessToken); 
formFields.Add("upload_tag", "store_data"); 
formFields.Add("data", data); 

本來應該是:

System.Collections.Specialized.NameValueCollection formFields = new System.Collections.Specialized.NameValueCollection(); 
formFields.Add("access_token", accessToken); 
formFields.Add("upload_tag", "store_data"); 
formFields.Add("data", data); 

獲取的access_token場錯在這種方式引起這個'帶ID的對象不存在'這是一個紅鯡魚的位。我猜想,一旦沒有提供access_token值,我們的帳戶就無法枚舉任何對象,因爲請求沒有進行身份驗證以提供權限,因此該對象「未找到」。

(您沒有必須使用NameValueCollection,這只是我使用這裏建議的多部分後期實現的副產品Upload files with HTTPWebrequest (multipart/form-data)

相關問題