Can't get users list of "Like" - facebook-like

Although I wrote FQL searching from the person who pushed the "Like" button, it does not work normally.
ex) SELECT user_id FROM like WHERE object_id='10150931418786729' AND object_type='link'
Once, according to the question by other persons, he answered it was the privacy problem. However, a result is empty even if it focuses on me.
ex) SELECT object_id FROM like WHERE user_id=me() and object_type='link'
It seems that a result can be got if object_type is not specified(That is, "Like" to albums).
ex) SELECT user_id FROM like WHERE object_id='10150931418786729'
(*http://www.facebook.com/media/set/?set=a.10150629589136729.412063.20531316728)
Does a FQL query have a problem? Or does Facebook API have?
Append: This query is also failed...
SELECT user_id FROM like WHERE object_id IN (SELECT id FROM object_url WHERE url = "http://www.itmedia.co.jp/news/articles/1204/18/news107.html") AND object_type="link"

like is a restricted keyword.
wrap it in ` ` to use it:
Eg:
SELECT * FROM `like` ...

Related

What RegEx code do I need to leave something as-is

I have a list of page names such as below:
Homepage
Product 1
Accounts
Sign In
Product 2
Campaign
Product 3
I want to use a calculated field in Google Data Studio to aggregate all Product pages. How would I write the code so that it still includes the other pages without manually inputting each individually? This is the code I have:
CASE
WHEN REGEXP_Contains ( Page Title, 'Product' ) THEN "Product Page"
ELSE [LEAVE AS IS]
END
What code would I write to leave the page title as-is but still including it? I feel like it's either something so simple or impossible and that's why I've been unable to find any answers. Would really appreciate any help!
I would guess just this:
CASE WHEN REGEXP_Contains ( Page Title , 'Product' ) THEN "Product Page" ELSE Page Title END

FQL filtering by user_id and url in url_like

I'm trying to know if a user liked a URL. I followed the facebook documentation in https://developers.facebook.com/docs/reference/fql/url_like. I had no problem to get all likes by user_id using the query bellow:
select user_id, url from url_like where user_id=me()
The result of this FQL is a list of URLs liked by the user. The problem occours when i add to WHERE clause the URL parameter like this:
select user_id, url from url_like where user_id=me()and url='http://www.climatempo.com.br/previsao-do-tempo/cidade/321/riodejaneiro'
the result is an empty list, but the result appears in the first list.
Any idea?
P.S I tested using graph api explorer: https://developers.facebook.com/tools/explorer
thanks!
What do you want to fetch. As the url_like table contains only two columns and if you query using both columns in where clause, it does not make any sense.

FQL query using Facebook Graph API

I have this query:
SELECT uid, name, current_location FROM user WHERE uid IN ( SELECT uid2 FROM friend WHERE uid1 = me() ) AND current_location.id IN (Select current_location.id from user where uid = me() )
It gives me results as required i-e friends only with a particular location.
Can i get the same results using Graph API instead? assuming I have the location id.
I tried this in graph API:
me/friends?location.id='111501225536407'&fields=location
Is something of ^ sort even possible using graph API?
Not that I can see. The Graph API is best for getting all of or the most recent items of an object. If you wanted to filter those friends by location, you would need to do that on the client side.
If you want Facebook to pre-filter your results on their servers, you need to use FQL.
you can execute fql queries (including multiqueries) through the graph api like this:
https://graph.facebook.com/fql?q={"albums":"select aid, name,cover_pid FROM album where owner=me()","album_covers":"select src from photo where pid in (select cover_pid from %23albums)"}&access_token=xxxxxx
It's a little tricky with the url encoding. Be sure that "#" sign used in multiqueries is encoded as %23

Graph api field expansion

I would like to use field expansion in my graph api queries and when fetching posts comments etc...
but I would like to get picture from the "from"-field, but I would also like to get the category field so I can know if it's page or user.
If I don't use field expansion I get the category, but not image. but using field expansion I get picture but not category.
e.g
/me/home?fields=from
returns {id: 1, name :"x", category : "y" }
but using it like this:
/me/home/?fields=from.fields(id, name, category, picture) returns null,
if i remove category it works ok.
So is there a way I can get the category + picture for that field, or is there another way to know if it is page or user?

How to get a real-size profile picture from a user?

Having a User ID xUID, i know I can get a profile picture this way:
http://graph.facebook.com/xUID/picture?type=large
The problem is that the picture returned from that URL is not the real size (it's about 200px wide).
I need to get that user picture, but real size.
What i've done so far is:
1. Getting the user albums
https://graph.facebook.com/me/albums?access_token=xToken
2. Iterating on that, and getting the album that have the type="profile".
3. With that Album ID (xAID) I can construct a FQL query:
SELECT pid, object_id, src_big FROM photo WHERE album_object_id = xAID
4. And getting the profile pictures there.
5. I need to iterate and find the lastone uploaded by the user.
So, this process is complex and time consuming. Is there any better/simpler/faster way to acomplish this?
Thanks a lot!
http://graph.facebook.com/xUID/picture?width=720&height=720
You need to perform only one FQL query:
SELECT pid, object_id, src_big
FROM photo
WHERE object_id IN
(SELECT cover_object_id
FROM album
WHERE owner=me() AND type="profile")
src_big will contain link to profile original source.
If you need to get specific user's profile picture please change me() with specific user id.
Ok, just did as the question said. Browse the Albums, and getting the first profile picture from there.
The answer from Julio doesn't work becouse it's not possible to include "type" on a WHERE clause, becouse it's not an indexable column.
The cover photo also isn't always the most recent photo, as of a few days ago.
Get cover_object_id:
fql?q=SELECT cover_object_id, type FROM album WHERE owner="userid" AND type="profile"
Get src_big:
fql?q=SELECT pid, object_id, src_big FROM photo WHERE object_id="cover object id obtained above"
img src="src_big obtained above"
This helps in something?