借助 AdMob API,您可以查看中介广告来源
以编程方式请参阅
accounts.adSources.list
,了解更多信息。
使用 Curl 发出请求
加载客户端密钥文件并生成授权 凭据。
首次执行此步骤时,系统会提示您接受 授权提示。在接受之前,请确保您已 使用有权访问 AdMob API 的 Google 账号登录。您的 应用获得授权后,才能代表哪个账号访问数据 目前已登录。
对于身份验证和授权,我们建议使用 oauth2l,一种用于 与 Google OAuth 2.0 搭配使用安装 oauth2l 并运行 命令,将 path_to_credentials_json 替换为路径 保存到您的
credentials.json
文件中。 云应用首次运行时,此命令将引导您逐步完成 OAuth 2.0 授权流程。后续运行会刷新令牌 。oauth2l header --json path_to_credentials_json --scope admob.readonly
列出广告来源。
替换 pub-XXXXXXXXXXXXXXXX,获取 AdMob 广告来源信息 替换为您的发布商 ID。请参阅 说明,了解如何查找 您的发布商 ID
curl --http1.0 -X GET https://admob.googleapis.com/v1beta/accounts/pub-XXXXXXXXXXXXXXXX/adSources \ -H "$(oauth2l header --json path_to_credentials_json --scope admob.readonly)"
示例响应:
{ "adSources": [ { "name": "accounts/pub-XXXXXXXXXXXXXXXX/adSources/5450213213286189855", "adSourceId": "5450213213286189855", "title": "AdMob Network", } ] }