Method: domainStats.batchQuery

Executes a batch of QueryDomainStats requests for multiple domains. Returns PERMISSION_DENIED if you don't have permission to access DomainStats for any of the requested domains.

HTTP request

POST https://gmailpostmastertools.googleapis.com/v2beta/domainStats:batchQuery

The URL uses gRPC Transcoding syntax.

Request body

The request body contains data with the following structure:

JSON representation
{
  "requests": [
    {
      object (QueryDomainStatsRequest)
    }
  ]
}
Fields
requests[]

object (QueryDomainStatsRequest)

Required. A list of individual query requests. Each request can be for a different domain. A maximum of 100 requests can be included in a single batch.

Response body

Response message for domainStats.batchQuery.

If successful, the response body contains data with the following structure:

JSON representation
{
  "results": [
    {
      object (BatchQueryDomainStatsResult)
    }
  ]
}
Fields
results[]

object (BatchQueryDomainStatsResult)

A list of responses, one for each query in the BatchQueryDomainStatsRequest. The order of responses will correspond to the order of requests.

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.

QueryDomainStatsRequest

Request message for QueryDomainStats.

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

string

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

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.

BatchQueryDomainStatsResult

Represents the result of a single QueryDomainStatsRequest within a batch.

JSON representation
{

  // Union field result can be only one of the following:
  "response": {
    object (QueryDomainStatsResponse)
  },
  "error": {
    object (Status)
  }
  // End of list of possible types for union field result.
}
Fields
Union field result. The result of the individual query. result can be only one of the following:
response

object (QueryDomainStatsResponse)

The successful response for the individual query.

error

object (Status)

The error status if the individual query failed.

Status

The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC. Each Status message contains three pieces of data: error code, error message, and error details.

You can find out more about this error model and how to work with it in the API Design Guide.

JSON representation
{
  "code": integer,
  "message": string,
  "details": [
    {
      "@type": string,
      field1: ...,
      ...
    }
  ]
}
Fields
code

integer

The status code, which should be an enum value of google.rpc.Code.

message

string

A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.

details[]

object

A list of messages that carry the error details. There is a common set of message types for APIs to use.