4

As the fql query is part of the request url (e.g. http://graph.facebook.com/fql?q=SELECT...) i suppose there is a limit for the length of urls (or their params)?

Dominik Goltermann
  • 4,276
  • 2
  • 26
  • 32
  • I am seeing queries failing with an error like this: Exception: Received Facebook error response (code 601): Parser error: unexpected ',' at position 2083.) I don't have any extra ',' so I think there must be some limit of the size of SELECTs. I am not going via a browser but I do experience exactly the same problem via the browser. – Mark Butler Mar 24 '14 at 17:11
  • Related question here: http://stackoverflow.com/questions/2317790/facebook-max-number-of-parameters-in-in-clause – Mark Butler Mar 24 '14 at 17:14

1 Answers1

6

There is no documented or announced limit on the length of the FQL query itself, but there is a limit on the length of the query string (which is different across browsers and web-servers, see Compatibility issues).

Mind that you are not required to use GET to run a query and POST will be working fine allowing you to avoid the query string limit.

BTW, if you'll use SDK to issue FQL queries you may specify the appropriate HTTP method manually

Using JS-SDK:

FB.api('/fql', {q:'FQL_QUERY'}, 'post', function(response){
  // Handle results
});

Using PHP-SDK:

$response = $fb->api('/fql', 'post', array('q'=>'FQL_QUERY'));
Luke
  • 409
  • 3
  • 12
Juicy Scripter
  • 25,778
  • 6
  • 72
  • 93
  • I'm not entirely sure what the FB SDK does, but I wanted to query with a POST request without the SDK. If you POST to `http://graph.facebook.com/fql` and put `p` in the payload (where the length is unlimited), then I get an error response (400 "Unsupported post request."). I assume, if you do what's been described in the answer above, the FQL query string is also added as URL parameter, which is – I think – always limited, no matter what HTTP verb is used. My solution is to POST the request to `https://api.facebook.com/method/fql.query` and put the query string as `query` in the payload. – Nick Dec 12 '13 at 08:59
  • 1
    @Nic, If you querying API via POST method be sure to have `method=get` in your payload to `https://graph.facebook.com/fql` – Juicy Scripter Dec 12 '13 at 12:02