几个月前,Google 宣布升级 API 基础架构,以随着需求的增长提高 Search Console API 的性能。今天,Google 宣布对 API 进行更多更新,包括在 Search Console API 中添加新数据和新闻过滤器,以及在 Sitemaps API 中支持域属性。
绩效报告已经支持不到一天的新数据。现在可以通过 API 访问此数据,方法是传递请求参数“dataState”,并将值设置为“all”。您为此值获得的数据还将包括尚未最终确定的新数据。如果您希望仅获取最终数据,您可以传递此参数并将值设置为 final
或根本不传递它,默认情况下您将仅获得最终数据。
有关这些更改的更多信息,请查看 Google 的博文 此处。
几个月前,谷歌在搜索过滤器的性能报告中添加了一个新闻标签。该信息现在也可以在 API 中使用,您可以通过将请求中的 searchType
参数的值设置为 news
来访问它。
与其他 Search Console API 一样,Sitemaps API 现在支持域属性。您可以在 域属性 上查询、添加和删除您的站点地图,例如:
GET https://www.googleapis.com/webmasters/v3/sites/sc-domain:example.com/sitemaps
我们将放弃网站管理员发现文档中的支持。如果您使用 外部 API 库 查询 Search Console API,或查询 [Webmasters API 发现文档] (https://www.googleapis.com/discovery/v1/apis/webmasters/v3/rest){rel="nofollow"},您需要更新您的 API 调用以包含以下更改。
Google Search Console API 最近已更新,使用该 API 的开发人员需要对其代码进行一些更改以保持兼容性。
对于 Java 用户,所有与 Webmasters 服务相关的导入都应更改为使用 searchconsole.v1
包而不是 webmasters
包。此外,服务名称“Webmasters”应更改为“SearchConsole”。您可以在 Java 快速入门指南中找到更详细的说明{rel="nofollow" }。
对于 Python 用户,在构建 Webmasters 服务对象时,您需要使用 googleapiclient.discovery
模块中的 build()
函数,而不是 googleapiclient.discovery_cache
模块中的 webmasters()
函数。您可以在 Python 快速入门指南中找到更详细的说明{rel="nofollow" }。
Google 已宣布对 Webmasters API 的发现文档查询进行更改。 URL 已从 https://www.googleapis.com/discovery/v1/apis/webmasters/v3/rest 更改为 https://searchconsole.googleapis.com/$discovery/rest,并且 name
和 version
字段都已相应更改。
如果您有任何问题,可以在 Search Central 社区 或 [on Twitter](https://twitter. com/googlesearchc){rel="nofollow"}。