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
- 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.
-
In the Google Cloud Console, on the project selector page, select or create a Google Cloud 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.
Initial setup
- Go to the Cloud Console
Service Accounts
page.
go to the Service Accounts page - Click Select to choose the Google Cloud 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.admin
role. To learn how to grant roles to service accounts, see Granting Roles to Service Accounts. - Go to the Cloud Console
API Credentials
page.
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)" -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.
Next steps
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 Managing Service Configurations to submit service configurations to describe features used by the service.
Follow Rolling Out Service Configurations to roll out your service configurations.