Search code examples
pythongoogle-my-business-api

Googly MyBusiness API discovery URL not working


I have a Python piece of code that was working with Google MyBusiness API up until several weeks ago (October 2021):

discovery_url = 'https://developers.google.com/my-business/samples/mybusiness_google_rest_v4p5.json'

service = build(
    'mybusiness', 
    'v4', 
    credentials=credentials, 
    discoveryServiceUrl=discovery_url
)

Now the same piece of code produces the following error:

googleapiclient.errors.UnknownApiNameOrVersion: name: mybusiness  version: v4

Based on their documentation, my discoveryServiceUrl should be:

discovery_url = 'https://developers.google.com/my-business/reference/rest'

service = build(
    'mybusiness', 
    'v4', 
    credentials=credentials, 
    discoveryServiceUrl=discovery_url
)

When I make that change, I get another error:

googleapiclient.errors.HttpError: <HttpError 403 when requesting https://mybusiness.googleapis.com/$discovery/rest?version=v4 returned "The request is missing a valid API key.". Details: "The request is missing a valid API key.">

I have no idea what API key I should supply in the discovery URL?


Solution

  • The API you are using has been expired. you can use the new APIs like Account Management API , My Business Business Information API. The documentation link for example for the latter is My Business Business Information API