Group: http://groups.google.com/group/adsense-api/topics
- Multiple Metric Issue with HTTP API [2 Updates]
- A <asouv@squareoffs.com> Jun 11 02:27PM -0700
I am trying to generate a report with multiple metrics but I keep receiving
an empty report. I am using Ruby with HTTParty to use the v1.4 HTTP API. Am
I supposed use a list for the metric parameters?
Here is my code:
options = {
query: {
endDate: "2014-05-25",
startDate: "2014-05-24",
dimension: "AD_UNIT_NAME",
metric: ["AD_REQUESTS","EARNINGS", "CLICKS"]
},
headers: {
'Authorization' => 'Bearer %s' %token
}
}
Thanks!
- "Sérgio Gomes (AdSense API Team)" <adsenseapiadvisor+sergio@google.com> Jun 12 02:21AM -0700
Hi there,
I'm afraid I'm not familiar enough with HTTParty to give you an answer on
that, but essentially, what you want to have at the HTTP level is
metric=AD_REQUESTS&metric=EARNINGS&metric=CLICKS
In other HTTP clients, that's achieved by assigning an array to a key, as
you mention, and the client handles the rest.
Could you take a look at the logs to see what your request string looks
like?
Also, have you considered using the Google APIs client library
<https://developers.google.com/api-client-library/ruby/> instead? We've got
a pretty good set of samples
<https://github.com/googleads/googleads-adsense-examples/tree/master/ruby/v1.x>
to get you started!
Cheers,
Sérgio
---
Sérgio Gomes
Developer Relations
Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W
9TQ
Registered in England Number: 3977902
On Wednesday, 11 June 2014 22:27:03 UTC+1, A wrote:
No comments:
Post a Comment