Facebook API finding status created time - facebook

When I call the /statuses endpoint I only get a updated_time field and not a created_time field (like I do when calling /photos or /links). It seems that updated_time is the time this post was last liked or commented, and it appears even setting the since parameter in the query returns statuses that were created before since but were updated after.
Is there any reason for this difference between /statuses vs. /photos and /links?
Can I get a created_time for a status and query since accordingly?

Better use FQL for this time. It has always been more complete than Graph.
SELECT time, message FROM status WHERE uid = me()
time uid
UNIX timestamp of the date and time the status message was posted
https://developers.facebook.com/docs/reference/fql/status/

Related

FQL - Get all post in the wall of a user

I need to get all me() wall posts.
I am using the following FQL:
SELECT post_id, comments, message
FROM stream
WHERE source_id = me()
AND created_time > 946684800 AND created_time < now()
but this only returns 7 entries, where as a matter of fact there must be much much more..
(NB 946684800 = Sat, 01 Jan 2000 00:00:00 GMT)
I also tried to use the following query:
SELECT post_id, actor_id, target_id, message, comments
FROM stream
WHERE source_id = me()
AND is_hidden = 0
ORDER BY created_time
DESC LIMIT 1000000
that although it returns 394 entries, the earliest data is Mon, 30 Apr 2012 12:56:04 GMT, where for it must go back more.
I need to have in possession the whole wall posts a user have submitted.
Any ideas before I get frustrated even more :) ?
just notice as facebook announced, as of February 6th, 2013 offset no longer allowed when searching posts. Use 'since' and 'until' to do paging instead.
Simple answer to your question is...you can't get all posts on the wall with just one query, you will have to loop and make more requests to get further posts.
You can also check this blog post on paging made by Facebook to understand more clearly as to how the result are sent by Facebook. Also remember the maximum results you can have before Facebook trims it for visibility checks is 5000 as mentioned in the post.

Facebook get wall by time limit

I am getting wall posts by facebook sdk
$get = $facebook->api('/me/posts', 'GET' );
or
$get = $facebook->api('/me/feed', 'GET' );
I need to save them into my own DB, and after new request, I need get posts, that I have not saved yet. But I could not find any parameters to add to get info for example last 7 days, or after post by timestamp smth.
I saw that there is FQL which has time field, but it was only in Statuses table, I need all of them, likes, shares, statuses, comments etc.
Can anyone help me?
You can add since=[time] and/or until=[time] as query strings to get a specific slice of time.
For instance, to get 7 days of posts beginning on October 1, 2012, try this:
'/me/feed?since=2012-10-01&until=2012-10-08'
Your time string can be either an ISO-8601 date string or a UNIX timestamp.

FQL geting the Number of messages between you and someone at a certain time

See I want to know the message count between me and my friends but not the total over time but at a time I decide for example between july 2010 and december 2010 but there are no way to specificy a timestamp or until parameter in this query
I already tried
SELECT num_messages,timestamp ,senders, thread_id FROM unified_thread WHERE
CONTAINS('STRING') and thread_id= 'THREAD_ID'
I also tried
SELECT num_messages,timestamp ,senders, thread_id FROM unified_thread WHERE
single_recipient=USER_ID
but in this one the timestamp represents the last time the thread was updated so I cant filter by timestamp because it returns the same or nothing.
I finally got to this
SELECT message_id,body,created_time FROM message
WHERE thread_id = THREAD_ID (INT EXPECTED - OLD SYSTEM )
here I get each message and a timestamp from where the message was sent but is there a way to get FQL to count them for me ?
No. There is no count method in FQL. You have to bring the results back to your script and count them there.

FQL Result Issue

In looking at the stream table, the documentation says ..
updated_time time
The time the post was last updated, which occurs when a user comments on the post, expressed as a Unix timestamp
created_time time
The time the post was published, expressed as a Unix timestamp
However, when I execute a FQL query against the table I see
<created_time>1328136721</created_time>
<updated_time>1328136721</updated_time>
even though 700+ comments have been made on the post. Given the documentation, if a comment has been made on a post, I don't see how the 2 timestamps can ever be the same.
The bug seems the appear for status with 30+ comments, as per this bug report. It is currently marked "Assigned".

Formatting dates with FQL

I'm trying to do the following Facebook Query Language query:
https://api.facebook.com/method/fql.query?query=SELECT name FROM user WHERE uid IN (SELECT actor_id FROM stream WHERE app_id = 131580206909839 AND xid = 'daily_thred_production' AND created_time > 2011-03-06 AND created_time < 2011-03-08)
The problem is that the dates aren't being recognized and I can't find any documentation on how to format FQL dates from the Facebook developer section. Any thoughts?
EDIT
I'm doing all of this from the URL with no programming language. I'm just trying to pull one-off statistics for some co-workers.
Epoch time seems to work, thanks! Only problem is that it's only displaying new users that contributed to the stream for the first time. Unfortunately I'm trying to find everyone in the stream, I'll have to look at the stream table more carefully.
Thanks Brian.
They're epoch time (Number of seconds since 00:00:00 Jan 1, 1970 UTC)
You need to convert your dates to epoch time in whatever language you're using.
EDIT: If you need an example, let me know what programming lang you're using.