A report created by App Optimize API is automatically deleted 24 hours after its creation. However, you can use the API to explicitly delete the report before its scheduled expiry if it's no longer needed.
Once deleted, a report and its data are no longer accessible from App Optimize API.
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 delete a report,
ask your administrator to grant you the
App Optimize Admin (roles/appoptimize.admin)
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.
Delete a report
To delete a report, using the REST API, send a HTTP DELETE request to the report's resource
endpoint.
Use the following curl command to send the request:
curl -X DELETE \
-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 delete.REPORT_ID: the ID of the report to delete. This ID was specified when the report was created, and can be obtained by listing reports in the project.
If the request is successful, the API returns the empty JSON response {}.
What's next
- Learn how to create and read a report.
- Understand access control with IAM.
- Learn how to list reports.