Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8100357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:43:10+00:00 2026-06-05T22:43:10+00:00

The following batch request for retrieve friends using the same app is not working:

  • 0

The following batch request for retrieve friends using the same app is not working:

var search = {batch: [
    {
      'name' : 'getFriends',
      'relative_url': 'method/fql.query?query=SELECT+uid,+first_name,+name,+pic_square,+pic_small+FROM+user+WHERE+is_app_user=1+and+uid+IN+(SELECT+uid2+FROM+friend+WHERE+uid1=' + userId + ')'
    },
    {
      'method': 'get',
      'relative_url': '{result=getFriends:$.data[*].uid}/news.reads/article', 
    }
]};

and the following code executes the batch request:

FB.api('/', 'post', search, function(response) {
    console.log(response);
});

but the first search returns null. What’s wrong with the query?

According to facebook documentation for batch requests, the *relative_url* is

(…) a relative_url (the portion of the URL after graph.facebook.com)

get from here.

So I changed the first block of code to:

var search = {batch: [
    {
        'name' : 'getFriends',
        'method' : 'GET',
        'relative_url': 'method/fql?q=SELECT uid, first_name, name, pic_square, pic_small FROM user WHERE is_app_user=1 and uid IN (SELECT uid2 FROM friend WHERE uid1=me())'
    },
    {
        'method': 'GET',
        'relative_url': '{result=getAmigos:$.data[*].uid}/news.reads/article'
    }
]};

the relative_url of the first block on the batch works at Open Graph API Tool at facebook, but at the JS the http code is 500 and the message body is:

{
    "error": {
        "message": "Graph batch API does not allow REST API method fql",
        "type": "FacebookApiException",
        "code": 3
    }
}

but in the api batch requests documentation allows fql queries. The documentation is outdated? Should I open a bug?

P.S: the fql without the batch request is

SELECT uid, first_name, name, pic_square, pic_small 
FROM user WHERE is_app_user=1 
     and uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:43:11+00:00Added an answer on June 5, 2026 at 10:43 pm

    it’s working now. I just add the access_token parameter at the batch object. like this:

    var searchArgs = {
       access_token: FB.getAuthResponse().access_token,
       batch: []
    };
    
    searchArgs.batch.push({
         'method': 'GET',
         'name': 'amigosapp',
         'relative_url': 'method/fql.query?query=SELECT+uid,+first_name,+name,+pic_square,+pic_small+FROM+user+WHERE+is_app_user=1+and+uid+IN+(SELECT+uid2+FROM+friend+WHERE+uid1=me())&limit=20',
         'omit_response_on_success': false
    });
    
    searchArgs.batch.push({
         'method': 'GET',
         'relative_url': 'news.reads/article?date_format=U&ids={result=amigosapp:$.[*].uid}'
    });
    

    the other trick was use the jsonpath expression in a different way. I couldn’t make the second request for each user of the first request. So I changed the way to get it adding the friends ids at the end of the graph api request. I think that my first thought about a request per friend it’s not possible using the batch request.

    Then I did the call of the batch:

    FB.api('/', 'POST', searchArgs,
        function(response) {
            var friends = response[0].body;
            console.log(friends);
            var activities = response[1].body;
            console.log(activities);
        }
    );
    

    Now it’s just organize the posts retrieved.

    []’s

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a batch request which is the following code: [[AHClient sharedClient] enqueueBatchOfHTTPRequestOperationsWithRequests:requestArray
I am using the following code to call a batch file: dim shell set
I created the following batch file using VB: Open sBatchFile For Output As #1
I'm trying to upload images using Graph API Batch Request, but i'm unable to
I am using the following batch file to make a zip file for each
The following batch script prints out my current working directory. echo %cd% But I
I'm building a batch request for the Facebook API by looping the following code:
I have the following code in a batch file that is called by a
I have a batch file with the following code: for /f tokens=* %%a in
I have the following For loop in a batch file: for /R c:\test\src %%i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.