Reputation: 4461
I'm trying to use Reporting API https://developer.yahoo.com/gemini/guide/reporting/cubes/#performance-stats
But when I try to request URI to create report - I receive response 400 with message
{"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"}
Data being passed to api endpoint:
$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'],
]
];
It seems to be OK, mostly copied from docs.
Advertiser used in filter exists. I can request it via URL https://api.gemini.yahoo.com/v2/rest/advertiser/xxxxx
, campaign - as well.
I've found few forum discussions, but they don't really help:
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
Did anybody face such issue?
Upvotes: 2
Views: 1224
Reputation: 540
According to the doc, the answer is: “Advertiser ID” and “Day” filters are required in every report request.
Upvotes: 0
Reputation: 420
Here is the Solution:-
$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);
Read the doc here https://developer.yahoo.com/gemini/guide/reporting/
Upvotes: 1