To inspect a report's settings, such as its scope and metrics, or to check its expiry time, use App Optimize API to get the report's metadata.
This API request does not return the actual data rows within the report. To download this information, you need to read the report's data.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init -
Verify that you have the permissions required to complete this guide.
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init -
Verify that you have the permissions required to complete this guide.
Required roles
To get the permissions that
you need to read a report's metadata,
ask your administrator to grant you the
App Optimize Viewer (roles/appoptimize.viewer)
IAM role on the project that owns the report resource.
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
Get report metadata
To retrieve the metadata for a report, using the REST API, send a HTTP GET request to the
report's resource endpoint.
Use the following curl command to get the report
metadata:
curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://appoptimize.googleapis.com/v1beta/projects/PROJECT_ID/locations/global/reports/REPORT_ID"
Replace the following:
PROJECT_ID: the ID of the Google Cloud project that owns the report resource that you want to retrieve.REPORT_ID: the ID of the report to retrieve. This ID was specified when the report was created, and can be obtained by listing reports.
If the request is successful, the API returns a JSON response containing the report metadata.
Here is an example successful response, including the dimension and metric selected, the project scope, and when the report is scheduled to expire:
{
"name": "projects/PROJECT_ID/locations/global/reports/REPORT_ID",
"dimensions": [
"location",
"product_display_name",
"project",
"resource",
"resource_type"
],
"scopes": [
{
"project": "projects/PROJECT_ID"
}
],
"filter": "hour >= now - duration(\"168h\")",
"expireTime": "2026-02-05T18:50:25.273833857Z",
"metrics": [
"cost",
"cpu_mean_utilization"
]
}