AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

My Business
3K members online now
3K members online now
For developers who are using the Google My Business API to manage locations
Guide Me

Get location list

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

We have associated project in google console and try to get location List of account of google my business api from console but we are unable to get location list of account of  google my business api . We have also submitted approval form to google and We also received approval email. But still when we ran code try to fetch accounts data we get null location list of an account.

We tried from below url.


It is showing below Result.

 we get accountname is null but we get name like accounts/1111111111111111111111 show in below image,


11-11-2016 11-20-10 AM.png


Location list Null show in below image,



If you could please help out with this, that would be great.




1 Expert replyverified_user

Re: Get location list

[ Edited ]
Google Employee
# 2
Google Employee

Hi @Scout50 D,


In your debugger output, I do see the account_name, which is the resource name, in the format accounts/{account_id} such as the following:



Your selected account returned from the GET request to lists all accounts has null as the value for the accountName field because you are most likely building a service account application with the C# client library and have not requested user consent for this Google Account you want to access the Google My Business data from and specify this Google Account as the user to impersonate when you prepare to make authorized API calls using the service account.


If that’s the case, the following are the required steps you should take for the service account application to work with the Google My Business API:

  • You should make sure that you created a service account in your whitelisted project in Google API Console to access the API.
  • You should request user consent at least once for each Google Account you need to access the Google My Business data from. The end users will have to log in with their Google Accounts to manually authorize the application using OAuth 2.0 authorization. They need to perform this process only once with an OAuth 2.0 client ID during OAuth 2.0 installed application flow, OAuth 2.0 web server application flow or via OAuth 2.0 Playground. This process should be performed prior to using the service account application with its public/private key pair credentials and not while running it. You can verify or remove the authorized app from the Apps connected to your account page of each Google Account you requested user consent for.
  • When you prepare to make authorized API calls using the service account to access a particular end user’s Google My Business data, you specify the user to impersonate by specifying the email address of the Google Account that you have previously given user consent for. Please follow the code snippet below to use a service account and specify the user to impersonate with the Google API Client Library for .NET:

         // The scope of Google My Business API

         string MybusinessServiceScope = "";

         String serviceAccountEmail = "";

         var certificate = new X509Certificate2(@"MyProject.p12", "notasecret", X509KeyStorageFlags.Exportable);

         ServiceAccountCredential credential = new ServiceAccountCredential(

            new ServiceAccountCredential.Initializer(serviceAccountEmail)


                Scopes = new[] { MybusinessServiceScope },

                User = ""


         // Creates the service.

         var service = new MybusinessService(new BaseClientService.Initializer()


             HttpClientInitializer = credential,

             ApplicationName = "Google My Business API Sample",



You should be able to get the service account application to work after you’ve performed the above steps. Please let me know if you have further questions.