0

According to this page https://developers.google.com/maps/reporting-and-monitoring/reporting?hl=en#usage-tracking-per-channel there is opportunity to use param channel for tracking usage of api.

How I should to set this param (channel) for tracking usage of api? Or this functionality not working in Routes API?

When I set param channel in request

curl -X POST -d '{
    "origin":{
        "location":{
            "latLng":{
                "latitude": 37.419734,
                "longitude": -122.0827784
            }
        }
    },
    "destination":{
        "location":{
            "latLng":{
                "latitude": 37.417670,
                "longitude": -122.079595
            }
        }
    },
    "travelMode": "DRIVE",
    "routingPreference": "TRAFFIC_AWARE",
    "departureTime": "2023-10-15T15:01:23.045123456Z",
    "computeAlternativeRoutes": false,
    "routeModifiers": {
        "avoidTolls": false,
        "avoidHighways": false,
        "avoidFerries": false
    },
    "languageCode": "en-US",
    "units": "IMPERIAL"
}' \
\-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: YOUR-API-KEY' \
\-H 'X-Goog-FieldMask: routes.duration,routes.distanceMeters,routes.polyline.encodedPolyline' \
'https://routes.googleapis.com/directions/v2:computeRoutes?key=YOUR-API-KEY&**channel**=3'

I get response with message "Invalid JSON payload received. Unknown name "channel": Cannot bind query parameter. Field 'channel' could not be found in request message."

0 Answers0