googleapis / google-api-go-client

Auto-generated Google APIs for Go.
https://pkg.go.dev/google.golang.org/api
BSD 3-Clause "New" or "Revised" License
4.03k stars 1.13k forks source link

Adsense API request error #2125

Closed overstarry closed 1 year ago

overstarry commented 1 year ago

use adsense GenerateCsv api,

do, err := adsenseService.Accounts.Reports.GenerateCsv("accounts/pub-xxxxx").Metrics("ESTIMATED_EARNINGS").
        Dimensions("DATE").
        DateRange("today").Do()
    if err != nil {
        panic(err)
    }

err: invalid character 'D' looking for beginning of value.

go1.20

codyoss commented 1 year ago

This is likely similar to https://github.com/googleapis/google-api-go-client/issues/468. I believe the discovery document for this API is just incorrect. Not much we can do from the client side. If you want to make the raw request with an authenticated client that may be your best bet

Just be sure to pass the following scope to that method: https://www.googleapis.com/auth/adsense

Hope that helps.

overstarry commented 1 year ago

ok,thanks