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. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity .

  6. To initialize the gcloud CLI, run the following command:

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

    Go to project selector

  8. Enable the Service Management API.

    Enable the API

  9. Install the Google Cloud CLI.

  10. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity .

  11. 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. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity .

  4. To initialize the gcloud CLI, run the following command:

    gcloud  
    init
  5. 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.

  6. Enable the Service Management API:

    gcloud  
    services  
     enable 
      
    servicemanagement.googleapis.com
  7. 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: USER_IDENTIFIER 
    " 
      
    --role = 
     ROLE 
    

    Replace the following:

    • PROJECT_ID : your project ID.
    • USER_IDENTIFIER : the identifier for your user account—for example, myemail@example.com .
    • ROLE : the IAM role that you grant to your user account.
  8. Install the Google Cloud CLI.

  9. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity .

  10. To initialize the gcloud CLI, run the following command:

    gcloud  
    init
  11. 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.

  12. Enable the Service Management API:

    gcloud  
    services  
     enable 
      
    servicemanagement.googleapis.com
  13. 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: USER_IDENTIFIER 
    " 
      
    --role = 
     ROLE 
    

    Replace the following:

    • PROJECT_ID : your project ID.
    • USER_IDENTIFIER : the identifier for your user account—for example, myemail@example.com .
    • ROLE : the IAM role that you grant to your user account.

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.

Create a Mobile Website
View Site in Mobile | Classic
Share by: