我需要传递多个日期范围以获取来自GA的回复。
我提供了2个这样的日期范围
dateRanges: [
{
startDate: "2018-09-01",
endDate: "2018-09-02"
},
{
startDate: "2018-09-03",
endDate: "2018-09-05"
}
],
我得到回应,但是当我添加
dateRanges: [
{
startDate: "2018-09-01",
endDate: "2018-09-02"
},
{
startDate: "2018-09-03",
endDate: "2018-09-05"
},
{
startDate: "2018-09-06",
endDate: "2018-09-07"
}
],
我的回答是空的。
完整请求
{
"resource":{
"reportRequests":[
{
"viewId":"149278594",
"dateRanges":[
{
"startDate":"2018-09-01",
"endDate":"2018-09-02"
},
{
"startDate":"2018-09-03",
"endDate":"2018-09-05"
},
{
"startDate":"2018-09-06",
"endDate":"2018-09-07"
}
],
"metrics":[
{
"expression":"ga:users"
}
],
"dimensions":[
{
"name":"ga:segment"
},
{
"name":"ga:pagePath"
}
],
"dimensionFilterClauses":[
{
"operator":"AND",
"filters":[
{
"dimensionName":"ga:pagePath",
"operator":"REGEXP",
"expressions":"^abc.com/.*"
}
]
}
],
"segments":[
{
"segmentId":"gaid::2pK67nVBSVaAOb3P-9kEog"
}
]
}
]
}
}
我收到errorResponse
“数据”:{“错误”:{“代码”:400,“消息”:“请求最多可以有两个 日期范围。“,”错误“:[{”消息“:”请求最多可以有两个日期 范围。“,” domain“:”全局“,” reason“:” badRequest“}],
有什么方法可以实现这一目标(超过2个日期范围)?
答案 0 :(得分:1)
"data":{
"error":{
"code":400,
"message":"Request can have at most two date ranges.",
"errors":[
{
"message":"Request can have at most two date ranges.",
"domain":"global",
"reason":"badRequest"
}
],
错误消息指出,您最多可以有两个日期范围,三个日期可以删除一个日期
"dateRanges":[
{
"startDate":"2018-09-01",
"endDate":"2018-09-02"
},
{
"startDate":"2018-09-03",
"endDate":"2018-09-05"
},
{
"startDate":"2018-09-06",
"endDate":"2018-09-07"
}
],
注意:我在文档Issue
中记录了一个错误