'Google Analytics API: Invalid value at 'report_requests[0].metrics[0]' (expression), Starting an object on a scalar field
Can anyone explain what this means? I'm just trying to grab the pageviews of a specific page.
Here is my request:
{
path: '/v4/reports:batchGet',
root: 'https://analyticsreporting.googleapis.com/',
method: 'POST',
body: {
reportRequests: [
{
viewId: VIEW_ID,
dimensions: [{name: 'ga:pagePath' }],
dimensionFilterClauses: [{filters: [{
"operator": "EXACT",
"dimensionName": "ga:pagePath",
"expressions": ["/about"]
}]}],
dateRanges: [{startDate: start,endDate: end}],
metrics: [{expression: 'ga:pageviews'}]
}
]
}
}
Here is the full error:
{
"error": {
"code": 400,
"message": "Invalid value at 'report_requests[0].metrics[0]' (expression), Starting an object on a scalar field",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "report_requests[0].metrics[0]",
"description": "Invalid value at 'report_requests[0].metrics[0]' (expression), Starting an object on a scalar field"
}
]
}
]
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
