this shouldn't be this difficult. I assumed it was a permission thing, but then it doesn't make sense when the graph API gives me the information but the FQL doesn't. :S
so I'm just trying to get the stream from my public page:
http://www.facebook.com/207941570907
So I'm using their tool:
https://developers.facebook.com/tools/explorer
And I give the Graph API Explorer every single permission and I run this:
https://graph.facebook.com/207941570907/posts
And that works perfectly.. but I want to use FQL instead. So I figure running the following would be EXACTLY the same, but no data appears?! It WAS working a month ago, but I don't know what they changed.. sigh:
https://graph.facebook.com/fql?q=SELECT post_id, message FROM stream WHERE source_id = 207941570907
Does anyone have a clue what I'm doing wrong?
I was able to get, using the graph API explorer, the posts from pages I admin. I currently have all permissions for the access token I'm using.
Using the Graph API Explorer tool, I'd suggest looking thru the permissions to see which one you are missing. Or start with all permissions and start taking one by one off until it breaks.
Related
I am trying to run some queries on Microsoft Academic Graph using their API. I cannot figure out what to use for the Ocp-Apim-Subscription-Key. (I have seen this question and it did not help.) When I try to run queries I get the following message (401: access denied): Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key.. This happens either using curl on the command line:
curl -v -X GET "https://westus.api.cognitive.microsoft.com\
/academic/v1.0/evaluate?\
expr=stochastic&model=latest&count=10&offset=0&attributes=Id" \
-H "Ocp-Apim-Subscription-Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
or using the API testing console.
So what am I using for the Ocp-Apim-Subscription-Key? (Not a lot of Xs!) I've tried two things. First, I've tried using the key that you can get by going to https://labs.cognitive.microsoft.com/en-us/project-academic-knowledge and clicking on the subscribe link (either Key 1 or Key 2).
Second, I've tried using a key generated by going to the cognitive services on my azure portal, and trying to create a subscription to a suitable service. However, nothing that I can see matches the Academic Search API that I want to use, so I used a generic bing search subscription.
Neither of these grants me access to the API. What am I missing?
EDIT:
After first response by #ali-heikal, I tried going to here: https://dev.labs.cognitive.microsoft.com/docs/services/56332331778daf02acc0a50b/operations/5951f78363b4fb31286b8ef4/console. A red warning box appears at top of page: You are not subscribed to this API and will get a '401 Access Denied' response. To subscribe, go to the Products page and click on the desired product containing this API.. If I go to the Products page, and go on to the Project Academic Knowledge - Preview page, I am offered the chance to subscribe. Clicking subscribe takes me to a generic MS sign in (I am signed in, choose that account), I am taken to a page which says:
We're unable to complete your request
Microsoft account is experiencing technical problems. Please try again later.
So this does not work for me. Where is it documented that I should use this endpoint? Can someone provide further instructions on how to use it?
EDIT2:
There is this answer which describes using a different endpoint: https://stackoverflow.com/a/49318405/54557. However, changing my curl request to use this does not work (with same Access denied error).
You're using the wrong endpoint, since you're using the Preview API, then you should use the Preview endpoint as well.
It should work if you follow those steps:
Regenerate a key from here (do not use an old key this time) and confirm by clicking the Yes, regenerate this key button
Open the Testing Console from here
Insert the key you just generated into the Ocp-Apim-Subscription-Key field
Insert the following into the Request body field: expr=Composite(AA.AuN=='ali heikal')&count=2&attributes=Ti,Y,CC,AA.AuN,AA.AuId
Click the Send button
Check the Entity Attributes documentation here to understand the attributes I included following the Evaluate Method documentation here
I think the problem is that you are using an old key with the wrong endpoint and attribute values.
I tried to get a group's feed using an access token from the Graph API Explorer https://developers.facebook.com/tools/explorer/?pnref=story using this route
https://graph.facebook.com/page_id/feed?access_token=access_token
and that worked perfectly; I managed to get the group's feed even though I didn't ask for any permission in the Graph API Explorer.
I tried to do the same thing but this time using the access token I get from users when they login using my application but that didn't work; an empty data array was returned even though the user is already a member of that group.
I searched more for that problem and some people said that I should request for the user_groups permission, but when I searched more I found that this permission is deprecated in the recent versions.
I searched more and I found that user_managed_groups would help, but the problem is that with that permission I can only get the feed of a group only if I'm an admin of that group.
My main goal is to get the feed of a group every time a user that is not an admin of that group but a member in it by using his access token.
My questions
Is there any other way to achieve my main goal?
Did I miss anything or make something wrong when I tried accessing the groups feed using the above methods?
Why didn't getting the group's feed using the access token I get it from my application work, but it worked when I used the access token from Graph API Explorer? What is the difference between an access token that comes from Graph API Explorer and the login API?
Can I somehow use the access token from the Graph API Explorer and regenerate it every N minutes -for example- automatically to use it to get the feed of the group that I'm a member of instead of using other user's access tokens?
I'm working on moving my app's code from Facebook's deprecated FQL to the graph API. Overall, the API makes a lot of sense thanks to the graph explorer tool. I've been able to figure out how to make general queries such as getting all my friends (and each friend's gender, first name, last name, and profile picture):
https://graph.facebook.com/v2.2/me?fields=friends{gender,first_name,last_name,picture}
The main issue I'm running into is figuring out how to make my query more specific. What I really want to do is get all my friends who are females. How would I go about specifying a desired 'gender' here? Is this even possible? Thanks for your help.
Filtering via query is not possible with the current version of the Graph API. You'll have to filter the result of your request in your application unfortunately.
I'm trying to get all of the videos of my stream.
When I go to http://developers.facebook.com/docs/reference/api/ and click on the news feed (me/home) link, using that access token, I see my entire stream, including videos.
However, when I fetch the stream (me/home) from my app, it shows me the entire stream except the ones with type:video. I also tried it in the graph explorer and I have the exact same problem there. In my app, I've tried enabling permissions including user_status, user_videos, user_photo_video_tags, friends_status, friends_videos, friends_photo_video_tags, read_stream, and offline_access. None of these help.
I even tried turning on every single permission and it doesn't help. (If I just want to get my own videos--me/posts--that works fine.)
I also tried FQL and, while I'm a beginner at that, it seems to have the same problem.
So, can others see videos in me/home? Am I missing something obvious? Or is it a facebook bug? (I couldn't find that in their bug DB).
Thank you.
Appears to be a bug. You should go there and mark that you can validate it. Also subscribe to the bug so you know when it get's fixed.
http://developers.facebook.com/bugs/231621496918030
Steps to Reproduce: 1. get an access token using the read_stream
permission
call me/home api
https://graph.facebook.com/me/home?format=json&limit=25&until=1326865528&access_token=AAAEVaIcG7E0BADwZCmtcqokmLMikQqAIcE5zaUgZCtXEVlOTRVma18db7M9WWr1EcjNZAAzVhAK7LgSrGjTOlGqF3SDrMSnk4BHP3ZBC5gZDZD
no data returned, but when I switched to the Graph API Explorer app in
the test tool with the same permission. it returns 25 entries.
Expected Behavior: all feed posts in the stream Actual Behavior: none
or a few entries
I'm trying to get some insights on a list of Posts by a Page on Facebook.
To be specific, I want to get the information highlighted in this blog post via the API.
But I can't figure out how, anyone knows how?
As far as I know it's only possible using the "stream" table. So you've got to use FQL to query this data. Using this technique you'll only get the impressions directly. Feedback rate can be calculated by adding #comments and #likes and dividing the result by #impressions. Hope they'll add this to the insights graph api as well.
MartinHN
Refer to https://developers.facebook.com/docs/reference/api/#analytics
If you are trying to aggregate multiple pages or a page other than the requesting app then you may need grant read_insights permissions to your application.
Refer to http://developers.facebook.com/docs/reference/api/insights/