更新时间:2023-12-02 17:54:16
使用POST而不是GET,并且正文为空&在网址中作为查询参数传递的object
,fields
,callback_url
和verify_token
.
请参见 https://developers.facebook.com/docs/reference/api/实时/.
I'm trying to implement Facebook Realtime api with my application. I want to pull the feeds from my 'facebook PAGE'. I've obtained app_access_token...
app_access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'
url = 'https://graph.facebook.com/' + FB_CLIENT_ID + '/subscriptions?access_token=' + app_access_token
url_params = {'access_token':app_access_token,'object':'page', 'fields':'feed', 'callback_url':'http://127.0.0.1:8000/fb_notifications/', 'verify_token' : 'I am taking a random string here...'}
urlResponse = call_url(url, url_params)
Everytime I call the url with url parameters, I get error : HTTP Error 400: Bad Request
But If I call the url without url parameters, I get {"data": []}
Please note that in url parameters, I'm taking verify_token, a random string and callback_url is not same as the redirect_url parameter for the facebook application.(just wanna know is it necessary to put the same url here?)
Please tell me what I'm doing wrong? I'm using python/django to implement.
Use POST rather than GET, with an empty body & object
, fields
, callback_url
and verify_token
passed as query parameters in the url.
See https://developers.facebook.com/docs/reference/api/realtime/.