Adapters

The AdMob API has the ability to list mediation adapters programmatically, see accounts.adSources.adapters.list for additional information. Adapters include details on third-party adapter configurations.

Examples

With OAuth 2.0 credentials created, you're ready to start using the AdMob API. To request access using OAuth 2.0, your application will also need the scope information.

Here's the OAuth 2.0 scope information:

Scope Meaning
https://www.googleapis.com/auth/admob.monetization See, create, and edit your AdMob monetization settings.
https://www.googleapis.com/auth/admob.readonly See all AdMob data. This may include account information, inventory and mediation settings, reports, and other data. This doesn't include sensitive data, such as payments or campaign details.

curl (command line)

Requests using curl

  1. Load the client secrets file and generate authorization credentials.

    The first time you perform this step you'll be asked to accept an authorization prompt in your browser. Before accepting, make sure you're signed in with a Google Account that has access to the AdMob API. Your app will be authorized to access data on behalf of whichever account is currently signed in.

    For authentication and authorization, we recommend using oauth2l, a simple command-line tool for working with Google OAuth 2.0. Install oauth2l and run the command below, replacing path_to_credentials_json with a path to a credentials.json file that you download when registering your cloud application. For the first run, the command walks you through the OAuth 2.0 authorization flow. Subsequent runs refresh the token automatically.

    oauth2l header --json path_to_credentials_json --scope admob.readonly
    
  2. List the adapters.

    Get AdMob adapter information by replacing pub-XXXXXXXXXXXXXXXX with your publisher ID, see how to find your publisher ID.

    Replace SSSSSSSSSSSSSSSSSSSS with the ad source ID for the adapters of interest.

    Use the following command to get a list of adapters:

    curl --http1.0 -X GET https://admob.googleapis.com/v1beta/accounts/pub-XXXXXXXXXXXXXXXX/adSources/SSSSSSSSSSSSSSSSSSSS/adapters \
     -H "$(oauth2l header --json path_to_credentials_json --scope admob.readonly)"
    

    Sample response for the AdMob Network ad source with ID 5450213213286189855:

    {
     "adapters": [
      {
         "name": "accounts/pub-XXXXXXXXXXXXXXXX/adSources/5450213213286189855/adapters/1",
         "adapterId": "1",
         "title": "AdMob Network Android SDK",
         "platform": "ANDROID",
         "formats": ["BANNER", "INTERSTITIAL",
           "REWARDED", "NATIVE", "REWARDED_INTERSTITIAL", "APP_OPEN"],
         "adapterConfigMetadata": [{
           "adapterConfigMetadataId": "118",
           "adapterConfigMetadataLabel": "Ad unit ID"
         }]
      },
      {
         "name": "accounts/pub-XXXXXXXXXXXXXXXX/adSources/5450213213286189855/adapters/2",
         "adapterId": "2",
         "title": "AdMob Network iOS SDK",
         "platform": "ANDROID",
         "formats": ["BANNER", "INTERSTITIAL",
           "REWARDED", "NATIVE", "REWARDED_INTERSTITIAL", "APP_OPEN"],
         "adapterConfigMetadata": [{
           "adapterConfigMetadataId": "119",
           "adapterConfigMetadataLabel": "Ad unit ID"
         }]
      }]
    }