Search code examples
facebookfacebook-graph-apifacebook-ads-apifacebook-requestsfacebook-batch-request

Facebook Graph API Ad Report Run - Message: Unsupported get request


I'm making an async batch request with 50 report post request on it.

The first batch request returns me the Report Ids

1st Step

dynamic report_ids = await fb.PostTaskAsync(new
                    {
                        batch = batch,
                        access_token = token
                    });

Next I'm getting the reports info, to get the async status to see if they are ready to be downloaded.

2st Step

var tListBatchInfo = new List<DataTypes.Request.Batch>();
                        foreach (var report in report_ids)
                        {
                            if (report != null)
                                tListBatchInfo.Add(new DataTypes.Request.Batch
                                {
                                    name = !ReferenceEquals(report.report_run_id, null) ? report.report_run_id.ToString() : report.id,
                                    method = "GET",
                                    relative_url = !ReferenceEquals(report.report_run_id, null) ? report.report_run_id.ToString() : report.id,
                                });

                        }
dynamic reports_info = await fb.PostTaskAsync(new
                        //dynamic results = fb.Post(new
                        {
                            batch = JsonConvert.SerializeObject(tListBatchInfo),
                            access_token = token
                        });

Some of the ids generated in the first step are returning this error, once I call them in the second step

Message: Unsupported get request. Object with ID '6057XXXXXX' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api

I know the id is correct because I can see it in using facebook api explorer. What am I doing wrong?


Solution

  • This may be caused by Facebook's replication lag. That typically happens when your POST request is routed to server A, returning report ID, but query to that ID gets routed to server B, which doesn't know about the report existence yet.

    If you try to query the ID later and it works, then it's the lag. Official FB advice for this is to simply wait a bit longer before querying the report.

    https://developers.facebook.com/bugs/250454108686614/