Google My Business API Minimum Viable Product Demo
- This demonstration illustrates how to
- perform OAuth 2.0 authorization to access the Google My Business API
- fetch categories and attributes for individual regions and languages.
- list the available Accounts
- list the Locations within an account
- create a Location in the specified Account and Location Group
- verify the Location and transfer ownership of the new Location to the merchant.
Note this code should not be used in production as the OAuth credentials are directly exposed and transmitted to the user's browser.
Please confirm your API credentials and successful OAuth authorization.
OAuth Consent
Trigger one-time OAuth consent, obtain a Refresh token and use
it to fetch an Access token used in calls to API methods as described
by Using OAuth 2.0 to Access Google APIs
Categories
Attributes
Available attributes vary by category, country and language.
The categoryId value can be found in the categoryId field of a
Get Categories response.
Accounts
Account Admins and Locations
These commands operate on an individual account name.
The name value can be found in the locations.name field of
a Get Accounts response.
Locations
The Google Location Search method criteria may be specified using a query string or a location object. When searching with a candidate Location object the locationName and optional postalAddress, websiteUrl, primaryPhone fields may be used.
New Locations may be created under the account specified in the
name field in the Account Admins and Locations section.
Unknown addresses may require latitude and longitude to be entered. This example uses a ficticious address and failing to specify LatLng will result in an error response. Google will automatically match the Postal Address to known LatLng values if available. Unless prompted, LatLng should be left blank by default.
The business type may be physical storefront, service area, or a hybrid of both types.
For businesses which include a service area a Google Maps regions type is included to define the boundary.
Specifying a service area region or dropping a pin to geocode may be performed using the Google Maps Autocomplete Widget as seen here:
Unknown addresses may require latitude and longitude to be entered. This example uses a ficticious address and failing to specify LatLng will result in an error response. Google will automatically match the Postal Address to known LatLng values if available. Unless prompted, LatLng should be left blank by default.
The business type may be physical storefront, service area, or a hybrid of both types.
For businesses which include a service area a Google Maps regions type is included to define the boundary.
Specifying a service area region or dropping a pin to geocode may be performed using the Google Maps Autocomplete Widget as seen here:
Place ID:
Lat/Lng:
Address:
API Request
API Response