To proceed, make sure you've completed the steps in Prerequisites and that your project has been approved for Google My Business API access.
Enable the API
You can enable the Google My Business API in the developer console of your Google Developers project through either of two methods:
Use the provided shortcut to enable the API
To enable the Google My Business API, click the Enable the Google My Business API button below. Use the down arrow to select an existing project, or create a new project.Enable the Google My Business API
If you haven't successfully completed all of the steps in Prerequisites, you might see the following error message:
"Something went wrong. Please try again."
Make sure that you've completed all of the required prerequisites and that you've requested access to the API.
Manually enable the API
If you've completed all of the Prerequisites and have been granted access to the API, but were unable to use the provided shortcut, you can enable the API manually with the following steps.
To enable an API for your project, do the following:
- Open the API Library in the Google API Console. If prompted, select a project or create a new one. The API Library lists all available APIs, grouped by product family and popularity.
- If the API you want to enable isn't visible in the list, use search to find it.
- Select the API you want to enable, then click the Enable button.
- If prompted, enable billing.
- If prompted, accept the API's Terms of Service.
Request an OAuth 2.0 client ID
Because your app accesses protected (non-public) data, you need an OAuth 2.0 client ID. This lets your app request authorization to access your organization's location data on behalf of your app's users.
Your application must send an OAuth 2.0 token with any Google My Business API request that accesses private user data.
Learn REST basics
There are two ways to invoke the API:
- Send an HTTP request and parse the responses.
- Use client libraries.
If you decide not to use client libraries, you need to understand the basics of REST.
REST is a style of software architecture that provides a convenient and consistent approach to request and modify data.
The term REST is short for "Representational State Transfer." In the context of Google APIs, it refers to the use of HTTP verbs to retrieve and modify representations of data stored by Google.
In a RESTful system, resources are stored in a data store. A client sends a request for the server to perform a particular action, such as to create, retrieve, update, or delete a resource, and the server performs the action and sends a response. That response is often in the form of a representation of the specified resource.
In Google's RESTful APIs, the client specifies an action with an HTTP verb, such as
DELETE. The client specifies
a resource by a globally unique uniform resource identifier (URI) of the following form:
Because all API resources have unique HTTP-accessible URIs, REST enables data caching and is optimized to work with the web's distributed infrastructure.
You might find the
method definitions in
the HTTP 1.1 standards documentation useful. They include specifications for
REST in the Google My Business API
The Google My Business API operations map directly to REST HTTP verbs.
The specific format for the Google My Business API is shown in the following URI:
The full set of URIs used for each supported operation in the API is summarized in the Google My Business API Reference documentation.
Resource IDs are defined by a resource path of the following form:
locationId represent the numeric
portion of the ID.
The resource path to an account appears as in the following example:
The resource path for a location appears in the following form:
Learn JSON basics
The Google My Business API returns data in JSON format.
Make a simple HTTP request
You can use the OAuth 2.0 Playground to experiment with the Google My Business API. Because the Google My Business API isn't a public API, there are a few extra steps you need to take to use it in the Playground. You need a client ID for a web application to proceed.
- Go to the Google API Console and open your project. If you don't have an OAuth client ID for web applications, create one now:
- From the Create credentials drop-down list, select OAuth client ID.
- For Application type, click Web Application.
https://developers.google.com/oauthplaygroundas a valid redirect URI.
- Click Create.
- Copy the client ID to the clipboard.
- Go to OAuth 2.0 Playground.
- Click the gear icon to open the configuration options and make the following changes:
- Set OAuth flow to Client-side.
- Check Use your own OAuth credentials.
- Paste in your OAuth client ID.
- Close the configuration options.
Under "Step 1 - Select & authorize APIs," paste the following scope for the Google My Business API into the field labeled as Input your own scopes:
- Click Authorize APIs.
- Click Accept when prompted.
Under "Step 2 - Configure request to API," paste the following URI into the Request URI field:
- Click Send the request. The response should show a status of
For more information about how to make various types of requests, see the Google My Business API Reference.
The Google My Business API client libraries wrap the functionality of the Google My Business API. They provide functionality common to all Google APIs, such as HTTP transport, error handling, authentication, and JSON parsing.
To download client libraries, see Samples.