منابع تبلیغاتی
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
AdMob API به شما امکان می دهد منابع تبلیغات میانجی را به صورت برنامه ریزی شده مشاهده کنید. برای اطلاعات بیشتر به accounts.adSources.list
مراجعه کنید.
درخواست با استفاده از Curl
فایل اسرار مشتری را بارگیری کنید و اعتبارنامه مجوز ایجاد کنید.
اولین باری که این مرحله را انجام میدهید، از شما خواسته میشود که درخواست مجوز را در مرورگر خود بپذیرید. قبل از پذیرش، مطمئن شوید که با یک حساب Google وارد سیستم شده اید که به AdMob API دسترسی دارد. برنامه شما مجاز خواهد بود از طرف هر حسابی که در حال حاضر وارد سیستم شده است به داده ها دسترسی داشته باشد.
برای احراز هویت و مجوز، توصیه می کنیم از oauth2l ، یک ابزار خط فرمان ساده برای کار با Google OAuth 2.0 استفاده کنید. oauth2l را نصب کنید و دستور زیر را اجرا کنید و مسیری به فایل credentials.json
که هنگام ثبت برنامه ابری خود دانلود می کنید جایگزین path_to_credentials_json کنید. برای اولین اجرا، دستور شما را در جریان مجوز OAuth 2.0 راهنمایی می کند. اجراهای بعدی توکن را به طور خودکار تازه می کنند.
oauth2l header --json path_to_credentials_json --scope admob.readonly
فهرست منابع تبلیغاتی
با جایگزین کردن pub-XXXXXXXXXXXXXXXX با شناسه ناشر خود، اطلاعات منبع آگهی AdMob را دریافت کنید. دستورالعملهای نحوه یافتن شناسه ناشر خود را ببینید.
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",
}
]
}
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe AdMob API allows programmatic access to view mediation ad sources.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication and authorization are handled using OAuth 2.0, preferably through the \u003ccode\u003eoauth2l\u003c/code\u003e tool.\u003c/p\u003e\n"],["\u003cp\u003eTo list ad sources, a request using \u003ccode\u003ecurl\u003c/code\u003e is made to the AdMob API endpoint, including your publisher ID and authorization credentials.\u003c/p\u003e\n"]]],[],null,["# Ad Sources\n\nThe AdMob API lets you view [mediation ad sources](/admob/api/v1/ad-sources-reference)\nprogrammatically. See\n[`accounts.adSources.list`](/admob/api/reference/rest/v1beta/accounts.adSources/list)\nfor additional information. \n\n### Request using Curl\n\n1. Load the [client secrets file](https://console.cloud.google.com/apis/credentials) and generate authorization\n credentials.\n\n The first time you perform this step you'll be asked to accept an\n authorization prompt in your browser. Before accepting, make sure you're\n signed in with a Google Account that has access to the AdMob API. Your\n app will be authorized to access data on behalf of whichever account is\n currently signed in.\n\n For authentication and authorization, we recommend using\n [oauth2l](//github.com/google/oauth2l), a simple command-line tool for\n working with Google OAuth 2.0. Install oauth2l and run the\n command below, replacing \u003cvar translate=\"no\"\u003epath_to_credentials_json\u003c/var\u003e with a path\n to a `credentials.json` file that you download when registering your\n cloud application. For the first run, the command walks you through the\n OAuth 2.0 authorization flow. Subsequent runs refresh the token\n automatically. \n\n ```\n oauth2l header --json path_to_credentials_json --scope admob.readonly\n ```\n2. List ad sources.\n\n Get AdMob ad source information by replacing \u003cvar translate=\"no\"\u003epub-XXXXXXXXXXXXXXXX\u003c/var\u003e\n with your publisher ID. See the\n [instructions](//support.google.com/admob/answer/2784578) on how to find\n your publisher ID. \n\n ```\n curl --http1.0 -X GET https://admob.googleapis.com/v1beta/accounts/pub-XXXXXXXXXXXXXXXX/adSources \\\n -H \"$(oauth2l header --json path_to_credentials_json --scope admob.readonly)\"\n ```\n\n Sample response: \n\n ```text\n {\n \"adSources\": [\n {\n \"name\": \"accounts/pub-XXXXXXXXXXXXXXXX/adSources/5450213213286189855\",\n \"adSourceId\": \"5450213213286189855\",\n \"title\": \"AdMob Network\",\n }\n ]\n }\n ```"]]