2016-04-09 55 views
0

你好,我想使用facebook圖形API v2.5獲取一些事件信息,但我不斷收到錯誤消息facebook.GraphAPIError:未知路徑組件:/ 144259682284406。它的工作原理沒有字段時,我不但是指定V2.5我需要使用V2.5,以獲得必要的字段使用facebook圖形API獲取事件數據的問題v2.5

/v2.5/144259682284406?fields=events{name,id,timezone,start_time,end_time,picture,description,category,type,attending_count,interested_count,declined_count} Blockquote

+0

不清楚你在問什麼;完全相同的請求[在Graph API Explorer中正常工作](https://developers.facebook.com/tools/explorer?method=GET&path=144259682284406%3Ffields%3Devents%7Bname%2Cid%2Ctimezone%2Cstart_time%2Cend_time%2Cpicture%2Cdescription %2Ccategory%2Ctype%2Cattending_count%2Cinterested_count%2Cdeclined_count%7D&version = v2.5) – CBroe

+0

等等https://graph.facebook.com/v2.5/144259682284406?fields=events%7Bname%2Cid%2Ctimezone%2Cstart_time%2Cend_time %2C圖片%2C描述%2C類別%2C類型%2Cattending_count%2Cinterested_count%2Cdeclined_count%7D&access_token = ...直接在瀏覽器中調用時。 – CBroe

+0

@CBroe我使用python並調用graph.get_object方法。 Python代碼:「searchstring =(」/v2.5/144259682284406?fields=events{name,id,timezone,start_time,end_time,picture,description,categor y,type,attending_count,interested_count,declined_count}「)post = graph .get_object(searchstring)「 – MattP

回答

0

完全相同的請求,在圖形API資源管理工作或致電通過URL API時直接 - 所以它必須是你在SDK代碼中傳遞參數的方式。

檢查http://facebook-sdk.readthedocs.org/en/latest/api.html事實證明,該API版本有創建facebook.GraphAPI對象實例時傳遞,

graph = facebook.GraphAPI(access_token='your_token', version='2.2') 

這樣的SDK將採取把該版本字符串到URL的照顧了API請求是由它自己完成的,因此,在進行API調用的以下代碼中,您不必再考慮這一點。

0

試試這個;)

的ID您使用144259682284406是一個網頁對象,如果你想獲得頁面事件,你應該查詢是這樣的:你的情況

page/events/?fields=field1,field2,...

/v2.5/144259682284406/events/?fields=name,id,timezone,start_time,end_time,picture,description,category,type,attending_count,interested_count,declined_count