แหล่งที่มาของโฆษณา
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
AdMob API ช่วยให้คุณดูแหล่งที่มาของโฆษณาสื่อกลางได้
แบบเป็นโปรแกรม โปรดดู
accounts.adSources.list
เพื่อดูข้อมูลเพิ่มเติม
ส่งคำขอโดยใช้ Curl
โหลดไฟล์รหัสลับไคลเอ็นต์และสร้างการให้สิทธิ์
ข้อมูลเข้าสู่ระบบ
ครั้งแรกที่คุณทำขั้นตอนนี้ ระบบจะขอให้คุณยอมรับ
ข้อความแจ้งการให้สิทธิ์ในเบราว์เซอร์ของคุณ ก่อนยอมรับ โปรดตรวจสอบว่าคุณได้
ลงชื่อเข้าใช้ด้วยบัญชี Google ที่มีสิทธิ์เข้าถึง AdMob API บัญชี
แอปจะได้รับอนุญาตให้เข้าถึงข้อมูลในนามของบัญชีใดก็ตาม
ลงชื่อเข้าใช้อยู่
สำหรับการตรวจสอบสิทธิ์และการให้สิทธิ์ เราขอแนะนำให้ใช้
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
แสดงรายการแหล่งที่มาของโฆษณา
ดูข้อมูลแหล่งที่มาของโฆษณา AdMob โดยแทนที่ pub-XXXXXXXXXXXXXXXX
ด้วยรหัสผู้เผยแพร่โฆษณา โปรดดู
วิธีการหา
รหัสผู้เผยแพร่โฆษณาของคุณ
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",
}
]
}
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-31 UTC
[null,null,["อัปเดตล่าสุด 2025-08-31 UTC"],[[["\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 ```"]]