google-api-python-client: googleapiclient.errors.UnknownApiNameOrVersion: name: webmasters version: v3

OS macOS: 10.15.4 Python version: python 3.8.1 pip version: pip 19.0.3 google-api-python-client version: 1.12.1

Code example from googleapiclient.discovery import build build(‘webmasters’, “v3”, developerKey=“developer_key”) Stack trace googleapiclient.errors.UnknownApiNameOrVersion: name: webmasters version: v3

Hi Team,

While trying to get data from Search Console API and get this error UnknownApiNameOrVersion. I tried the discovery API and it showed the the discoveryRestUrl as https://www.googleapis.com/discovery/v1/apis/webmasters/v3/rest image But, the same url on web is down: image Please rectify immediately. All our reports are breaking.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 9
  • Comments: 26

Most upvoted comments

Google said here already https://webmasters.googleblog.com/2020/08/search-console-api-announcements.html that they would change the API. However, they have set the date as 31 Dec.

“If you’re querying the Search Console API using an external API library, or querying the Webmasters API discovery document directly you will need to take action as we’ll drop the support in the Webmasters discovery document. Our current plan is to support it until December 31, 2020 - but we’ll provide more details and guidance in the coming months.”

So, I’m not really seeing, from this article which actions are actually required, but updating the build step to use discovery.build('searchconsole', 'v1') instead of the old discovery.build('webmasters', 'v3') resolved the issue for me, and also seems to be actually using the old webmasters/v3 endpoint with the rest document:

https://www.googleapis.com/discovery/v1/apis/searchconsole/v1/rest

    "sites": {
      "methods": {
        "list": {
          "scopes": [
            "https://www.googleapis.com/auth/webmasters",
            "https://www.googleapis.com/auth/webmasters.readonly"
          ],
          "id": "webmasters.sites.list",
          "parameterOrder": [],
          "path": "webmasters/v3/sites",
          "description": " Lists the user's Search Console sites.",
          "httpMethod": "GET",
          "flatPath": "webmasters/v3/sites",
          "response": {
            "$ref": "SitesListResponse"
          },
          "parameters": {}
        },

working off of that assumption now at least.

both webmasters/v3 and searchconsole/v1 are working now. Seems better to shift to searchconsole/v1 for future consistency. Closing this now.

Google said here already https://webmasters.googleblog.com/2020/08/search-console-api-announcements.html that they would change the API. However, they have set the date as 31 Dec.

“If you’re querying the Search Console API using an external API library, or querying the Webmasters API discovery document directly you will need to take action as we’ll drop the support in the Webmasters discovery document. Our current plan is to support it until December 31, 2020 - but we’ll provide more details and guidance in the coming months.”

It seems that discovery.build('searchconsole', 'v1') is working. Can somebody verify that? According to the documentation this is only the beta endpoint for the url testing tool https://developers.google.com/webmaster-tools/search-console-api/reference/rest

I just tried that and it seems to work, but not sure if this is the one to use

a very unscientific test involving https://proxy-ams.hidemyass-freeproxy.com/ showed the following http responses based on different locations (right now)

NY: 404 seattle: 200 frankfurt: 200 amsterdam: 404 praque: 200

edit hi @paddie 🤗

edit 2

“maybe if we try again and again the 404/200 is actually morse code from a sys-admin locked in a closet somewhere lulz” … some speculation in a 🧵 somewhere :trollface:

We are seeing the same issue, since 2 in the morning and as recent as 10 minutes ago, from europe-west1