我正在尝试使用报告接口https://developer.yahoo.com/gemini/guide/reporting/cubes/#performance-stats
但是当我尝试请求URI创建报告时,我收到了带有消息的响应400
{"errors":[{"errIndex":-1,"code":"E40000_INVALID_INPUT","message":"Entity (publisher or advertiser id) not available","description":""}],"response":null,"timestamp":"2016-11-22 15:25:24"}正在传递到api终结点的数据:
$data = [
'cube' => 'performance_stats',
'fields' => [
['field'=> 'Ad ID'],
['field'=> 'Advertiser ID'],
['field'=> 'Day'],
['field'=> 'Spend'],
],
'filters' => [
['field' => 'Advertiser ID', 'operator' => '=', 'value' => xxxxx],
['field' => 'Campaign ID', 'operator' => 'IN', 'values' => [xxxxx]],
['field' => 'Day', 'operator' => 'between', 'from' => '2016-11-20', 'to' => '2016-11-21'],
]
];看起来还不错,大部分都是从文档中复制过来的。
筛选器中使用的广告商存在。我也可以通过网址https://api.gemini.yahoo.com/v2/rest/advertiser/xxxxx,campaign来申请。
我发现很少有论坛讨论,但它们并没有真正的帮助:
1.https://forums.developer.yahoo.net/discussion/7009/gemini-reporting-help
2.https://forums.developer.yahoo.net/discussion/7091/gemini-reports-api-no-longer-working-as-expected
3.https://forums.developer.yahoo.net/discussion/7347/yahoo-gemini-custom-reporting
有没有人遇到过这样的问题?
发布于 2017-03-07 21:29:17
以下是解决方案:
$access_token = "YOUR_ACCESS_TOKEN";
$headers = array('Authorization: Bearer ' . $access_token, 'Accept: application/json', 'Content-Type: application/json');
$postdata = [
'cube' => 'performance_stats',
'fields' => [
['field'=> 'Ad ID'],
['field'=> 'Advertiser ID'],
['field'=> 'Day'],
['field'=> 'Spend'],
],
'filters' => [
['field' => 'Advertiser ID', 'operator' => '=', 'value' => xxxxx],
['field' => 'Campaign ID', 'operator' => 'IN', 'values' => [xxxxx]],
['field' => 'Day', 'operator' => 'between', 'from' => '2016-11-20', 'to' => '2016-11-21'],
]
];
$curl = curl_init("https://api.gemini.yahoo.com/v2/rest/reports/custom/");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($postdata));
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);发布于 2018-01-27 20:53:58
根据文档,答案是:在每个报告请求中都需要“Advertiser ID”和“Day”过滤器。
https://stackoverflow.com/questions/40745915
复制相似问题