How does Tumblr determine the order of posts with the same post date outside the dashboard? - tumblr

On the dashboard, Tumblr posts appear in the order in which they were created (regardless of the date attached to them). But on the front-end (e.g. at mysite.tumblr.com), I'm seeing inconsistent order for posts with the same post date and time.
On a test Tumblr, I created the following posts in this order (post IDs in parens):
Post A, dated 2013-08-14 7:00:00 (58279080752)
Post B, dated 2013-08-14 7:00:00 (58279382194)
Post C, dated 2013-08-15 7:00:00 (58314687302)
Post D, dated 2013-08-15 7:00:00 (58314687868)
On my dashboard, they appear in proper reverse-chronological order of creation (assuming the IDs are sequential), D->C->B->A, but when I view my theme, they're in the order D->C->A->B.
So it seems that yesterday's posts are in reverse order of creation/ID, but today's posts are in the natural order of creation/ID. What would explain this inconsistency?
Note: I'm not interested in changing the order (I know I can just change the post date/time to do that). I'm interested in understanding the criteria Tumblr uses to order posts when they have the same date and time, which I cannot find documented.
Update: Here is an actual Tumblr I've created which displays this behavior: http://postordertest.tumblr.com/

Unfortunately, I believe the answer to my own question is "no particular order".
I created another test Tumblr, this time with three posts per identical datetime. For August 15 7am, the posts are displayed in 3rd-1st-2nd order of ID. But for August 14 7am, posts appear in 1st-3rd-2nd order of ID. No apparent pattern or consistency.
Then, I created two more posts dated August 15 7am. After publishing post G, Tumblr displayed the posts in 4th-3rd-1st-2nd order of ID. Again, no apparent order, other than the fact that the newest post appeared first. But here's where things got strange. After publishing a final Post H (same date/time), the entire order of posts for that datetime changed: from 4th-3rd-1st-2nd to 1st-5th-2nd-3rd-4th.
At this point, I can only conclude that Tumblr displays posts on blogs with the same date/time in no particular (or even consistently arbitrary) order.

Tumblr determines the order of posts by Tumblr Post IDs in descending order.

Related

What are time-based fields that Facebook Graph API uses to filter result set when including SINCE and UNTIL parameters on /videos endpoint?

When retrieving data from the /videos API endpoint using the SINCE and UNTIL parameters, what are the time-based data fields that the API is using to filter the result set?
In the example below, I am retrieving videos from July 28th through July 30th, but a video in the result set was created and last updated on August 2nd and there is a video published on July 29th that is excluded:
https://graph.facebook.com/v2.9/8429246183/videos?since=2017-07-28&until=2017-07-30&fields=created_time,updated_time&access_token=[token]
This is the only documentation I have found that discusses the SINCE and UNTIL parameters and that only says that they represent "a Unix timestamp or strtotime data value that points to the [start/end] of the range of time-based data."
https://developers.facebook.com/docs/graph-api/using-graph-api
Facebook has stated in the bug report submitted on this issue that the SINCE and UNTIL parameters filter on an unpublished field based on the time that a video draft was originally created or scheduled. While this is not the ideal behavior, they have said that they do not currently have plans to correct this in the immediate future.

Limit Number of Posts coming from /feed Facebook Graph API

When I use /{page_id}/feed?access_token=xxxx, this give me all the posts on the page, both by user and page. I want to limit and control the posts. I want to put constraints like:
Timestamp (that is to get posts after a particular timestamp)
Post id (to get post after a particular post)
Since getting all the posts from feed is irrelevant and in-effective. Is there any way to accomplish this ?
You can use
GET /{page_id}/feed?limit={nr_of_posts_to_return}&since={timestamp}
to be able to limit the number of results and specify the starting timestamp. Have a look at the reference here:
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.0#paging
For your second Use Case you'd need to use the Batch API imho, because with a single Graph API request you can't filter on specific Posts. Instead, you need to use the Batch API to split this in two queries as described here:
https://developers.facebook.com/docs/graph-api/making-multiple-requests/#operations
The request would then look like this:
curl \
-F 'access_token={your_access_token}' \
-F 'batch=[{ "method":"GET","name":"get-post","relative_url":"{your_post_id}?fields=created_time"},{"method":"GET","relative_url":"{your_page_id}/feed?since={result=get-post:$.created_time}&limit={nr_of_posts_to_return}"}]' \
https://graph.facebook.com/
In Graph Explorer, you have to change the HTTP method to Post, then add a new field called batch. Leave the URL blank so far. Paste this as batch value:
[{ "method":"GET","name":"get-post","relative_url":"​293088074081904_400071946716849?fields=created_time"},{"method":"GET","relative_url":"293088074081904/feed?since={result=get-post:$.created_time}&limit=1"}]
This works at least for me.
For others looking for a solution, it appears the 'since' done at the 'comment' and 'reply' levels are ignored. Which means this is not a solution for me.
The query Tobi provided will provide all the posts after the first 'since' but every comment and reply in those posts, regardless of that you set their 'since' to.
Further to this, if you wish to search for new comments , regardless of the age of the post, this fails as well. For example:remove the first 'since' and change to limit=1000 and only request comments as a fields using 'since' , this will return the last 1000 posts and all comments for all of those 1000.
That said, thank you Tobi for your time and showing me how to get everything I need in a single function call. I may experiment parsing the complete recordset every time. ( maybe too much traffic though!)

Getting all events given a certain filter criteria on Facebook

I'm trying to get events in Facebook that have a certain phrase or description in them. I'd like to not have the results filtered or limited, as the phrase is fairly specific.
As an example, the phrase I'm looking for is "UMvC3" (short for Ultimate Marvel vs. Capcom 3).
That said, I could run an FQL query (and subsequently enrich with a call to the Graph API, like so):
select eid from event where contains("umvc3") and start_time >= now()
order by update_time desc
This will give me upcoming events with "umvc3" in them as well as only ones occurring in the future (I'm not concerned with past events).
However, the selection is severely limited. For example, the following isn't returned in the search results:
https://www.facebook.com/events/595137740538545/
It clearly has "umvc3" in the description text.
I can perform a search using the Graph API, but that doesn't return the above result either. Additionally, I can't filter using the Graph API on the start_time or order the results in a manner where I can stop processing the result set once I get to a certain point.
Finally, there is the Public Feed API, which will give me the entire firehose (which isn't filterable, like Twitter's, unfortunately), so I'll have to filter in real-time, which could be near impossible.
That said, am I approaching this the wrong way, or is there no way to really get a comprehensive, exact set of results from the Facebook API for events?
Note: I'm using the access_token provided by the Graph Explorer in the tools section.
The description column of Event FQL table isn't indexable, thus the freestyle search on not indexable columns won't give any result.
The results you see by running the query you suggested gives only events where the 'umvc3' is in the name column, which is indexable.
The only option is to ask facebook for fulltext indexing this column which apparently won't happen. They surely won't open any column for using clause like 'LIKE' since the query execution will take a lot of time.
And the answer from Facebook developer: https://stackoverflow.com/a/5824449/334522

Sort Order of Shopify REST Collections

Trying to nail down what the sort order is for Shopify's REST collections. Specifically I'm working with orders and customers at the moment.
I found this closed thread discussing the ability to sort collections, and the API docs don't mention it at all for either orders or customers.
However, customers have a documented search API, which does have an order parameter as an option. I'm not sure whether I can use it as a sort of substitute for the regular list API call. This doesn't seem to work properly for example - it returns more than one result.
/admin/customers/search.json?query=&limit=1
Orders don't have a documented search endpoint, but I do get a response when hitting
/admin/orders/search.json?query=&limit=1
Although it has the same issues as the customer search endpoint. I found this thread saying that orders are always returned most recent to newest by date - and inspecting the response I'm getting now that seems to be true although I could have sworn I've seen them come back in a different orders, it almost seems indeterminate.
Would like to know if that's the case for sure, and the same for customers. I seem to be getting them returned back in created_at order ascending for customers. Is that always the case?
Also, ID's for both customers and orders don't seem to be in created_at order, which is bizzare given that the have the since_id parameter in pretty much all their collections (which I found and promptly built my incremental pulling strategy on top of). I guess I'll have to use created_at instead.
The thread you linked to (apart from being really old) is referring to Collections (with a capital C), which are how groups of products are defined in Shopify (e.g. Shoes, Coats, Hats, etc.).
The 'collections' you're referring to (Customers, Products, Orders, etc.) are returned in descending date order (i.e. newest first) if the since_id parameter is not supplied, and in ascending order if it is supplied. Note that this should correspond with a descending id ordering, that's the idea at any rate as it allows you to use since_id to paginate properly (as you're doing).
Double check that you're getting wonky id ordering and if you are, please post the store domain you're seeing it on as well as a sample of order ids so that we can look into it.

FQL query response randomly omits some results

I'm trying to make a simple "only status updates, nothing else" app (since FB doesn't seem too interested in this sort of thing). However, my queries seem to omit some results:
"select status_id,uid,time,message from status where uid in (select uid2 from friend where uid1= $my_id) ORDER BY time DESC LIMIT 25", for instance, when I last tested it, only returned 21 results (and yes, I've got enough friends who have made enough updates that there are definitely more than 25 historical statuses).
This is with the PHP API, by way of Heroku, but I've had similar issues for a while, going back to before FBML was deprecated, with basically the same query.
I haven't tested enough to determine absolutely that this is the case, but it seems only to return one status per user (if Bob posted six updates, it only returns his newest status and ignores the previous ones).
Is this a known issue/bug? Any workarounds?
facebook trades accuracy for performance it has been always the case , so it usually returns a limited number of results per query
It's probably because a user has not given access for a friends apps to access their posts. Apparently making an FQL request, facebook does the initial request, including your limit param. Then it filters the list removing anything that you don't have permissions to see. Hence receiving less than 25 results.