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 the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Enable the Service Management API.
- Install the Google Cloud CLI.
-
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
- 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.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
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.
-
-
Enable the Service Management API:
gcloud services enable servicemanagement.googleapis.com
-
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.
- Replace
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
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.
-
-
Enable the Service Management API:
gcloud services enable servicemanagement.googleapis.com
-
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.
- Replace
Test with curl
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"'
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:
- 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.