My Business
4.8K members online now
4.8K members online now
For developers who are using the Google My Business API to manage locations
Guide Me
star_border
Reply

MetricValue does not contain "metric" field.

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I am requesting the insights for a given location. According to the docs (https://developers.google.com/my-business/reference/rest/v3/accounts.locations/reportInsights#metric...), metricValue should contain a "metric" key with one of the values in https://developers.google.com/my-business/reference/rest/v3/accounts.locations/reportInsights#metric.

 

But some of the MetricValue objects I get are like this:

 

{
    "totalValue": {
        "metricOption": "AGGREGATED_TOTAL",
        "timeDimension": {
            "timeRange": {
                "endTime": "2017-05-02T08:24:21.209Z",
                "startTime": "2015-11-04T08:24:21.209Z"
            }
        },
        "value": "74559"
    },
    "dimensionalValues": [...]
}

As you can see, there is no "metric", so there is no way to know what the numbers refer to.

 

Is this a bug? if not, how should I interpret it?

 

Thanks for your help.

 

Alvaro

1 Expert replyverified_user

Re: MetricValue does not contain "metric" field.

Google Employee
# 2
Google Employee

Hi @Alvaro L,

 

You should be able to get metric of data about your business using reportInsights method. Could you please provide us with the full HTTP request message of the POST request including the URI, and the JSON payloads of request body for triggering this error so that we can help you troubleshoot this issue further.  

 

Thanks,

The Google My Business API team

Re: MetricValue does not contain "metric" field.

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

@Shalini S

 

I am also encountering this same error, where some of the 'metricValues' do not contain a 'metric' name.

Valid response:

'totalValue': {
				'metricOption': 'AGGREGATED_TOTAL',
				'value': '2',
				'timeDimension': {
					'timeRange': {
						'startTime': '2017-04-29T05:00:00Z',
						'endTime': '2017-04-30T05:00:00Z'
					}
				}
			},
			'metric': 'QUERIES_DIRECT'

Invalid response:

{
			'totalValue': {
				'metricOption': 'AGGREGATED_TOTAL',
				'value': '10',
				'timeDimension': {
					'timeRange': {
						'startTime': '2017-04-29T05:00:00Z',
						'endTime': '2017-04-30T05:00:00Z'
					}
				}
			}

 As you can see the Invalid response doesn't provide the 'metric' key.

 

Sample JSON payload below:

{
	'locationNames': ['accounts/xxxxxxxx/locations/xxxxxxx', 'accounts/xxxxxxx/locations/xxxxxx],
	'basicRequest': {
		'metricRequests': {
			'options': 'AGGREGATED_TOTAL',
			'metric': 'ALL'
		},
		'timeRange': {
			'startTime': '2017-04-29T00:00:00-05:00',
			'endTime': '2017-04-30T00:00:00-05:00'
		}
	}
}

Re: MetricValue does not contain "metric" field.

Google Employee
# 4
Google Employee

Hi @Alvaro L & @Jeff L,

 

We’ll reach out to you privately in a separate email thread for more details.

 

Thanks,

Shalini, Google My Business API team