getMetadata method
Returns metadata for dimensions and metrics available in reporting methods.
Used to explore the dimensions and metrics. In this method, a Google
Analytics GA4 Property Identifier is specified in the request, and the
metadata response includes Custom dimensions and metrics as well as
Universal metadata. For example if a custom metric with parameter name
levels_unlocked
is registered to a property, the Metadata response will
contain customEvent:levels_unlocked
. Universal metadata are dimensions
and metrics applicable to any property such as country
and totalUsers
.
Request parameters:
name
- Required. The resource name of the metadata to retrieve. This
name field is specified in the URL path and not URL parameters. Property
is a numeric Google Analytics GA4 Property identifier. To learn more, see
where to find your Property ID.
Example: properties/1234/metadata Set the Property ID to 0 for dimensions
and metrics common to all properties. In this special mode, this method
will not return custom dimensions and metrics.
Value must have pattern ^properties/\[^/\]+/metadata$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Metadata.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<Metadata> getMetadata(
core.String name, {
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1beta/' + core.Uri.encodeFull('$name');
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return Metadata.fromJson(response_ as core.Map<core.String, core.dynamic>);
}