এই নির্দেশিকা এমন ডেভেলপারদের জন্য যারা AdMob API ব্যবহার করে প্রোগ্রামগতভাবে পেতে চান তাদের AdMob অ্যাকাউন্টের ডেটা।
All Google AdMob API calls must be authorized through OAuth2 so your app can interact with web services on the user's behalf. OAuth2 enables your AdMob API client app to access a user's AdMob account without having to handle or store the user's username or password. For an overview of authorization, see Authorization.
Perform the following steps to generate the OAuth2 credentials and make your first request.
Prerequisites
Familiarity with REST basics and authorizing requests with OAuth 2.0.
Determine your authentication type
Check the table below to see which authentication type is most appropriate for your app:
Choose your OAuth2 authentication type | If ... |
---|---|
Desktop app |
|
Web app |
|
Create a project
To get started using the AdMob API, you need to first create or select a project in the Google API Console and enable the API using the setup tool, which guides you through the process and activates the AdMob API automatically.
Enabling the API for an existing project
The following steps apply to users who have an existing project and prefer to activate the AdMob API for it manually.
আপনার প্রকল্পের জন্য একটি API সক্ষম করতে:
- Open the API Library Google API Console ।
- If prompted, select a project, or create a new one. API Library প্রোডাক্ট পরিবার এবং জনপ্রিয়তার দ্বারা গোষ্ঠীযুক্ত সমস্ত উপলব্ধ API তালিকাভুক্ত করে।
- আপনি যে APIটি সক্ষম করতে চান তা যদি তালিকায় দৃশ্যমান না হয় তবে এটি সন্ধানের জন্য অনুসন্ধানটি ব্যবহার করুন, বা এর সাথে সম্পর্কিত পণ্য পরিবারে সমস্ত দেখুন ক্লিক করুন।
- আপনি সক্ষম করতে চান এমন API নির্বাচন করুন, তারপরে সক্ষম বোতামটি ক্লিক করুন।
- If prompted, enable billing.
- If prompted, read and accept the API's Terms of Service.
Create OAuth2 credentials
The following instructions guide you through the process of creating an OAuth 2.0 client ID to use with the installed app flow.
- Go to the Credentials page.
Click CREATE CREDENTIALS > OAuth client ID.
If you hadn't configured an OAuth consent screen for this project previously, you'll be directed to do so now. Click CONFIGURE CONSENT SCREEN. There are multiple ways to configure your consent screen to use your OAuth 2.0 client ID.
- Set your user type to External and publishing status to Published.
Or, set your user type to External and publishing status to Testing, then add Test users by selecting add users to give them access to use your OAuth 2.0 client ID.
See additional information on setting up your OAuth consent screen.
Select Desktop app or Web Application as the application type, give it a name, then click Create.
When done, you are presented with an OAuth 2.0 client ID and client secret, which you can download in JSON format and save for later use.
Make a request
The AdMob API is built on HTTP and JSON, so any standard HTTP client can send requests to it and parse the responses. However, the Google API client libraries provide better language integration, improved security, and support for making authorized requests. The client libraries are available in a number of programming languages; by using them you can avoid the need to manually set up HTTP requests and parse the responses.
With OAuth 2.0 credentials created, you're ready to start using the AdMob API. To request access using OAuth 2.0, your app also needs scope information:
Scope | Meaning |
---|---|
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. |
https://www.googleapis.com/auth/admob.report |
See ad performance and earnings reports. See publisher ID, timezone, and default currency code. |
Make your first request to generate a report using examples in Java, PHP, Python or curl.
Revoke shared tokens
You can revoke shared tokens in two ways:
Navigate to your Google account permissions page and revoke access from the relevant project.
Alternatively, you can revoke web application tokens using the Google Identity API.