Getting Started with the Service Management API

This page describes how to set up your development environment to work with the Service Management API. The simplest approach to using the Service Management API (other than just using the Google Cloud console web UI), and our recommendation for most operational use cases, is via the gcloud command line interface. If you need to program against the Service Management API, we recommend that you use one of our provided client libraries. To experiment with the API, you can follow the alternative setup instructions below and use the curl command to play with the API without setting up a full application development environment.

Setup using gcloud

  1. 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.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Enable the Service Management API.

    Enable the API

  4. Install the Google Cloud CLI.
  5. To initialize the gcloud CLI, run the following command:

    gcloud init
  6. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  7. Enable the Service Management API.

    Enable the API

  8. Install the Google Cloud CLI.
  9. To initialize the gcloud CLI, run the following command:

    gcloud init

Setup to call the API directly

This section describes the basic steps necessary to set up your local environment to experiment with the Service Management API using the curl command. It is aimed at developers who need to program against the Service Management API.

Initial setup

  1. 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.
  2. Install the Google Cloud CLI.
  3. To initialize the gcloud CLI, run the following command:

    gcloud init
  4. Create or select a Google Cloud project.

    • Create a Google Cloud project:

      gcloud projects create PROJECT_ID

      Replace PROJECT_ID with a name for the Google Cloud project you are creating.

    • Select the Google Cloud project that you created:

      gcloud config set project PROJECT_ID

      Replace PROJECT_ID with your Google Cloud project name.

  5. Enable the Service Management API:

    gcloud services enable servicemanagement.googleapis.com
  6. Grant roles to your user account. Run the following command once for each of the following IAM roles: roles/servicemanagement.admin

    gcloud projects add-iam-policy-binding PROJECT_ID --member="USER_IDENTIFIER" --role=ROLE
    • Replace PROJECT_ID with your project ID.
    • Replace USER_IDENTIFIER with the identifier for your user account. For example, user:myemail@example.com.

    • Replace ROLE with each individual role.
  7. Install the Google Cloud CLI.
  8. To initialize the gcloud CLI, run the following command:

    gcloud init
  9. Create or select a Google Cloud project.

    • Create a Google Cloud project:

      gcloud projects create PROJECT_ID

      Replace PROJECT_ID with a name for the Google Cloud project you are creating.

    • Select the Google Cloud project that you created:

      gcloud config set project PROJECT_ID

      Replace PROJECT_ID with your Google Cloud project name.

  10. Enable the Service Management API:

    gcloud services enable servicemanagement.googleapis.com
  11. Grant roles to your user account. Run the following command once for each of the following IAM roles: roles/servicemanagement.admin

    gcloud projects add-iam-policy-binding PROJECT_ID --member="USER_IDENTIFIER" --role=ROLE
    • Replace PROJECT_ID with your project ID.
    • Replace USER_IDENTIFIER with the identifier for your user account. For example, user:myemail@example.com.

    • Replace ROLE with each individual role.

Test with curl

  1. 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"'
    
  2. Try listing publicly accessible services:

    $ gcurl https://servicemanagement.googleapis.com/v1/services
    

    If you see a list of services, the setup is successful.

Next steps

If you are creating a managed service and you are not using Cloud Endpoints:

  1. Follow Creating and Deleting Services to create managed services. This will create a top level managed service resource.
  2. Follow Managing Service Configurations to submit service configurations to describe features used by the service.

  3. Follow Rolling Out Service Configurations to roll out your service configurations.