过去 3 周,我们一直在上传至 Facebook 的离线转化 API,没有出现任何问题。突然,Facebook 返回了这个错误:
(#21009) The data set upload is temporarily not ready.
请参阅下面的代码以获取完整的 JSON 负载。
我们的身份验证 token 仍然有效。 (例如未过期,仍然有效) 根据这个工具:https://developers.facebook.com/tools/debug/accesstoken/
# I had to remove these fields for privacy reasons
define('FACEBOOK_APP_ACCESS_TOKEN', 'YOUR TOKEN HERE');
define('FACEBOOK_PIXEL_OFFLINE_EVENT_SET_ID', 'YOUR PIXEL ID HERE');
# Be sure to change the email/name fields accordingly
$event_name='test-upload';
$data = array();
$data["match_keys"] = array();
$data["match_keys"]['email'] = hash('sha256', 'bob.ross@example.com');
$data["match_keys"]['fn'] = hash('sha256', 'bob');
$data["match_keys"]['ln'] = hash('sha256', 'ross');
$data["match_keys"]['gen'] = hash('sha256', 'm');
$data["event_time"] = time();
$data["event_name"] = $event_name;
$data["currency"] = "USD";
$data["value"] = '0.00';
// Turn Data to JSON
$data_json = json_encode(array($data));
// Fill available fields
$fields = array();
$fields['access_token'] = FACEBOOK_APP_ACCESS_TOKEN;
$fields['upload_tag'] = $event_name . '-' . time(); // You should set a tag here (feel free to adjust)
$fields['data'] = $data_json;
$url = 'https://graph.facebook.com/v3.2/' . FACEBOOK_PIXEL_OFFLINE_EVENT_SET_ID . '/events';
$curl = curl_init($url);
curl_setopt_array($curl, array(
// Replace with your offline_event_set_id
CURLOPT_URL => 'https://graph.facebook.com/v3.2/' . FACEBOOK_PIXEL_OFFLINE_EVENT_SET_ID . '/events',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => http_build_query($fields),
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
//"content-type: multipart/form-data",
"Accept: application/json" ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Facebook 的预期结果:
{"id":"36485444079550","num_processed_entries":1}
来自Facebook的实际结果
{
"error": {
"message": "(#21009) The data set upload is temporarily not ready.",
"type": "OAuthException",
"code": 21009,
"fbtrace_id": "GeofD5QsXdI"
}
}
最佳答案
我会添加评论而不是“答案”,但我还不太清楚。 Facebook 帖子 ( https://developers.facebook.com/support/bugs/1052442614962359/ ) 上的评论者一夜之间神奇地解决了这个问题,我也经历了同样的事情(问题发生但没有解释,然后神奇地解决了,没有解释)。 Facebook 似乎已经解决了导致该问题的任何问题。
关于facebook - 这是什么? (Facebook Offline Conversions API)错误#21009 - 数据集上传暂时未准备好,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54136166/