Attention: There will be major changes to the API soon that will require migration work. Please check our upcoming releases page frequently for updates.
v4.9 of the API has released! See change log.

Work with account data

This tutorial shows you how to work with account data. The My Business Account Management API provides you with the ability to do the following:

  • List all accounts.
  • Return a specific account.
  • Update an account.

Before you begin

Before you use the My Business Account Management API, you need to register your application and obtain OAuth 2.0 credentials.

For details on how to get started with the Google My Business API, see Basic setup.

List all accounts

A great way to validate the accounts associated with an authenticated user is to list all their accounts. Use the accounts.list API to list all accounts associated with a user.

To list all the accounts for an authenticated user, use the following:

HTTP
$ GET https://mybusinessaccountmanagement.googleapis.com/v1/accounts

Return a specific account

Sometimes, you only want to see information about a specific account for an authenticated user. Use the accounts.get API to return a specific account and review additional account details.

To return a specific account by name, use the following:

HTTP
$ GET https://mybusinessaccountmanagement.googleapis.com/v1/accounts/{accountId}

Update an account

Changing an account name is a fundamental administrative task. Use the accounts.update API to alter the account name.

To update a specific account by name, use the following:

HTTP
$ PUT https://mybusinessaccountmanagement.googleapis.com/v1/accounts/{accountId}

{
  "account": {
    "accountName": "Anne Droyd"
  },
  "languageCode": "en",
  "validateOnly": "true"
}

Restrictions

  • The only editable field for an account is accountName. Any other fields passed are ignored.
  • Only accounts of BUSINESS type can be updated in this manner.