Apigee API . organizations . environments . queries

Instance Methods

close()

Close httplib2 connections.

create(parent, body=None, x__xgafv=None)

Submit a query to be processed in the background. If the submission of the query succeeds, the API returns a 201 status and an ID that refer to the query. In addition to the HTTP status 201, the `state` of "enqueued" means that the request succeeded.

get(name, x__xgafv=None)

Get query status If the query is still in progress, the `state` is set to "running" After the query has completed successfully, `state` is set to "completed"

getResult(name, x__xgafv=None)

After the query is completed, use this API to retrieve the results. If the request succeeds, and there is a non-zero result set, the result is downloaded to the client as a zipped JSON file. The name of the downloaded file will be: OfflineQueryResult-.zip Example: `OfflineQueryResult-9cfc0d85-0f30-46d6-ae6f-318d0cb961bd.zip`

getResulturl(name, x__xgafv=None)

After the query is completed, use this API to retrieve the results. If the request succeeds, and there is a non-zero result set, the result is sent to the client as a list of urls to JSON files.

list(parent, dataset=None, from=None, inclQueriesWithoutReport=None, status=None, submittedBy=None, to=None, x__xgafv=None)

Return a list of Asynchronous Queries

Method Details

close()
Close httplib2 connections.
create(parent, body=None, x__xgafv=None)
Submit a query to be processed in the background. If the submission of the query succeeds, the API returns a 201 status and an ID that refer to the query. In addition to the HTTP status 201, the `state` of "enqueued" means that the request succeeded.

Args:
  parent: string, Required. The parent resource name. Must be of the form `organizations/{org}/environments/{env}`. (required)
  body: object, The request body.
    The object takes the form of:

{
  "csvDelimiter": "A String", # Delimiter used in the CSV file, if `outputFormat` is set to `csv`. Defaults to the `,` (comma) character. Supported delimiter characters include comma (`,`), pipe (`|`), and tab (`\t`).
  "dimensions": [ # A list of dimensions. https://docs.apigee.com/api-platform/analytics/analytics-reference#dimensions
    "A String",
  ],
  "envgroupHostname": "A String", # Hostname needs to be specified if query intends to run at host level. This field is only allowed when query is submitted by CreateHostAsyncQuery where analytics data will be grouped by organization and hostname.
  "filter": "A String", # Boolean expression that can be used to filter data. Filter expressions can be combined using AND/OR terms and should be fully parenthesized to avoid ambiguity. See Analytics metrics, dimensions, and filters reference https://docs.apigee.com/api-platform/analytics/analytics-reference for more information on the fields available to filter on. For more information on the tokens that you use to build filter expressions, see Filter expression syntax. https://docs.apigee.com/api-platform/analytics/asynch-reports-api#filter-expression-syntax
  "groupByTimeUnit": "A String", # Time unit used to group the result set. Valid values include: second, minute, hour, day, week, or month. If a query includes groupByTimeUnit, then the result is an aggregation based on the specified time unit and the resultant timestamp does not include milliseconds precision. If a query omits groupByTimeUnit, then the resultant timestamp includes milliseconds precision.
  "limit": 42, # Maximum number of rows that can be returned in the result.
  "metrics": [ # A list of Metrics.
    { # More info about Metric: https://docs.apigee.com/api-platform/analytics/analytics-reference#metrics
      "alias": "A String", # Alias for the metric. Alias will be used to replace metric name in query results.
      "function": "A String", # Aggregation function: avg, min, max, or sum.
      "name": "A String", # Required. Metric name.
      "operator": "A String", # One of `+`, `-`, `/`, `%`, `*`.
      "value": "A String", # Operand value should be provided when operator is set.
    },
  ],
  "name": "A String", # Asynchronous Query Name.
  "outputFormat": "A String", # Valid values include: `csv` or `json`. Defaults to `json`. Note: Configure the delimiter for CSV output using the csvDelimiter property.
  "reportDefinitionId": "A String", # Asynchronous Report ID.
  "timeRange": "", # Required. Time range for the query. Can use the following predefined strings to specify the time range: `last60minutes` `last24hours` `last7days` Or, specify the timeRange as a structure describing start and end timestamps in the ISO format: yyyy-mm-ddThh:mm:ssZ. Example: "timeRange": { "start": "2018-07-29T00:13:00Z", "end": "2018-08-01T00:18:00Z" }
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    {
  "created": "A String", # Creation time of the query.
  "envgroupHostname": "A String", # Hostname is available only when query is executed at host level.
  "error": "A String", # Error is set when query fails.
  "executionTime": "A String", # ExecutionTime is available only after the query is completed.
  "name": "A String", # Asynchronous Query Name.
  "queryParams": { # Contains information like metrics, dimenstions etc of the AsyncQuery.
    "dimensions": [ # Dimensions of the AsyncQuery.
      "A String",
    ],
    "endTimestamp": "A String", # End timestamp of the query range.
    "metrics": [ # Metrics of the AsyncQuery. Example: ["name:message_count,func:sum,alias:sum_message_count"]
      "A String",
    ],
    "outputFormat": "A String", # Output format.
    "startTimestamp": "A String", # Start timestamp of the query range.
    "timeUnit": "A String", # Query GroupBy time unit.
  },
  "reportDefinitionId": "A String", # Asynchronous Report ID.
  "result": { # Result is available only after the query is completed.
    "expires": "A String", # Query result will be unaccessable after this time.
    "self": "A String", # Self link of the query results. Example: `/organizations/myorg/environments/myenv/queries/9cfc0d85-0f30-46d6-ae6f-318d0cb961bd/result` or following format if query is running at host level: `/organizations/myorg/hostQueries/9cfc0d85-0f30-46d6-ae6f-318d0cb961bd/result`
  },
  "resultFileSize": "A String", # ResultFileSize is available only after the query is completed.
  "resultRows": "A String", # ResultRows is available only after the query is completed.
  "self": "A String", # Self link of the query. Example: `/organizations/myorg/environments/myenv/queries/9cfc0d85-0f30-46d6-ae6f-318d0cb961bd` or following format if query is running at host level: `/organizations/myorg/hostQueries/9cfc0d85-0f30-46d6-ae6f-318d0cb961bd`
  "state": "A String", # Query state could be "enqueued", "running", "completed", "failed".
  "updated": "A String", # Last updated timestamp for the query.
}
get(name, x__xgafv=None)
Get query status If the query is still in progress, the `state` is set to "running" After the query has completed successfully, `state` is set to "completed"

Args:
  name: string, Required. Name of the asynchronous query to get. Must be of the form `organizations/{org}/environments/{env}/queries/{queryId}`. (required)
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    {
  "created": "A String", # Creation time of the query.
  "envgroupHostname": "A String", # Hostname is available only when query is executed at host level.
  "error": "A String", # Error is set when query fails.
  "executionTime": "A String", # ExecutionTime is available only after the query is completed.
  "name": "A String", # Asynchronous Query Name.
  "queryParams": { # Contains information like metrics, dimenstions etc of the AsyncQuery.
    "dimensions": [ # Dimensions of the AsyncQuery.
      "A String",
    ],
    "endTimestamp": "A String", # End timestamp of the query range.
    "metrics": [ # Metrics of the AsyncQuery. Example: ["name:message_count,func:sum,alias:sum_message_count"]
      "A String",
    ],
    "outputFormat": "A String", # Output format.
    "startTimestamp": "A String", # Start timestamp of the query range.
    "timeUnit": "A String", # Query GroupBy time unit.
  },
  "reportDefinitionId": "A String", # Asynchronous Report ID.
  "result": { # Result is available only after the query is completed.
    "expires": "A String", # Query result will be unaccessable after this time.
    "self": "A String", # Self link of the query results. Example: `/organizations/myorg/environments/myenv/queries/9cfc0d85-0f30-46d6-ae6f-318d0cb961bd/result` or following format if query is running at host level: `/organizations/myorg/hostQueries/9cfc0d85-0f30-46d6-ae6f-318d0cb961bd/result`
  },
  "resultFileSize": "A String", # ResultFileSize is available only after the query is completed.
  "resultRows": "A String", # ResultRows is available only after the query is completed.
  "self": "A String", # Self link of the query. Example: `/organizations/myorg/environments/myenv/queries/9cfc0d85-0f30-46d6-ae6f-318d0cb961bd` or following format if query is running at host level: `/organizations/myorg/hostQueries/9cfc0d85-0f30-46d6-ae6f-318d0cb961bd`
  "state": "A String", # Query state could be "enqueued", "running", "completed", "failed".
  "updated": "A String", # Last updated timestamp for the query.
}
getResult(name, x__xgafv=None)
After the query is completed, use this API to retrieve the results. If the request succeeds, and there is a non-zero result set, the result is downloaded to the client as a zipped JSON file. The name of the downloaded file will be: OfflineQueryResult-.zip Example: `OfflineQueryResult-9cfc0d85-0f30-46d6-ae6f-318d0cb961bd.zip`

Args:
  name: string, Required. Name of the asynchronous query result to get. Must be of the form `organizations/{org}/environments/{env}/queries/{queryId}/result`. (required)
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Message that represents an arbitrary HTTP body. It should only be used for payload formats that can't be represented as JSON, such as raw binary or an HTML page. This message can be used both in streaming and non-streaming API methods in the request as well as the response. It can be used as a top-level request field, which is convenient if one wants to extract parameters from either the URL or HTTP template into the request fields and also want access to the raw HTTP body. Example: message GetResourceRequest { // A unique request id. string request_id = 1; // The raw HTTP body is bound to this field. google.api.HttpBody http_body = 2; } service ResourceService { rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); rpc UpdateResource(google.api.HttpBody) returns (google.protobuf.Empty); } Example with streaming methods: service CaldavService { rpc GetCalendar(stream google.api.HttpBody) returns (stream google.api.HttpBody); rpc UpdateCalendar(stream google.api.HttpBody) returns (stream google.api.HttpBody); } Use of this type only changes how the request and response bodies are handled, all other features will continue to work unchanged.
  "contentType": "A String", # The HTTP Content-Type header value specifying the content type of the body.
  "data": "A String", # The HTTP request/response body as raw binary.
  "extensions": [ # Application specific response metadata. Must be set in the first response for streaming APIs.
    {
      "a_key": "", # Properties of the object. Contains field @type with type URL.
    },
  ],
}
getResulturl(name, x__xgafv=None)
After the query is completed, use this API to retrieve the results. If the request succeeds, and there is a non-zero result set, the result is sent to the client as a list of urls to JSON files.

Args:
  name: string, Required. Name of the asynchronous query result to get. Must be of the form `organizations/{org}/environments/{env}/queries/{queryId}/resulturl`. (required)
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # The response for GetAsyncQueryResultUrl
  "urls": [ # The list of Signed URLs generated by the CreateAsyncQuery request
    { # A Signed URL and the relevant metadata associated with it.
      "md5": "A String", # The MD5 Hash of the JSON data
      "sizeBytes": "A String", # The size of the returned file in bytes
      "uri": "A String", # The signed URL of the JSON data. Will be of the form `https://storage.googleapis.com/example-bucket/cat.jpeg?X-Goog-Algorithm= GOOG4-RSA-SHA256&X-Goog-Credential=example%40example-project.iam.gserviceaccount .com%2F20181026%2Fus-central1%2Fstorage%2Fgoog4_request&X-Goog-Date=20181026T18 1309Z&X-Goog-Expires=900&X-Goog-SignedHeaders=host&X-Goog-Signature=247a2aa45f16 9edf4d187d54e7cc46e4731b1e6273242c4f4c39a1d2507a0e58706e25e3a85a7dbb891d62afa849 6def8e260c1db863d9ace85ff0a184b894b117fe46d1225c82f2aa19efd52cf21d3e2022b3b868dc c1aca2741951ed5bf3bb25a34f5e9316a2841e8ff4c530b22ceaa1c5ce09c7cbb5732631510c2058 0e61723f5594de3aea497f195456a2ff2bdd0d13bad47289d8611b6f9cfeef0c46c91a455b94e90a 66924f722292d21e24d31dcfb38ce0c0f353ffa5a9756fc2a9f2b40bc2113206a81e324fc4fd6823 a29163fa845c8ae7eca1fcf6e5bb48b3200983c56c5ca81fffb151cca7402beddfc4a76b13344703 2ea7abedc098d2eb14a7`
    },
  ],
}
list(parent, dataset=None, from=None, inclQueriesWithoutReport=None, status=None, submittedBy=None, to=None, x__xgafv=None)
Return a list of Asynchronous Queries

Args:
  parent: string, Required. The parent resource name. Must be of the form `organizations/{org}/environments/{env}`. (required)
  dataset: string, Filter response list by dataset. Example: `api`, `mint`
  from: string, Filter response list by returning asynchronous queries that created after this date time. Time must be in ISO date-time format like '2011-12-03T10:15:30Z'.
  inclQueriesWithoutReport: string, Flag to include asynchronous queries that don't have a report denifition.
  status: string, Filter response list by asynchronous query status.
  submittedBy: string, Filter response list by user who submitted queries.
  to: string, Filter response list by returning asynchronous queries that created before this date time. Time must be in ISO date-time format like '2011-12-03T10:16:30Z'.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # The response for ListAsyncQueries.
  "queries": [ # The asynchronous queries belong to requested resource name.
    {
      "created": "A String", # Creation time of the query.
      "envgroupHostname": "A String", # Hostname is available only when query is executed at host level.
      "error": "A String", # Error is set when query fails.
      "executionTime": "A String", # ExecutionTime is available only after the query is completed.
      "name": "A String", # Asynchronous Query Name.
      "queryParams": { # Contains information like metrics, dimenstions etc of the AsyncQuery.
        "dimensions": [ # Dimensions of the AsyncQuery.
          "A String",
        ],
        "endTimestamp": "A String", # End timestamp of the query range.
        "metrics": [ # Metrics of the AsyncQuery. Example: ["name:message_count,func:sum,alias:sum_message_count"]
          "A String",
        ],
        "outputFormat": "A String", # Output format.
        "startTimestamp": "A String", # Start timestamp of the query range.
        "timeUnit": "A String", # Query GroupBy time unit.
      },
      "reportDefinitionId": "A String", # Asynchronous Report ID.
      "result": { # Result is available only after the query is completed.
        "expires": "A String", # Query result will be unaccessable after this time.
        "self": "A String", # Self link of the query results. Example: `/organizations/myorg/environments/myenv/queries/9cfc0d85-0f30-46d6-ae6f-318d0cb961bd/result` or following format if query is running at host level: `/organizations/myorg/hostQueries/9cfc0d85-0f30-46d6-ae6f-318d0cb961bd/result`
      },
      "resultFileSize": "A String", # ResultFileSize is available only after the query is completed.
      "resultRows": "A String", # ResultRows is available only after the query is completed.
      "self": "A String", # Self link of the query. Example: `/organizations/myorg/environments/myenv/queries/9cfc0d85-0f30-46d6-ae6f-318d0cb961bd` or following format if query is running at host level: `/organizations/myorg/hostQueries/9cfc0d85-0f30-46d6-ae6f-318d0cb961bd`
      "state": "A String", # Query state could be "enqueued", "running", "completed", "failed".
      "updated": "A String", # Last updated timestamp for the query.
    },
  ],
}