Graph API - /apprequests seems to return an empty JSON array every time - facebook

When I use
https://graph.facebook.com/(userid goes here)/apprequests?access_token=(user access_token goes here)
it returns an empty JSON array like so:
{
"data": [
]
}
Even though there ARE app requests.
These people were having the same problem, but didn't get their question answered either:
http://forum.developers.facebook.net/viewtopic.php?id=106693
http://forum.developers.facebook.net/viewtopic.php?id=88253
What am I doing wrong?
I tried POSTing and GETing requests with the Graph API Explorer, and THEY don't return an empty JSON array (however they only return the app requests POSTed by Graph API Explorer, not the requests for my app....I imagine this is to be expected however). Could this have something to do with my app being in sandbox mode? Does /apprequests work for anyone else's sandboxed app?

A few weeks back (around mid-september 2011), it was possible to get the requests with https://graph.facebook.com/me/apprequests?access_token={user_access_token}.
It does not seem possible today anymore. This call returns an empty data structure now.
Instead, calling https://graph.facebook.com/{user_id}/apprequests?access_token={app_access_token} does seem to work.

apprequests connection expect an app access token.

Related

How to get live video id from YouTube channel

YouTube API eventType=live not working, does anyone have an idea why?
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCmyKnNRH0wH-r8I-ceP-dsg&eventType=live&type=video&key=
Without eventType was working fine (but not now):
https://www.youtube.com/embed/live_stream?channel=UCmyKnNRH0wH-r8I-ceP-dsg&autoplay=1
Looks like YouTube changed something in API, search.list really not returning live broadcast since end of last week.
If you have user's access token you can use https://www.googleapis.com/youtube/v3/liveBroadcasts?part=snippet&broadcastStatus=active&broadcastType=all
endpoint to retrieve if any broadcast is live.
If you do not have user's access token, you can try this answer
but i didn't check it if it is working
Anyway this question looks like to be a duplicate of this question
Right now the YouTube API is not working, specifically for retrieving live streams of a specific channelId. In other words if you are setting channelId in the API call, you will get 0 results.
If you're using an API key rather than OAuth (not sure if OAuth works) the only work around at the moment is to use the API to search for a specific title. Here is my query URL below.
https://www.googleapis.com/youtube/v3/search?part=id%2Csnippet&type=video&maxResults=20&order=date&q=My+Uniquely+Titled+Livestream&key=[apiKey]
The results returned by the API will be from all of YouTube. (Note: the rest is done serverside) Put the results into an array and discard any that don't match your channelId. Then check the titles in an array and only get the video ID of the one that matches your desired title. That is the basic logic and it is sort of a rigid work around that won't work for most. But at least it will get you what you need until Google fixes the API.

Empty response to API call to Facebook Graph

I have been hammering away at this problem for the last day. I really hope someone can help me out. I would be very grateful.
What I am trying to do is fetch event data from a Facebook Page. I looked over the documentation, which says this about reading Pages data:
Reading
A Facebook page
Permissions
For pages that are published, you need:
An app or user access token to view fields from fully public pages.
So what I did was I obtained an app access token via:
GET https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID
&client_secret=YOUR_APP_SECRET
&grant_type=client_credentials
which then returned
access_token=MY_APP_ID|MY_APP_ACCESS_TOKEN
After this I followed the documentation and made the following call
https://graph.facebook.com/v2.4/129511477069092/events?fields=id,cover,name,venue,description&access_token=MY_APP_ID|MY_APP_ACCESS_TOKEN
This returned:
{
"data": [
]
}
So after some fiddling around I was able to make the call by switching to version V2.2 and by creating an access key with Facebook API Graph explorer tool(no permissions granted).
GET https://graph.facebook.com/v2.2/129511477069092/events?
fields=id,cover,name,venue,description&
access_token=ACCESS_TOKEN_FROM_FACEBOOK_API_EXPLORER_TOOL
The page I am trying to retrieve data from is public and so are the events, so I can't figure out what is going on. I know I am super close since I am able to retrieve the data with the token provided by the Facebook API Graph Explorer Tool. The thing with using this token is that it only last a few hours and I need something that is going to last longer such as an app access token. I have done some research on Stackoverflow and found similar questions, but none of them solve my problem. Any help will be appreciated to the max! Thanks.
Looks like a bug of v2.4 to me. It works with v2.3 if you remove the deprecated venue field:
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=129511477069092%2Fevents%3Ffields%3Did%2Ccover%2Cname%2Cdescription&version=v2.3
If the version is changed to v2.4, it returns an empty result.
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=129511477069092%2Fevents%3Ffields%3Did%2Ccover%2Cname%2Cdescription&version=v2.4
There's no documentation about this in the changelog at
https://developers.facebook.com/docs/apps/changelog#v2_4
so I guess it's a bug. There's already a bug report at
https://developers.facebook.com/bugs/443054055873667/
with status assigned. If you have an app that supports v2.3, I'd suggest you prefix your request like this:
GET /v2.3/129511477069092/events?fields=id,cover,name,description

facebook graph api returns empty data array

I wanted to get the events for a closed group (which has tons of events) via the facebook graph api, but I only got
{
"data": [
]
}
in the Graph API Explorer even though I was using an auth token with user_events enabled. Just to be sure, I enabled every single permission for the token but got the same result.
what am I doing wrong?
I think I just found the answer to my problem; there was nothing wrong!
What I thought were events coming up were actually events that happened in the past, shown in the group/events page; I guess those aren`t aren't accessible.
I think I'll settle with using FQL as offered as a solution in this question.

Facebook API returns empty response only from specific IP

Suddenly simple Facebook Graph API calls started to return an empty result. The node I'm calling is a simple search page by name:
`https://graph.facebook.com/search?type=page&fields=profile_picture,username,id,name,likes,category,talking_about_count&access_token=<APP_TOKEN>&limit=10&q=stackoverflow`
It just started to return an empty result set when called from my server:
{"data":[]}
When I'm calling it from my personal computer browser, it works just fine.
I don't see any notification in Facebook Manage Apps page. What can be the reason? Is there any way I can see any error in this Graph API result?
UPDATE: suddenly it started working again, after it was down for at least 2 hours. Is there any way I can make these calls through client side JS? Any way to avoid to exposure of my APP_TOKEN?
UPDATE2: It stopped working again, and although I haven't identified the reason, I did figure when replacing the with a , it does work. The documentation actually says to use an APP_TOKEN.

Facebook graph api function - empty response

im currently working on facebook integration into my mobile AS3 game. I'am downloading friends pictures, which works just fine and is not currently an issue. Problem is, i am trying to detect, if user has silhouette (default) picture or his own (is_silhouette property);
Here goes code:
(response[i].id) is valid user id which i have got from previous api comunication
...
HasDefault(response[i].id);
...
private function HasDefault(uid:int):void{
FacebookMobile.api("/"+uid+"/picture", callbackX);
}
private function callbackX(response:Object,fail:Object):void{
if (response != null){
trace(response.url);
trace(response.is_silhouette);
}else{
trace("here goes nothing...");
}
first things first...this code above has 2 issues. First problem is, unless i use absolute URL, facebook does not respond, so API method has actually look like this:
FacebookMobile.api("https://graph.facebook.com/"+uid+"/picture", callbackX);
i dont know why i have to use absolute url here, because anywhere else id/function is good enough...but that is not still main problem.
If i use absolute URL i do get valid response from facebook but according to this https://developers.facebook.com/docs/reference/api/using-pictures/ i should get response.url and response.is_silhouette in my response object. i however recieve only empty response object...I'am starting to be realy desperate.
In addition, i have tried to paste THE SAME request into the https://developers.facebook.com/tools/explorer explorer and surprise surprise...it returns
{
"data": {
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-frc1/somenumbers.jpg",
"is_silhouette": false
}
}
...which is exactly what i need...but within the application i get only empty response object...
I do not know what you line "FacebookMobile.api("https://graph.facebook.com/"+uid+"/picture", callbackX);" does.
But whatever library that is, stop using it, because its not letting you specify the call you want to make. You can just call the graph api calls yourself using a URLLoader.
So here is the magical thing that is going wrong: You need to be able to append an extra variable when you request the picture: "?redirect=false"
This tells facebook to give you a json response. If you do not have that variable, you will get a redirect to the actual image, which is usually what a person wants anyway.
To see how that works, test out the two links below, one with redirect=false - which you want. and One with it set to true - which you do not.
https://graph.facebook.com/shaverm/picture?redirect=false
https://graph.facebook.com/shaverm/picture?redirect=true
I am pretty sure what is happening is that you are getting the image back instead of the json response describing the image.