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 and initialize the Cloud SDK.

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. Go to the Cloud Console Service Accounts page.
    go to the Service Accounts page
  2. Click Select to choose the Google Cloud project that you want to use to access the service.
  3. Create a service account. To learn how to create service accounts, see Creating and Managing Service Account. To follow the instructions in this section, you must grant the service account the roles/servicemanagement.admin role. To learn how to grant roles to service accounts, see Granting Roles to Service Accounts.
  4. Go to the Cloud Console API Credentials page.
    go to the API Credentials page
  5. Create a service account key for your new service account and download its JSON credential file to your local machine. The examples in this guide assume the file path is ~/credentials.json. To learn how to create service account keys, see Creating and Managing Service Account Keys.
  6. Install oauth2l on your local machine so you can interact with the Google OAuth system.

Test with curl

  1. Verify your initial setup first:

    $ oauth2l header --json ~/credentials.json cloud-platform
  2. After finishing the OAuth flow, you should see output like this:

    Authorization: Bearer y29.xxxxxxx
  3. Define a convenient shell alias for calling Google REST APIs:

    $ alias gcurl='curl -H "$(oauth2l header --json ~/credentials.json cloud-platform)" -H "Content-Type: application/json"'
  4. Try listing public accessible services:

    $ gcurl

    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.