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 Platform Console
web UI), and our recommendation for most operational use cases, is via the
command line interface. If
you need to program against the Service Management API, we recommend that
you use one of our provided
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
Sign in to your Google Account.
If you don't already have one, sign up for a new account.
Select or create a Google Cloud Platform project.
- Enable the Service Management API.
- 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.
- Go to the GCP Console
go to the Service Accounts page
- Click Select to choose the Google Cloud Platform project that you want to use to access the service.
- 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.adminrole. To learn how to grant roles to service accounts, see Granting Roles to Service Accounts.
- Go to the GCP Console
go to the API Credentials page
- 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.
- Install oauth2l on your local machine so you can interact with the Google OAuth system.
Test with curl
Verify your initial setup first:
$ oauth2l header --json ~/credentials.json cloud-platform
After finishing the OAuth flow, you should see output like this:
Authorization: Bearer y29.xxxxxxx
Define a convenient shell alias for calling Google REST APIs:
$ alias gcurl='curl -H "$(oauth2l header --json ~/credentials.json cloud-platform userinfo.email)" -H "Content-Type: application/json"'
Try listing public accessible services:
$ gcurl https://servicemanagement.googleapis.com/v1/services
If you see a list of services, the setup is successful.
If you are creating a managed service and you are not using Cloud Endpoints:
- Follow Creating and Deleting Services to create managed services. This will create a top level managed service resource.
Follow Rolling Out Service Configurations to roll out your service configurations.