当前位置: 首页 > Skill >

Google seach console

Google seach console

Google seach console

通过cURL和OAuth访问Google Search Console API,管理网站、站点地图和搜索分析数据(包括点击量、展示量和排名)。

1.0.0 2026.11.27 528
获取Skill文件查看使用说明
作 者:周辰 许可证: 更新时间:2026.11.27
本文目录展开

SKILL.md

Google Search Console (cURL Version)

Access the Google Search Console API with managed OAuth authentication using cURL. Query search analytics, manage sitemaps, and monitor site performance.

Quick Start

List Sites

curl -s 
  -H "Authorization: Bearer $MATON_API_KEY" 
  https://gateway.maton.ai/google-search-console/webmasters/v3/sites | jq

Base URL

https://gateway.maton.ai/google-search-console/{native-api-path}

Replace {native-api-path} with the actual Google Search Console API endpoint path. The gateway proxies requests to www.googleapis.com and automatically injects your OAuth token.

Authentication

All requests require the Maton API key:

-H "Authorization: Bearer $MATON_API_KEY"

Environment Variable

export MATON_API_KEY="YOUR_API_KEY"

Getting Your API Key

  1. Sign in or create an account at https://maton.ai
  2. Go to https://maton.ai/settings
  3. Copy your API key

Connection Management

Manage connections at:

https://ctrl.maton.ai

List Connections

curl -s 
  -H "Authorization: Bearer $MATON_API_KEY" 
  "https://ctrl.maton.ai/connections?app=google-search-console&status=ACTIVE" | jq

Create Connection

curl -s -X POST 
  -H "Authorization: Bearer $MATON_API_KEY" 
  -H "Content-Type: application/json" 
  -d '{"app":"google-search-console"}' 
  https://ctrl.maton.ai/connections | jq

Get Connection

curl -s 
  -H "Authorization: Bearer $MATON_API_KEY" 
  https://ctrl.maton.ai/connections/{connection_id} | jq

Response Example

{
  "connection": {
    "connection_id": "21fd90f9-5935-43cd-b6c8-bde9d915ca80",
    "status": "ACTIVE",
    "creation_time": "2025-12-08T07:20:53.488460Z",
    "last_updated_time": "2026-01-31T20:03:32.593153Z",
    "url": "https://connect.maton.ai/?session_token=...",
    "app": "google-search-console",
    "metadata": {}
  }
}

Open the url in a browser to complete OAuth authorization.

Delete Connection

curl -s -X DELETE 
  -H "Authorization: Bearer $MATON_API_KEY" 
  https://ctrl.maton.ai/connections/{connection_id} | jq

Specifying Connection

If multiple connections exist:

curl -s 
  -H "Authorization: Bearer $MATON_API_KEY" 
  -H "Maton-Connection: 21fd90f9-5935-43cd-b6c8-bde9d915ca80" 
  https://gateway.maton.ai/google-search-console/webmasters/v3/sites | jq

If omitted, the default (oldest active) connection is used.

API Reference

Sites

# List sites
GET /google-search-console/webmasters/v3/sites

# Get a specific site
GET /google-search-console/webmasters/v3/sites/{siteUrl}

⚠️ Site URL must be URL-encoded Example: https%3A%2F%2Fexample.com%2F

Search Analytics

curl -s -X POST 
  -H "Authorization: Bearer $MATON_API_KEY" 
  -H "Content-Type: application/json" 
  https://gateway.maton.ai/google-search-console/webmasters/v3/sites/{siteUrl}/searchAnalytics/query 
  -d '{
    "startDate": "2024-01-01",
    "endDate": "2024-01-31",
    "dimensions": ["query"],
    "rowLimit": 100
  }' | jq

Sitemaps

# List sitemaps
curl -s 
  -H "Authorization: Bearer $MATON_API_KEY" 
  https://gateway.maton.ai/google-search-console/webmasters/v3/sites/{siteUrl}/sitemaps | jq

# Submit sitemap
curl -s -X PUT 
  -H "Authorization: Bearer $MATON_API_KEY" 
  https://gateway.maton.ai/google-search-console/webmasters/v3/sites/{siteUrl}/sitemaps/{feedpath}

# Delete sitemap
curl -s -X DELETE 
  -H "Authorization: Bearer $MATON_API_KEY" 
  https://gateway.maton.ai/google-search-console/webmasters/v3/sites/{siteUrl}/sitemaps/{feedpath}

Search Analytics Examples

Top Queries

{
  "startDate": "2024-01-01",
  "endDate": "2024-01-31",
  "dimensions": ["query"],
  "rowLimit": 25
}

Top Pages

{
  "dimensions": ["page"]
}

Device Breakdown

{
  "dimensions": ["device"]
}

Daily Performance

{
  "dimensions": ["date"]
}

Filtered Query

{
  "dimensionFilterGroups": [{
    "filters": [{
      "dimension": "query",
      "operator": "contains",
      "expression": "keyword"
    }]
  }]
}

Dimensions

  • query – Search query
  • page – Page URL
  • country – Country code
  • device – DESKTOP, MOBILE, TABLET
  • date – Date

Metrics (Auto Returned)

  • clicks
  • impressions
  • ctr
  • position

Notes

  • Site URLs must be URL-encoded
  • Date range limited to 16 months
  • Max 25,000 rows per request
  • Use startRow for pagination
  • Data delay: 2–3 days

Important cURL Notes

  • Use -g if URL contains brackets:
curl -g "https://example.com?fields[]=..."
  • When piping to jq, environment variables may not expand correctly in some shells.

Error Handling

Status Meaning
400 Missing Search Console connection
401 Invalid/missing API key
429 Rate limited (10 req/sec)
4xx/5xx Upstream API error

Troubleshooting API Key

Check variable

echo $MATON_API_KEY

Verify key

curl -s 
  -H "Authorization: Bearer $MATON_API_KEY" 
  https://ctrl.maton.ai/connections | jq

Example: Full Query Flow

SITE_URL=$(python3 -c "import urllib.parse; print(urllib.parse.quote('https://example.com', safe=''))")

curl -s -X POST 
  -H "Authorization: Bearer $MATON_API_KEY" 
  -H "Content-Type: application/json" 
  "https://gateway.maton.ai/google-search-console/webmasters/v3/sites/$SITE_URL/searchAnalytics/query" 
  -d '{
    "startDate": "2024-01-01",
    "endDate": "2024-01-31",
    "dimensions": ["query"],
    "rowLimit": 25
  }' | jq

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,016
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,004
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,002
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,001
PHP集成RabbitMQ实现消息队列的完整步骤

使用 php-amqplib 库,通过建立连接、声明交换机与队列并绑定,即可在 PHP 中实现消息的发送与消费。

2026.05.24 1,001
Apache开启.htaccess及使用方法详解

本文介绍如何在本地Apache环境中启用.htaccess文件,主要涉及修改httpd.conf中的AllowOverride参数。同时详细解析.htaccess的多种实用功能,包括自定义错误页面、目录密码保护、IP访问限制、URL自动转向、默认首页设置以及防止图片盗链等配置方法,并分析了使用.htaccess对服务器性能和安全性的潜在影响。

2026.05.09 1,001
Skill 文件
  • SKILL.md
    • SKILL.md
    • Google Search Console (cURL Version)
    • Quick Start
      • List Sites
    • Base URL
    • Authentication
      • Environment Variable
    • Getting Your API Key
    • Connection Management
      • List Connections
      • Create Connection
      • Get Connection
        • Response Example
      • Delete Connection
    • Specifying Connection
    • API Reference
      • Sites
      • Search Analytics
      • Sitemaps
    • Search Analytics Examples
      • Top Queries
      • Top Pages
      • Device Breakdown
      • Daily Performance
      • Filtered Query
    • Dimensions
    • Metrics (Auto Returned)
    • Notes
    • Important cURL Notes
    • Error Handling
    • Troubleshooting API Key
      • Check variable
      • Verify key
    • Example: Full Query Flow
  • 项目或源文件

相关 Skill

更多
关键词自相残杀检测器 关键词自相残杀检测器 使用Google Search Console API性能数据和Semrush关键词跟踪检测关键词竞争问题。映射URL到关键词重叠情况并建议内容整合策略。
google-search-console google-search-console 当用户想分析 Google Search Console 数据、使用 GSC API 或解读搜索表现时使用。也适用于用户提及“ GSC ”、“ Search Conso...
Google Search Console Google Search Console 查询 Google Search Console 的 SEO 数据,包括搜索查询、热门页面、点击率机会、URL 检查和站点地图。适用于分析搜索表现等场景。
Search Console Report Search Console Report 根据Google Search Console数据生成全面的SEO分析报告,支持PDF导出。适用于用户需要分析搜索表现、获取SEO洞察时使用。
Biz Reporter Biz Reporter 自动化的商业智能报告,汇集 Google Analytics GA4、Google Search Console、Stripe 收入以及社交媒体指标(Twitter/X、LinkedIn 等)数据。