Search code examples
google-my-business-api

Google My Business Requested entity was not found


I'm trying to implement an integration between a ERP system and Google My Business to keep store data in sync.

I have a project in the developer console. I have gained access to the GMB API and is approved by Google to use this API.

I'm using a serviceaccount and have followed the instructions from various guides.

But now I'm stuck.

I'm using the google GMB c# library to connect to GMB. I have a valid .12 file for my service account.

string MybusinessServiceScope = "https://www.googleapis.com/auth/plus.business.manage";
        String serviceAccountEmail = "[email protected]";

        var certificate = new X509Certificate2(_serviceP12File, "notasecret", X509KeyStorageFlags.Exportable);

        ServiceAccountCredential credential = new ServiceAccountCredential(
               new ServiceAccountCredential.Initializer(serviceAccountEmail)
               {
                   Scopes = new[] { MybusinessServiceScope },
               }.FromCertificate(certificate));

        return new MybusinessService(new BaseClientService.Initializer()
           {
               HttpClientInitializer = credential,
               ApplicationName = "myapplication-1349",
           });

When I try to List, Patch or Create locations I keep getting the same response:

Requested entity was not found. [404]

Errors [

Message[Requested entity was not found.] Location[ - ] Reason[notFound] Domain[global]

]

Any help is appreciated


Solution

  • I was unable to make this work with a service account. After talking to google support on the matter I change to use the OAuth application flow instead.

    This works.

    My chat with google: https://www.en.advertisercommunity.com/t5/Google-My-Business-API/Unable-to-PATCH-location-with-v3/td-p/579536#

    Hope this can help others