This page describes how to set up your development environment to use the
Cloud Quotas API and how to setup the curl
command to test the API
without setting up a full application development environment. You don't need
to complete these instructions if you want to
list, enable, or disable services using Google Cloud console.
Enable the Cloud Quotas API
To use the Cloud Quotas API, you must first enable it in the Google Cloud project you want to use it for:
-
Go to the Google Cloud console API Library page.
Select the Google Cloud project that you want to use to access the service.
On the API Library page, enable Cloud Quotas API.
Make sure that your user account has the required IAM roles.
Set up gCurl
To enable the Cloud Quotas API, run the following command to enable the service in the Google Cloud project you want to use it for:
gcloud services enable cloudquotas.googleapis.com
Successful output looks similar to the following:
Waiting for async operation operations/acf.2e2fcfce-8327-4984-9040-a67777082687 to complete… Operation finished successfully.
Define a convenient shell alias for calling Google REST APIs:
BILLING_PROJECT_ID="my-billing-project-id" alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" -H "x-goog-user-project:${BILLING_PROJECT_ID}"'
Set an environment variable
PROJECT_ID
with the identifier of your project. This can be the project ID or number:PROJECT_ID="my-project-id"
Make sure that you are logged into the gcloud CLI:
gcloud auth login
List the enabled APIs and services in this project:
gcurl "https://serviceusage.googleapis.com/v1/projects/${PROJECT_ID}/services?filter=state:ENABLED&fields=services.config.title,services.config.name"
If you see output similar to the following, then your setup is successful:
{ "services": [ ... { "config": { "name": "cloudquotas.googleapis.com", "title": "Cloud Quotas API" } }, ... ] }
What's next
About the Cloud Quotas API
Cloud Quotas API reference