Facebook user ID. Which one? - facebook

I'm very confused... I try to setup a a fql fan page query, and in my search, I found that my user have several ID... So which should I use ?
Maybe more explaination is needed ^^
The first userId that I found is 4101606156331 (https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=me%3Ffields%3Did%2Cname&version=v2.0)
The second one is 1768286839 (https://graph.facebook.com/chapit.nicolas)
Which is the correct one ? And Why there are two IDs ? (maybe more...)
Someone can confirm me that which is the right ID (260226614127613 or 320233158126958) is the right one for the page CodeRougeAuto ? Because I like this page but when I try to know if I like the page with fql in Graph explorer tool (with a active token) I got this :
SELECT uid
FROM page_fan
WHERE uid=UID AND page_id=PAGEID
4101606156331 and 260226614127613 : empty response
4101606156331 and 320233158126958 : empty response
1768286839 and 260226614127613 : Error The global ID 1768286839 is not allowed. Please use the application specific ID instead
1768286839 and 320233158126958 : Error The global ID 1768286839 is not allowed. Please use the application specific ID instead
Thank you for your precious help !

What you see are the so-called global and app-scoped user_ids. If you're using v1.0 of the Graph API, the user_ids will be global. If you use v2.0 they will be app-scoped, as in your first example.
It's all in the docs: https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids

Related

Not able to get message_tags of type "user"

I'm using RestFB to get the data for FB comments, in particular the message_tags. It seems to work fine when the type of the message_tag is a "page", but I get an empty list when the type = "user".
Here is the FB commend id where this happens: 10156566664184478_10156576298439478
I'm using:
List msgtaglist = Comment.getMessageTags();
to get the list of MessageTag's.
But it returns an empty list for the comment above, although the FB Graph Explorer shows there is a message tag.
Any help is appreciated.
Thanks
Reinaldo

How to retrieve graph impressions with string action types

I am sending a request for graph insights with the action type breakdown like this one given in an example on Facebook page : https://graph.facebook.com/XXXXXXXX/app_insights/story_publishes?since=1418112000&until=1426748400&summary=true&breakdowns[0]=client&breakdowns[1]=action_type&breakdowns[2]=auth_state&date_format=U
The result is however difficult to read because the type of action is represented by a numeric value (uuid) like this: "action_type"=>"465905580137487", so I dont know what it relates to- checkin, share or photo upload. Also for different apps those uuids are also different. Does anyone know what call I need to make to get the action type names as strings? Thanks for help
You need to call this URL:
https://graph.facebook.com/{action_id}
where action_id is the value returned by action_type. You'll receive the action details on the response.

Facebook Graph API event-id/comments?since=2014-02-01&until=2014-02-10 , Date filter has no effect

I am trying to bring comments made on a particular event by targeting this URL: https://graph.facebook.com/1466384840257158/comments
I am passing the user_access_token
I have two comments at present on this event made on the same
day(2014-03-29)
Now I try to pass a date which should bring an empty data result/object
like this: https://graph.facebook.com/1466384840257158/comments?since=2011-01-01&until=2014-01-10
This request has no effect, it still shows me the two comment made
on the 29th
I have tried the same kind of date range on my user-id/feed and it
gave me an empty data object.
Finally i tried event-id/feed (before trying date filter) and it
gave me the following error
.
{
"error": {
"message": "An unexpected error has occurred. Please retry your request later.",
"type": "OAuthException",
"code": 2
}
}
Could you please guide me about date filter on that particular query (point4) or if you have any other idea to use date filter on comments made for an event.
Comments use Cursor-based Pagination, so you cannot use since or until on the comments endpoint (these parameters would work f.ex. for the feed endpoint).
To get the comments in a time range you have to fetch all comments from NOW to the start of the time range, f.ex. with https://graph.facebook.com/1466384840257158/comments?filter=stream&limit=1000+paging (the filter=stream will order the result with the timestamp).
USING SINCE UNTIL FOR COMMENTS on GROUP
If you want to use since and until for comments, it is not possible directly for a group. So, First you can apply it for status(feed) and then get the comments for that feed.
This works for me:
{group_id}/?fields=feed.since(08/25/2016).until(08/31/2016){from,comments{from,message}}
Why don't you try first to filter by notifications?... notifications allows you to add parameters like since. For example (using Facebook pages):
https://graph.facebook.com/PAGEID?fields=notifications.since(2015-3-31 00:00:00).limit(250).include_read(true)&{id,created_time,updated_time,unread,object,link}&access_token=ACCESSTOKEN
Once you got the json data, loop through data, get the ID and send a second request but this time using the PAGEID_POSTID edge. Something like this:
https://graph.facebook.com/PAGEID_POSTID/comments?fields=id,from{name,id},message,can_remove,created_time&limit=1000
Voahla!... there's no need to read every comment!...
Note 1: A Page access token is required, along with the manage_pages permission
Note 2: Use the parameter/field include_read to get all the notifications, even the already readed
Note 3: In the second request, use the parameter/field "filter=stream" to order the posts and get the comments made in the name of your page
Note 4: Don't forget to control the asynchronicity once you loop!
Note 5: Notifications duplicate posts, use an array to avoid to read more than one time the postUse the parameter/field include_read to get all the notifications, even the already readed
I do not know if it's too late. But, Yeah it works in the graph api version 3.3.
for example: if you wanna get comments on a post of a Facebook page you can do it like this:
You have to use page Access-token
The get Graph Request : post_id/comments?since=some_date

I am having problems running Facebook FQL queries that include long user ids

I am having problems running queries with FQL that include a supplied "Large"(beginning with 10000..) User ID
here is an example of one that is not working:
fql?q=SELECT uid, first_name,last_name,pic,pic_square,name
FROM user
WHERE uid=100002445083370
Is there a way to encapsulate the long number so it's passed as a string?
here is another example:
/fql?q=SELECT src_big
FROM photo
WHERE aid IN (SELECT aid
FROM album
WHERE owner=100002445083370 AND type="profile")
ORDER BY created DESC LIMIT 1
Has anyone been able to solve this issue? I am testing the queries in the graph explorer with no luck as well.
I see what the problem is,
The User id I am trying to pass is supposed to be: "100002445083367", but from querying the list of friends and grabbing their User Id, I am getting back "uid":1.0000244508337e+14 which is being shortened to: 100002445083370 (php removing the e+14) throwing off the second query. I need to make sure the id I am grabbing is staying as a string value not a number while I pass it back and forth from PHP and Javascript.
The problem is because of the way PHP handles JSON_DECODE. I had to modify Facebook PHP SDK and add a preg_replace previous to the json_decode. It will make sure json_decode doesn't convert large integers to floats by first converting them to strings.
here is the code:
line 803 from base_facebook.php:
$result = json_decode(preg_replace('/("\w+"):(\d+)/', '\\1:"\\2"', $this->_oauthRequest($this->getUrl($domainKey, $path),$params)), true);
here is more information on the subject:
http://forum.developers.facebook.net/viewtopic.php?id=20846
What do you mean by "not working"?
That query works for me in Graph API explorer but the response is
{
"data": [
]
}
I think that user-id isn't valid; https://www.facebook.com/profile.php?id=100002445083370 gives a "Page not found" error for me.

Read Facebook Wall From Console App

Is it possible to read Facebook's wall posts from a console app using facebooksdk on codeplex?
I need to read the posts on Microsoft's facebook wall.
Thank you
Easiest path: https://graph.facebook.com/microsoft/feed?access_token={appID}|{appSecret}. Additionally, if you have a user's access token there, it'll work as well. Since this data is public, we only need to know what app is accessing it, so either kind of token will work.
I'm not familiar with the facebooksdk on codeplex, but I assume it can help you generate access tokens. Once you have an access token, simply curl https://graph.facebook.com/microsoft/feed?access_token=YOUR_ACCESS_TOKEN to get the wall of the page.
You can directly hit up https://graph.facebook.com/microsoft/posts to read their wall posts
Check out the graph API explorer https://developers.facebook.com/tools/explorer
to play around with what is exposed in the facebook api
If you're just accessing this one fan page, you have the options of using Facebook PowerShell Module, this is
PS C:\Windows\system32> Get-FBAssociation -id 20528438720 -type Statuses
id : 10150289130443721
message : Friday Question: How will you be spending your last few weeks of summer?
likes : {#{id=167736043271797; name=Microsoft Tag Master}, #{id=100001944243060; name=Rahul Bhatt}, #{id=1520665678; name=Khair Eddin Réguiég}, #{id=100001258437657
; name=Ritesh Raj}...}
comments : {#{id=10150289130443721_18321628; message=planking; likes=3; from=; created_time=2011-08-26T16:47:05+0000}, #{id=10150289130443721_18321629; message=Hooking
up with girls!; likes=2; from=; created_time=2011-08-26T16:47:07+0000}, #{id=10150289130443721_18321630; message=looking for a new laptop!; likes=1; from=;
created_time=2011-08-26T16:47:07+0000}, #{id=10150289130443721_18321634; message=PLAYING MY XBOXXXX; likes=2; from=; created_time=2011-08-26T16:47:18+0000}
...}
from : #{id=20528438720; name=Microsoft; category=Company}
updated_time : 2011-08-26T16:46:50+0000
id : 10150286459498721
message : Trivia Tuesday: What keyboard shortcut is also known as “the three-finger salute”?
likes : {#{id=100002695750862; name=Animalman Smooth}, #{id=100002727450944; name=Sébastien Popczyk}, #{id=100002706279284; name=Barbados Mayne}, #{id=1000001456612
54; name=Aman Goyal}...}
comments : {#{id=10150286459498721_18256946; message=ctrl-alt-delete; likes=2; from=; created_time=2011-08-23T14:06:08+0000}, #{id=10150286459498721_18256947; message=
- -; from=; created_time=2011-08-23T14:06:12+0000}, #{id=10150286459498721_18256951; message=control/alt/delete?; from=; created_time=2011-08-23T14:06:15+00
00}, #{id=10150286459498721_18256955; message=i dont knw; from=; created_time=2011-08-23T14:06:21+0000}...}
from : #{id=20528438720; name=Microsoft; category=Company}
updated_time : 2011-08-23T14:05:57+0000
...