Search code examples
google-my-business-apigoogle-my-businessgoogle-business-profile-api

Why locations.getGoogleUpdated API respond is always 404


I am trying to read what has changed in my location while I have received GOOGLE_UPDATE notification from Google Business Profile API. The documentation is found here: locations.getGoogleUpdated

The result in playground is shown in the photo:  Google Playground

The result is the same in Java:

String locationId="locations/"+rec.locationName.split("locations/")[1];
            String url="https://mybusinessbusinessinformation.googleapis.com/v1/locations/"+locationId +":googleUpdated";
            HttpRequest request = HttpRequest.newBuilder()
                    .uri(URI.create(url))
                    .GET()
                    .header("Authorization", "Bearer " + accessToken)
                    .build();
            
            HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
            System.out.println(" statusCode "+ response.statusCode());
            

And the response for all the Google_Update notifications is statusCode 404

What is wrong in my code or request?


Solution

  • I was using the old API, the correct one is [Method: locations.getGoogleUpdated][1]

    so the URL would be

    GET https://mybusinessbusinessinformation.googleapis.com/v1/{name=locations/*}:getGoogleUpdated
    

    and the readMask needs to be set