0

debug($sitemaps->listSitemaps("http://example.com", ['contents'=> 'indexed']));

return

object(Google_Service_Webmasters_SitemapsListResponse) {
    [protected] collection_key => 'sitemap'
    [protected] internal_gapi_mappings => array()
    [protected] sitemapType => 'Google_Service_Webmasters_WmxSitemap'
    [protected] sitemapDataType => 'array'
    [protected] modelData => array(
        'sitemap' => array(
            (int) 0 => array(
                'path' => 'http://example.com/sitemap.xml',
                'lastSubmitted' => '2017-12-31T17:06:56.592Z',
                'isPending' => false,
                'isSitemapsIndex' => false,
                'type' => 'sitemap',
                'lastDownloaded' => '2018-01-03T11:42:39.262Z',
                'warnings' => '0',
                'errors' => '0',
                'contents' => array(
                    (int) 0 => array(
                        'type' => 'web',
                        'submitted' => '4',
                        'indexed' => '0'
                    )
                )
            )
        )
    )
    [protected] processed => array()
}

modeldata should return an array of data with dates and indexing values

1 Answers1

0

I fear it's not part of the Search Console API as of yet. There's this post on the Google Product Forum as well: https://productforums.google.com/forum/?hl=en#!topic/webmasters/KIUsaXpquKY;context-place=topicsearchin/webmasters/category$3Awebmaster-tools%7Csort:relevance%7Cspell:false

I haven't seen any changes since then, so I wouldn't hold my breath if I were you.

The closest you can get to some number from the API, indicating the amount of pages indexed by Google, is by summing all the contents[].indexed of all the sitemaps and/or sitemap indexes that you have submitted. Probably you only submitted one sitemap index that references all sitemaps, so if you request that one using Sitemaps:get (https://developers.google.com/webmaster-tools/search-console-api-original/v3/sitemaps/get) you get the total of pages indexed.

But that number is poorly correlated to the actual Index status, that you can find in the Search Console UI, in ways that I don't properly understand.

I would think that if you have a sitemap.xml that contains every page of your website, the sum of contents[].indexed would be closely math the total number of pages indexed. That doesn't seem to be the case.

gijswijs
  • 1,958
  • 19
  • 24