logo
down
shadow

Facebook: field expansion in batch requests?


Facebook: field expansion in batch requests?

By : huilin.xiong
Date : November 21 2020, 04:03 PM
like below fixes the issue Is it possible to make a batch request with one (or more) of the batched requests using field expansion? , You could even combine this into one query:
code :
/me?fields=name,first_name,last_name,music.listens,friends.fields(name,first_name,last_name,music.listens.limit(1))


Share : facebook icon twitter icon
Linking responses to requests with Facebook Batch Requests

Linking responses to requests with Facebook Batch Requests


By : user3534687
Date : March 29 2020, 07:55 AM
will be helpful for those in need Yes, that's correct.
My strategy is that I create a tracking array as I load up my batch requests. This array correlates the key for my associative array to the numerical order I posted the batches. When I loop over the results, I use a counter to step through the tracking array and pull out the proper associative array index. Then I use that to update the associative array with the results from that step of the batch operation.
code :
foreach ($campaigns as $title => $campaign) {
    if (count($batch) == 20) {
        $batches[] = $batch;
        $batch = array();
    }

    $titles[] = $title;  #TRACKING array;
    $body = http_build_query($campaign);
    $body = urldecode($body);

    $batch[] = array(
        'method' => 'POST',
        'relative_url' => "/act_{$act}/adcampaigns",
        'body' => $body
    );
}
if ($batch) {
    $batches[] = $batch;
    $counter = 0;

    foreach ($batches as $batch) {
        $params = array(
          'access_token' => $access_token,
          'batch' => json_encode($batch)
        );

        $responses = $facebook->api('/', 'POST', $params);

        foreach ($responses as $response) {
            $response = json_decode($response['body'], 1);
            $campaign_id = $response['id'];
            $title = $titles[$counter];  #RETRIEVING THE INDEX FROM THE TRACKING ARRAY
            $campaigns[$title]['campaign_id'] = $campaign_id;
            $counter++; #INCREMENTING THE COUNTER
        }
    }
}
Get all user details from facebook event with field expansion

Get all user details from facebook event with field expansion


By : vijay
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I want to get all the user details from an event using the field expansion. , You need to use a url like this:
code :
https://graph.facebook.com/EVENTID/?fields=attending.fields(id,name,picture)
Do Facebook Graph API calls using field expansion count differently against the rate limits than batch calls

Do Facebook Graph API calls using field expansion count differently against the rate limits than batch calls


By : Antoine Viscardi
Date : March 29 2020, 07:55 AM
To fix this issue Unfortunately, each call in the batch is counted as an api call, it's just faster to call them within a batch since it will be 1 request. See here documentation on Facebook API:
Limits
Facebook: field expansion in batch requests ->

Facebook: field expansion in batch requests ->


By : Nidhi Chahal Dahiya
Date : March 29 2020, 07:55 AM
will be helpful for those in need How can I define the requested fields for the 2nd part of my batch request? ,
I get a "Batch parameter must be a JSON array" exception
Facebook Graph API field expansion in Android app

Facebook Graph API field expansion in Android app


By : Peter Trotter
Date : March 29 2020, 07:55 AM
will help you Is field expansion supported in Facebook's Android SDK? where can I find an example?
shadow
Privacy Policy - Terms - Contact Us © festivalmusicasacra.org