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

Missing locations in bussiness account

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

Hello!

 

I have verified business account. I created project and service account at console.developers.google.com. I developed application for automatically upload locations. Application uses service account to authorize. I uploaded several locations without errors, but bussiness account can't see them. Which way should I upload locations to manage them with business account? 

 

To create location I'am using code:

 

createOperation = getMybusiness().accounts().locations().create(accountName, location);
createOperation.setValidateOnly(validateOnly);
createOperation.setRequestId(UUID.randomUUID().toString());
createOperation.setLanguageCode("ru-RU");
createdLocation = createOperation.execute();

 

1 Expert replyverified_user

Re: Missing locations in bussiness account

Google Employee
# 2
Google Employee

Hi @Юрий Г,

 

The code you provided for creating a location looks correct. It seems like, you created your locations in your personal account and trying to access them through the business account. You can transfer ownership of locations from your personal account to a business account through the UI or through the API as long as you are an owner of the account the location is currently associated with and at least a manager of the destination account.

 

Thanks,

The Google My Business API team

Missing locations in bussiness account

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi, Shalini S,

 

Thank you for your answer. My application functionality includes patch and delete locations also according to our data in DB. Will be possible to do this operations automatically with service account in my application after transfering ownership of locations to business account? 

Re: Missing locations in bussiness account

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Hi, @Shalini S,

 

I have problem transferring location. Please help me to understand the reason.

My code:

 

Location newLoc = getMybusiness().accounts().locations().transfer(
"accounts/<service_account_id>/locations/<location_id>",
new TransferLocationRequest().setToAccount("accounts/<business_account_id>")
).execute();

 Response:

500 Internal Server Error
{
  "code" : 500,
  "errors" : [ {
    "domain" : "global",
    "message" : "Internal error encountered.",
    "reason" : "backendError"
  } ],
  "message" : "Internal error encountered.",
  "status" : "INTERNAL"
}

Re: Missing locations in bussiness account

Google Employee
# 5
Google Employee

Hi @Юрий Г,

 

To perform a transfer, you must be an owner of the account the location is currently associated with and at least a manager of the destination account. A service account's generated email address is not equivalent to a Google Account’s email address. You can't sign in with your service account's email address to access the Google My Business UI. Therefore, the locations you created in your service account are not accessible via the UI and can’t be verified. You also can’t add a service account's email address as an admin to a business account or location because when you invite someone to become an admin for an account or location, the invitee's email address should be associated with a Google Account in order to accept the invitation and become an admin.

 

For using a service account to access the Google My Business account and location data on behalf of a particular end user, you should request user consent for that end user’s Google Account only once. You can perform this process during the OAuth 2.0 installed application flow or using OAuth 2.0 Playground. When you prepare to make authorized API calls using the service account, you specify the user to impersonate by specifying the email address of the user’s Google Account for access to their Google My Business data.

 

Thanks,

The Google My Business API team

Missing locations in bussiness account

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

Hi, @Shalini S,

 

Now the browser with authorizationUrl opens during the authorization with OAuth2 or authorizationUrl is written to the console. Tell me, is there a possibility to authorization only with the server side, without user intervention? (The first authorization of the user through the browser.)

 

Re: Missing locations in bussiness account

Google Employee
# 7
Google Employee

Hi @Юрий Г

 

No, since you are building a service account application, you have to request user consent involving human interaction for each Google Account that you need to access the Google My Business data from and manually authorize your app during OAuth 2.0 flow at least once prior to authenticating with the public/private key pair. You can request user consent using OAuth 2.0 installed applications flow, OAuth 2.0 web server applications flow or via OAuth 2.0 Playground. However, you don’t have to save your retrieved refresh tokens for a service account application. Instead, you specify the user to impersonate by specifying the email address of the user account for access to their Google My Business data when you prepare to make authorized API calls. This is because a service account is an account that belongs to your application instead of an individual end user with a Google Account.

 

Please check out this Accepted Solution for requesting user consent for a service account application.

 

Thanks,

Shalini, Google My Business API team