廣告來源

AdMob API 可讓您查看中介服務廣告來源 編寫程式詳情請見 accounts.adSources.list敬上 。

透過 Curl 要求

  1. 載入用戶端密鑰檔案並產生授權 憑證

    系統會在您第一次執行這個步驟時,要求您接受 在瀏覽器中輸入授權提示接受前,請務必確認 使用可存取 AdMob API 的 Google 帳戶登入。您的 應用程式將有權代表 目前登入的帳戶

    如要進行驗證和授權,建議您使用 oauth2l 是簡便的指令列工具 才能使用 Google OAuth 2.0安裝 OAuth2l 並執行 指令,將 path_to_credentials_json 換成路徑 連結至您在註冊 SDK 時下載的 credentials.json 檔案 雲端應用程式。第一次執行時,指令會引導您逐步完成 OAuth 2.0 授權流程。之後執行時重新整理權杖 。

    oauth2l header --json path_to_credentials_json --scope admob.readonly
    
  2. 列出廣告來源。

    替換 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",
       }
     ]
    }