StackOverflowed
StackOverflowed

Reputation: 5975

Facebook Graph Api, limit and/or order?

Is it possible to limit/filter FB Graph (page) requests to :

  1. The category (of the page)? (for instance &category=restaurant)
  2. The number of likes it has (minimum threshold)
  3. Whether it has certain properties (for instance it must have a location.city or maybe filter where location.city == "San Jose")

and is it possible to order results (for instance by number of likes descending?)

I'm using this as a starting point:

http://graph.facebook.com/search?q=california&type=page&fields=id,name,location,category

Upvotes: 8

Views: 10338

Answers (2)

allenhwkim
allenhwkim

Reputation: 27738

Facebook graph api returns the latest object first. and unfortunately, you cannot order the sequence of the return. API does do their best, by calculating relativity through their own logic.

  1. limit : number of objects to be returned
  2. offset : starting point of the result

There is no order by ascending or descending.

You can use FQL for some objects, but that does not applies to search.

To know if it is supported not, simply enter the url to the browser and look at the bottom paging section. Most of supported parameters are there.

http://graph.facebook.com/search?fields=id,name,location,category&q=california&limit=2&type=page

   "paging": {
      "next": "http://graph.facebook.com/search?fields=id,name,location,category&q=california&limit=2&type=page&offset=2&__after_id=108131585873862"
   }

Upvotes: 5

Allan Jikamu
Allan Jikamu

Reputation: 341

I'm not sure on the order functionality but here you can add a limit parameter like this one:

http://graph.facebook.com/search?q=california&type=page&fields=id,name,location,category&limit=2

Upvotes: 3

Related Questions