微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🛒

Google 购物广告一站式管理

google-merchant · vv1.0.5
效率 安全 A 级 作者 byungkyu 公开目录收录
下载 1.3k 安装 535 收藏 3.3k 浏览 11.8k
原始页面

简介

基于 Maton 网关的 Google Merchant Center API 集成方案,支持商品目录、库存、促销及数据报表管理,为电商运营提供一站式 Google Shopping 管理能力。

原始描述

Google Merchant Center API integration with managed OAuth. Manage products, inventories, data sources, promotions, and reports for Google Shopping. Use this...

中文使用说明 来自收录源

核心用法

Google Merchant Center Skill 是一个纯文档型 API 集成技能,通过 Maton 托管的 OAuth 网关代理访问 Google Merchant Center API。用户需先在 maton.ai 获取 API 密钥,完成 OAuth 授权后,即可通过统一的 RESTful 接口管理商品目录、库存、数据源、促销活动和业务报表。

该技能采用模块化子 API 架构,涵盖 products(商品管理)、inventories(库存管理)、datasources(数据源配置)、reports(数据分析)、promotions(促销活动)、accounts(账户设置)等九大核心模块。所有请求通过 https://gateway.maton.ai/google-merchant/{sub-api}/{version}/accounts/{accountId}/{resource}} 统一入口访问,Maton 网关自动注入 OAuth 令牌完成身份验证。

显著优点

托管式 OAuth 简化集成:用户无需自行处理复杂的 Google OAuth 2.0 流程,Maton 提供完整的连接生命周期管理(创建、查询、删除),大幅降低开发门槛。

模块化 API 设计:九大子 API 覆盖电商运营全场景,从商品上架、库存同步到促销配置、数据洞察,形成完整闭环。

标准化数据查询:Reports 模块支持类 SQL 的查询语法,可直接获取商品表现、价格竞争力、畅销品分析等关键指标,便于商业决策。

多语言示例完备:提供 Python、JavaScript、Bash 等语言的完整代码示例,开发者可快速上手集成。

潜在缺点与局限性

外部服务依赖:核心功能完全依赖 Maton API 网关的可用性,若网关服务中断或策略变更,将直接影响业务连续性。

数据延迟问题:文档明确说明商品插入/更新后需数分钟才能在处理后的商品列表中显示,不适合需要实时库存同步的高频交易场景。

版本碎片化:部分功能(如 LFP 本地履约合作)仍处于 v1beta 阶段,稳定性与 v1 正式版存在差异,且 GCP 项目注册要求可能增加配置复杂度。

货币精度限制:采用微单位(micros)存储金额,需额外转换处理,增加开发心智负担。

适合的目标群体

  • 跨境电商运营团队:需要批量管理 Google Shopping 商品目录、同步多地区库存的商家
  • 独立站开发者:为 Shopify/WooCommerce 等自建站搭建 Google 购物广告自动同步管道
  • 电商 SaaS 产品经理:构建多平台商品中台,需集成 Google Merchant Center 作为销售渠道
  • 数据分析师:需要程序化获取商品表现报表,进行价格竞争力分析和竞品监控

使用风险

密钥泄露风险:MATON_API_KEY 是访问所有功能的唯一凭证,若硬编码或日志泄露,可能导致账户数据被恶意访问。建议配合密钥管理服务(如 AWS Secrets Manager、HashiCorp Vault)使用。

权限边界模糊:OAuth 授权后,Maton 网关持有用户 Google Merchant Center 的完整操作权限,用户无法细粒度限制子 API 访问范围,存在过度授权隐患。

数据合规考量:商品数据、销售报表流经 Maton 第三方服务器,涉及商业敏感信息,需评估是否符合企业数据出境及第三方处理合规要求。

速率限制与配额:依赖 Google Merchant API 底层配额,高频操作可能触发 429 限流,大规模商品同步需设计合理的重试与退避策略。

技能正文


name: google-merchant description: | Google Merchant Center API integration with managed OAuth. Manage products, inventories, data sources, promotions, and reports for Google Shopping. Use this skill when users want to manage their Merchant Center product catalog, check product status, configure data sources, or analyze shopping performance. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key. metadata: author: maton version: "1.0" clawdbot: emoji: 🧠 requires: env: - MATON_API_KEY

Google Merchant Center

Access the Google Merchant Center API with managed OAuth authentication. Manage products, inventories, promotions, data sources, and reports for Google Shopping.

Quick Start

# List products in your Merchant Center account
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/google-merchant/products/v1/accounts/{accountId}/products')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Base URL

https://gateway.maton.ai/google-merchant/{sub-api}/{version}/accounts/{accountId}/{resource}

The Merchant API uses a modular sub-API structure. Replace:

  • {sub-api} with the service: products, accounts, datasources, reports, promotions, inventories, notifications, conversions, lfp
  • {version} with v1 (stable) or v1beta
  • {accountId} with your Merchant Center account ID

The gateway proxies requests to merchantapi.googleapis.com and automatically injects your OAuth token.

Authentication

All requests require the Maton API key in the Authorization header:

Authorization: Bearer $MATON_API_KEY

Environment Variable: Set your API key as MATON_API_KEY:

export MATON_API_KEY="YOUR_API_KEY"

Getting Your API Key

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

Finding Your Merchant Center Account ID

Your Merchant Center account ID is a numeric identifier visible in the Merchant Center UI URL or account settings. It's required for all API calls.

Connection Management

Manage your Google Merchant OAuth connections at https://ctrl.maton.ai.

List Connections

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=google-merchant&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Create Connection

python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'google-merchant'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Get Connection

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Response:

{
  "connection": {
    "connection_id": "00726960-095e-47e2-92e6-6e9cdf3e40a1",
    "status": "ACTIVE",
    "creation_time": "2026-02-07T06:41:22.751289Z",
    "last_updated_time": "2026-02-07T06:42:29.411979Z",
    "url": "https://connect.maton.ai/?session_token=...",
    "app": "google-merchant",
    "metadata": {}
  }
}

Open the returned url in a browser to complete OAuth authorization.

Delete Connection

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Specifying Connection

If you have multiple Google Merchant connections, specify which one to use with the Maton-Connection header:

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/google-merchant/products/v1/accounts/123456/products')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '00726960-095e-47e2-92e6-6e9cdf3e40a1')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

If omitted, the gateway uses the default (oldest) active connection.

API Reference

Sub-API Structure

The Merchant API is organized into sub-APIs, each with its own version:

Sub-API Purpose Stable Version
products Product catalog management v1
accounts Account settings and users v1
datasources Data source configuration v1
reports Analytics and reporting v1
promotions Promotional offers v1
inventories Local and regional inventory v1
notifications Webhook subscriptions v1
conversions Conversion tracking v1
lfp Local Fulfillment Partnership v1beta

Products

List Products

GET /google-merchant/products/v1/accounts/{accountId}/products

Query parameters:

  • pageSize (integer): Maximum results per page
  • pageToken (string): Pagination token

Get Product

GET /google-merchant/products/v1/accounts/{accountId}/products/{productId}

Product ID format: contentLanguage~feedLabel~offerId (e.g., en~US~sku123)

Insert Product Input

POST /google-merchant/products/v1/accounts/{accountId}/productInputs:insert?dataSource=accounts/{accountId}/dataSources/{dataSourceId}
Content-Type: application/json

{
  "offerId": "sku123",
  "contentLanguage": "en",
  "feedLabel": "US",
  "attributes": {
    "title": "Product Title",
    "description": "Product description",
    "link": "https://example.com/product",
    "imageLink": "https://example.com/image.jpg",
    "availability": "in_stock",
    "price": {
      "amountMicros": "19990000",
      "currencyCode": "USD"
    },
    "condition": "new"
  }
}

Delete Product Input

DELETE /google-merchant/products/v1/accounts/{accountId}/productInputs/{productId}?dataSource=accounts/{accountId}/dataSources/{dataSourceId}

Inventories

List Local Inventories

GET /google-merchant/inventories/v1/accounts/{accountId}/products/{productId}/localInventories

Insert Local Inventory

POST /google-merchant/inventories/v1/accounts/{accountId}/products/{productId}/localInventories:insert
Content-Type: application/json

{
  "storeCode": "store123",
  "availability": "in_stock",
  "quantity": 10,
  "price": {
    "amountMicros": "19990000",
    "currencyCode": "USD"
  }
}

List Regional Inventories

GET /google-merchant/inventories/v1/accounts/{accountId}/products/{productId}/regionalInventories

Data Sources

List Data Sources

GET /google-merchant/datasources/v1/accounts/{accountId}/dataSources

Get Data Source

GET /google-merchant/datasources/v1/accounts/{accountId}/dataSources/{dataSourceId}

Create Data Source

POST /google-merchant/datasources/v1/accounts/{accountId}/dataSources
Content-Type: application/json

{
  "displayName": "API Data Source",
  "primaryProductDataSource": {
    "channel": "ONLINE_PRODUCTS",
    "feedLabel": "US",
    "contentLanguage": "en"
  }
}

Fetch Data Source (trigger immediate refresh)

POST /google-merchant/datasources/v1/accounts/{accountId}/dataSources/{dataSourceId}:fetch

Reports

Search Reports

POST /google-merchant/reports/v1/accounts/{accountId}/reports:search
Content-Type: application/json

{
  "query": "SELECT offer_id, title, clicks, impressions FROM product_performance_view WHERE date BETWEEN '2026-01-01' AND '2026-01-31'"
}

Available report tables:

  • product_performance_view - Clicks, impressions, CTR by product
  • product_view - Current inventory with attributes and issues
  • price_competitiveness_product_view - Pricing vs competitors
  • price_insights_product_view - Suggested pricing
  • best_sellers_product_cluster_view - Best sellers by category
  • competitive_visibility_competitor_view - Competitor visibility

Promotions

List Promotions

GET /google-merchant/promotions/v1/accounts/{accountId}/promotions

Get Promotion

GET /google-merchant/promotions/v1/accounts/{accountId}/promotions/{promotionId}

Insert Promotion

POST /google-merchant/promotions/v1/accounts/{accountId}/promotions:insert
Content-Type: application/json

{
  "promotionId": "promo123",
  "contentLanguage": "en",
  "targetCountry": "US",
  "redemptionChannel": ["ONLINE"],
  "attributes": {
    "longTitle": "20% off all products",
    "promotionEffectiveDates": "2026-02-01T00:00:00Z/2026-02-28T23:59:59Z"
  }
}

Accounts

Get Account

GET /google-merchant/accounts/v1/accounts/{accountId}

List Sub-accounts

GET /google-merchant/accounts/v1/accounts/{accountId}:listSubaccounts

Get Business Info

GET /google-merchant/accounts/v1/accounts/{accountId}/businessInfo

Get Shipping Settings

GET /google-merchant/accounts/v1/accounts/{accountId}/shippingSettings

List Users

GET /google-merchant/accounts/v1/accounts/{accountId}/users

List Programs

GET /google-merchant/accounts/v1/accounts/{accountId}/programs

List Regions

GET /google-merchant/accounts/v1/accounts/{accountId}/regions

List Online Return Policies

GET /google-merchant/accounts/v1/accounts/{accountId}/onlineReturnPolicies

Notifications

List Notification Subscriptions

GET /google-merchant/notifications/v1/accounts/{accountId}/notificationsubscriptions

Create Notification Subscription

POST /google-merchant/notifications/v1/accounts/{accountId}/notificationsubscriptions
Content-Type: application/json

{
  "registeredEvent": "PRODUCT_STATUS_CHANGE",
  "callBackUri": "https://example.com/webhook"
}

Conversion Sources

List Conversion Sources

GET /google-merchant/conversions/v1/accounts/{accountId}/conversionSources

Pagination

The API uses token-based pagination:

GET /google-merchant/products/v1/accounts/{accountId}/products?pageSize=50

Response includes nextPageToken when more results exist:

{
  "products": [...],
  "nextPageToken": "CAE..."
}

Use the token for the next page:

GET /google-merchant/products/v1/accounts/{accountId}/products?pageSize=50&pageToken=CAE...

Code Examples

JavaScript

const accountId = '123456789';
const response = await fetch(
  `https://gateway.maton.ai/google-merchant/products/v1/accounts/${accountId}/products`,
  {
    headers: {
      'Authorization': `Bearer ${process.env.MATON_API_KEY}`
    }
  }
);
const data = await response.json();

Python

import os
import requests

account_id = '123456789'
response = requests.get(
    f'https://gateway.maton.ai/google-merchant/products/v1/accounts/{account_id}/products',
    headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
)
data = response.json()

Notes

  • Product IDs use the format contentLanguage~feedLabel~offerId (e.g., en~US~sku123)
  • Products can only be inserted/updated/deleted in data sources of type API
  • After inserting/updating a product, it may take several minutes before the processed product appears
  • Monetary values use micros (divide by 1,000,000 for actual value)
  • The API uses sub-API versioning - prefer v1 stable over v1beta
  • IMPORTANT: When using curl commands, use curl -g when URLs contain brackets to disable glob parsing
  • IMPORTANT: When piping curl output to jq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments

Error Handling

Status Meaning
400 Missing Google Merchant connection
401 Invalid or missing Maton API key, or no access to specified account
403 Permission denied for the requested operation
404 Resource not found
429 Rate limited
4xx/5xx Passthrough error from Google Merchant API

Common Errors

"The caller does not have access to the accounts": The specified account ID is not accessible with your OAuth credentials. Verify you have access to the Merchant Center account.

"GCP project is not registered": The v1 stable API requires GCP project registration. Use v1beta or register your project.

Troubleshooting: API Key Issues

  1. Check that the MATON_API_KEY environment variable is set:
echo $MATON_API_KEY
  1. Verify the API key is valid by listing connections:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Troubleshooting: Invalid App Name

  1. Ensure your URL path starts with google-merchant. For example:
  • Correct: https://gateway.maton.ai/google-merchant/products/v1/accounts/{accountId}/products
  • Incorrect: https://gateway.maton.ai/products/v1/accounts/{accountId}/products

Resources

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

apie-commercemarketingdata-analyticsautomationproduct-managementbackend

同类 Skill