Set up the Cloud Quotas API

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:

  1. Go to the Google Cloud console API Library page.
    Go to the API Library page

  2. Select the Google Cloud project that you want to use to access the service.

  3. On the API Library page, enable Cloud Quotas API.

  4. Make sure that your user account has the required IAM roles.

Set up gCurl

  1. 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

  2. Successful output looks similar to the following:

    Waiting for async operation operations/acf.2e2fcfce-8327-4984-9040-a67777082687 to complete…
    Operation finished successfully.

  3. Define a convenient shell alias for calling Google REST APIs:

    alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" -H "x-goog-user-project:${BILLING_PROJECT_ID}"'
  4. Set an environment variable PROJECT_ID with the identifier of your project. This can be the project ID or number:

  5. Ensure that you are logged into the gcloud CLI:

    gcloud auth login
  6. List the enabled APIs and services in this project:

    gcurl "${PROJECT_ID}/services?filter=state:ENABLED&fields=services.config.title,"

    If you see output like this, then your setup is successful:

    "services": [
        "config": {
          "name": "",
          "title": "Cloud Quotas API"

What's next