Method: domains.domainStats.query

Retrieves a list of domain statistics for a given domain and time period. Returns PERMISSION_DENIED if you don't have permission to access DomainStats for the domain.

HTTP request

POST https://gmailpostmastertools.googleapis.com/v2beta/{parent=domains/*}/domainStats:query

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
parent

string

Required. The parent resource name where the stats are queried. Format: domains/{domain}

Request body

The request body contains data with the following structure:

JSON representation
{
  "metricDefinitions": [
    {
      object (MetricDefinition)
    }
  ],
  "timeQuery": {
    object (TimeQuery)
  },
  "pageSize": integer,
  "pageToken": string,
  "aggregationGranularity": enum (AggregationGranularity)
}
Fields
metricDefinitions[]

object (MetricDefinition)

Required. The specific metrics to query. You can define a custom name for each metric, which will be used in the response.

timeQuery

object (TimeQuery)

Required. The time range or specific dates for which to retrieve the metrics.

pageSize

integer

Optional. The maximum number of DomainStats resources to return in the response. The server may return fewer than this value. If unspecified, a default value of 10 will be used. The maximum value is 200.

pageToken

string

Optional. The nextPageToken value returned from a previous List request, if any. If the aggregation granularity is DAILY, the page token will be the encoded date + "/" + metric name. If the aggregation granularity is OVERALL, the page token will be the encoded metric name.

aggregationGranularity

enum (AggregationGranularity)

Optional. The granularity at which to aggregate the statistics. If unspecified, defaults to DAILY.

Response body

If successful, the response body contains an instance of QueryDomainStatsResponse.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/postmaster
  • https://www.googleapis.com/auth/postmaster.traffic.readonly

For more information, see the Authorization guide.