google search console api - response error for the search types discover and googleNews

Viewed 137

We are trying to get data from the google search console API with dimension types - web, discover, googleNews, news, image, video. They are all listed in the google API documentation here

But we are getting a successful response from google API only for search types 'web', 'image', and 'news', please see it below

Request URL: https://www.googleapis.com/webmasters/v3/sites/sc-domain%3Amydomain.com/searchAnalytics/query?fields=responseAggregationType%2Crows



Request:
    {
      "startDate": "2022-06-05",
      "endDate": "2022-06-22",
      "dimensions": ["query","page","country"],
      "type": "web",
      "dataState": "all",
      "aggregationType": "byPage",
      "rowLimit": 5000,
      "startRow": 0
    }
 
Response:
    Queries Count: 239752

========================================================================================

Request:
{
  "startDate": "2022-06-05",
  "endDate": "2022-06-22",
  "dimensions": ["query","page","country"],
  "type": "image",
  "dataState": "all",
  "aggregationType": "byPage",
  "rowLimit": 5000,
  "startRow": 0
}
Response:
Queries Count: 1827

====================================================================================

Request:
    {
      "startDate": "2022-06-05",
      "endDate": "2022-06-22",
      "dimensions": ["query","page","country"],
      "type": "web",
      "dimensionFilterGroups": [
        {
          "groupType": "and",
          "filters": [
            {
              "dimension": "country",
              "operator": "contains",
              "expression": "GBR"
            }
          ]
        }
      ],
      "dataState": "all",
      "aggregationType": "byPage",
      "rowLimit": 5000,
      "startRow": 0
    }
    Response:
    Queries Count: 9073

When we are making the same request with the search type 'discover' or 'googleNews' we are getting an error in the response as below

Request:
{
  "startDate": "2022-06-05",
  "endDate": "2022-06-22",
  "dimensions": ["query","page","country"],
  "type": "discover",
  "dataState": "all",
  "aggregationType": "byPage",
  "rowLimit": 5000,
  "startRow": 0
}
Response:
{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "errors": [
      {
        "message": "Request contains an invalid argument.",
        "domain": "global",
        "reason": "badRequest"
      }
    ],
    "status": "INVALID_ARGUMENT"
  }
}

We also have tried to make the API request for the full URL without sc-domain parameter as one below

https://www.googleapis.com/webmasters/v3/sites/https%3A%2F%2Fwww.mydomain.com/searchAnalytics/query?fields=responseAggregationType%2Crows

But still, we are getting the same errors.

My question is - what is wrong with our requests and how to get data from the google search console API for the search types 'discover' and 'googleNews'? And is there any way to get more informative error messages from google search console API responses, that will provide a bit more explanation about the reason for the error occurred?

0 Answers
Related