Issue getting insights from FQL api - facebook-graph-api

I am interested in returning back a few metrics from insights but i am having difficulty getting results from FQL.
I need to get back the following.
page impressions/likes/shares
posts impressions/likes/share/comments
For post impressions
fql?q=SELECT metric, value FROM insights WHERE object_id=#### AND metric='post_impressions_unique' AND end_time=end_time_date('2011-10-30') AND period=period('lifetime')
For page impressions
fql?q=SELECT metric, value FROM insights WHERE object_id=#### AND metric='page_impressions' AND end_time=end_time_date('2011-10-30') AND period=period('lifetime')
i get back empty data sets:
{
"data": [
]
}
What am i doing wrong?

I had the same problem at first. According to the documentation, 'page_impressions' and 'page_impressions_unique' can only take the periods of 'day', 'week', and 'days_28'. If that doesn't fix the problem, try changing to a different end date (which was my problem).

Related

Date value in Django API response is one day lesser that actual value in database

I have a Django model which contain a date field. While I am calling a get API to get values from this model. The date value in response is one day lesser that what is there in the db. Please find a sample table
id
type
created_date
1
test_type
2019-05-23 05:30:00
While I calling a get API I got response like this:
{id":"1","type":"test_type","created_date":"2019-05-22T20:00:00-04:00"}
Can you please help to fix this issue. And please give me an idea why this is happening.
Thanks in advance

How can I tidy up data responses from Google Forms?

Can anyone please help me tidy up Google Spreadsheet data responses after a Google Form with a checkbox has been filled?
When someone attends training, a Google Form is filled which automatically populates a Google Spreadsheet with:
the training event
the date of the event and
all of the employees who attended that event.
There could be a number of employees attending one event so in the form, there is a checkbox giving the option to tick multiple employees. Below is an example of the Google 'Response Form' spreadsheet after the Form has been submitted:
The issue is that the Response Form is difficult to look at so I want to tidy it up and make it easy to use the Query function. Ideally, I would like it to look like this:
Can anyone help me?
you can use this formula:
=ARRAYFORMULA(QUERY(SPLIT(TRANSPOSE(SPLIT(TRIM(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
IF(IFERROR(SPLIT(D:D, ";"))<>"", "♦"&B:B&"♥"&C:C&"♥"&
REGEXREPLACE(SPLIT(D:D, ";"), "^, ", ), )),,999^99)),,999^99)), "♦")), "♥"),
"order by Col2", 1))

Facebook graph api m.mid vs m.id

I'm retrieving messages from my page, but notice that the messages have two different id types.
on most of the messages they have an id as such:
"id": "m_id.363733227087070",
however some of them are formated as
"id": "m_mid.1374165333681:48689d90e8f7fa5e77",
What is the difference between m_mid and m_id? I cannot find any documentation on why some messages have an ID that is m_mid and some are m_id. Additionally, they m_mid has some sort of hashed number after it, any idea what this hex represents??
Did you find a definite answer for this?
From my observation, the first message in a conversation has id with the format m_id.<numeric id>. All subsequent messages have id with the format m_mid.<numeric id>:<hex hash>

FQL does not give all the Friends likes

I am trying to retrieve all my friends' likes using FQL. But I am not getting all the likes only those pages which have "is_community_page" value true are being returned. Here's my FQL query
SELECT uid, page_id FROM page_fan WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
There is a max limit of 5000 results per FQL query that Facebook imposes before the results are trimmed for Privacy preferences of users. You can read this blog post about the same.
Facebook FQL retrieve a link to have full likes list and a samples list (quite unuseful), the point is not the limit of result, the point is fql has a different approach to list this data.
I stepped into it as well, trying to find a solution atm

What is the FQL equivalent of the Graph 'type' field from a /feed call?

I have been using the graph to obtain feed / post information for pages, but have started to use FQL instead as I needed to sort by updated_time rather than the standard created_time sort returned by the graph.
I am using the stream table in FQL and I can get all the information from this I require except the equivalent of the 'type' field (i.e. Status, Link, Photo, Video etc).
When I add type into the fields list for the FQL, I get a int value back (or null) which seems to roughly translate to 46 => page status, 56 => user status, 80 => link ... etc but this field is not documented and this value does not seem to be fully consistent. I've seen a user status be equal to 56 or 237, but not sure what the context difference is to make them change.
The FQL I'm using is:
"SELECT post_id, type, message, description, comments, likes, created_time, updated_time FROM stream WHERE source_id = 40796308305 ORDER BY updated_time DESC" which I'm viewing through the Graph API Explorer /fql?q=
I can get the type information by storing up the ids and making an additional graph call such as "?ids=12345,23456,34567&fields=type" but the goal is to get this in the same call.
Does anybody know how / if this can be achieved?
Many Thanks
This was acknowledged as a bug. See https://developers.facebook.com/bugs/223855374358566