API AdMob позволяет программно отображать список адаптеров медиации ; дополнительную информацию см. в accounts.adSources.adapters.list . Адаптеры содержат сведения о конфигурациях сторонних адаптеров.
Примеры
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.
Вот информация об области действия OAuth 2.0:
| Объем | Значение |
|---|---|
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 (командная строка)
Запросы с использованием curl
Load the client secrets file and generate authorization credentials.
При первом выполнении этого шага вам будет предложено принять авторизацию в браузере. Прежде чем принять, убедитесь, что вы вошли в систему с учетной записью Google, имеющей доступ к API AdMob. Ваше приложение будет авторизовано для доступа к данным от имени той учетной записи, которая в данный момент авторизована.
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.jsonfile 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
Перечислите адаптеры.
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" }] }] }