what's the meaning of "json: cannot unmarshal array into Go value of type admob.GenerateNetworkReportResponse"

114 views
Skip to first unread message

jianpeng jia

unread,
Oct 18, 2022, 9:57:08 PM10/18/22
to AdMob API Developer Forum
我打算用golang sdk 获取NetworkReport,下面是我的代码实现,但是返回错误信息:
json: cannot unmarshal array into Go value of type admob.GenerateNetworkReportResponse

caller := networkReport.Generate(fmt.Sprintf("accounts/%s", G_Admob.AccountsIDs), &admob.GenerateNetworkReportRequest{
ReportSpec: &admob.NetworkReportSpec{
DateRange: &admob.DateRange{
EndDate: &admob.Date{
Day: 10,
Month: 10,
Year: 2022,
ForceSendFields: nil,
NullFields: nil,
},
StartDate: &admob.Date{
Day: 10,
Month: 10,
Year: 2022,
ForceSendFields: nil,
NullFields: nil,
},
ForceSendFields: nil,
NullFields: nil,
},
DimensionFilters: []*admob.NetworkReportSpecDimensionFilter{
&admob.NetworkReportSpecDimensionFilter{
Dimension: "COUNTRY",
MatchesAny: &admob.StringList{
Values: []string{"US"},
ForceSendFields: nil,
NullFields: nil,
},
ForceSendFields: nil,
NullFields: nil,
},
},
Dimensions: []string{"DATE"},
LocalizationSettings: nil,
MaxReportRows: 2,
Metrics: []string{"CLICKS", "AD_REQUESTS", "IMPRESSIONS", "ESTIMATED_EARNINGS"},
SortConditions: []*admob.NetworkReportSpecSortCondition{
&admob.NetworkReportSpecSortCondition{
Dimension: "",
Metric: "CLICKS",
Order: "DESCENDING",
ForceSendFields: nil,
NullFields: nil,
},
},
TimeZone: "",
ForceSendFields: nil,
NullFields: nil,
},
ForceSendFields: nil,
NullFields: nil,
})
rsp, err := caller.Do()

AdMob API Forum Support

unread,
Oct 25, 2022, 7:33:41 PM10/25/22
to jianp...@tencent.com, google-admob-api...@googlegroups.com
Hello,

At the moment, the AdMob Go client library does not support streaming methods including the GenerateNetworkReport and GenerateMediationReport which are both streaming APIs.

I suggest leveraging another language such as PHP, Java and Python which have code samples here.

All the best,
Google Logo
Amira
AdMob API Team
 

 

ref:_00D1U1174p._5004Q2fbRnM:ref
Reply all
Reply to author
Forward
0 new messages