初めてのアプリ: 前提条件
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
最初のクライアント アプリケーションのコーディングを開始する前に、行うことがいくつかあります。
Google アカウントを作成して検索広告 360 の権限を取得する
Search Ads 360 API を使用するには、Google アカウントと、検索広告 360 からそのアカウントに適切な権限が付与されている必要があります。
Google アカウントをまだお持ちでない場合は、
アカウントを作成します。
検索広告 360 の代理店マネージャーに、Google アカウントの
検索広告 360 ユーザーを作成するよう依頼します。
レポートをダウンロードするには、担当する広告主の表示権限が必要です。
コンバージョンを追加または編集するには、提携する広告主に対する編集権限が必要です。Floodlight 設定を共有している場合は、コンバージョンのアップロード先となるすべての子広告主に対する編集権限が必要です。親広告主へのアクセスや、コンバージョンのアップロード先となる子広告主へのアクセスは必要ありません。クリック ID を使用してコンバージョンを訪問に結び付ける場合は、クリック ID を生成した広告主に対する編集権限が必要です。編集権限がない広告主のクリック ID を指定した場合、リクエストは成功しません。
代理店マネージャーは、特定の広告主にアクセスできる広告主ユーザーとしてアカウントを設定することも、代理店内のすべての広告主にアクセスできる代理店ユーザーなど、より高いレベルのアクセス権を持つアカウントとして設定することもできます。
API コンバージョン サービスを有効にする
コンバージョンに関するデータをアップロードするには、代理店マネージャー権限を持つ検索広告 360 ユーザーが検索広告 360 管理画面にログインし、API コンバージョン サービスを有効にする必要があります。手順については、検索広告 360 ヘルプセンターをご覧ください。
Google API Console プロジェクトとクライアントの OAuth 認証情報を作成する
- Google API コンソールの
セットアップ ツールを起動します。
設定ツールの手順に沿って、プロジェクトの作成(または既存のプロジェクトを使用)、Search Ads 360 API の有効化、OAuth 2.0 認証情報の作成を行います。
- [アプリケーションを登録する] ページで、既存のプロジェクトを選択するか、[プロジェクトを作成] を選択します。その後、[続行] をクリックします。
- Google API Console で検索広告 360 API が有効になったら、[認証情報に進む] ボタンをクリックします。
- [認証情報を作成] ページで、次の情報を入力します。
-
使用している API: Search Ads 360 API
-
アクセスするデータの種類: ユーザーデータ
- [次へ] ボタンをクリックします。
設定ツールで OAuth 2.0 クライアント ID の作成がサポートされるようになりました。
- セットアップ ツールの残りの手順に沿って操作します。
sa360Api.py をインストールする
検索広告 360 には、認可の設定プロセスを容易にするユーティリティ スクリプトが用意されています。完全なアプリケーションを設計して作成する前に、データの送受信を試す場合は、このスクリプトを使用して JSON 形式でデータを送受信することもできます。このドキュメント サイトの JSON サンプルの多くをコピーして、スクリプトに直接入力できます。
スクリプトをインストールするには:
- Python 2.7 をインストールします。
このスクリプトは Python 3.x では機能しません。
- cURL をインストールします。
- sa360Api.zip をダウンロードします。
sa360Api.zip
から sa360Api.py
を抽出します。
sa360Api.py
を実行可能にします。
REST の基礎を学習する
API は次の 2 つの方法で呼び出すことができます。
クライアント ライブラリを使用しない場合は、REST の基礎を理解する必要があります。
REST は、データをリクエストして変更するための便利で一貫したアプローチを提供するソフトウェア アーキテクチャのスタイルです。
REST という用語は「Representational State Transfer」の省略形です。Google API のコンテキストでは、HTTP 動詞を使用して、Google が保存しているデータ表現を取得および変更することを表しています。
RESTful システムでは、リソースはデータストアに保存されており、クライアントはサーバーが特定のアクション(リソースの作成、取得、更新、削除など)を実行するようにリクエストを送信し、サーバーはそのアクションを実行し、多くの場合、指定されたリソースの表現形式でレスポンスを送信します。
Google の RESTful API では、クライアントは POST
、GET
、PUT
、DELETE
などの HTTP 動詞を使用してアクションを指定します。また、次の形式のグローバルに一意な URI でリソースを指定します。
https://www.googleapis.com/apiName/apiVersion/resourcePath?parameters
すべての API リソースは HTTP でアクセス可能な一意の URI を持っているため、REST はデータ キャッシュを有効にし、ウェブの分散インフラストラクチャで動作するように最適化されています。
HTTP 1.1 標準のドキュメントのメソッド定義をご覧ください。GET
、POST
、PUT
、DELETE
の仕様が記載されています。
Search Ads 360 API の REST
Search Ads 360 API オペレーションは REST の HTTP 動詞に直接マッピングされています。
Search Ads 360 API の URI の形式は次のとおりです。
https://www.googleapis.com/doubleclicksearch/v2/resourcePath?parameters
API でサポートされている各オペレーションで使用される URI の完全なセットは、API リファレンスにまとめられています。
JSON の基礎を学習する
REST を使用する場合は、リクエスト本文に JSON 形式を使用する必要があります。レスポンスは JSON 形式または CSV 形式のいずれかを指定できます。
JSON(JavaScript Object Notation)は言語に依存しない一般的なデータ フォーマットであり、任意のデータ構造を単純なテキスト形式で表示します。詳しくは json.org をご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-11-07 UTC。
[null,null,["最終更新日 2024-11-07 UTC。"],[[["\u003cp\u003eBefore using the Search Ads 360 API, ensure you have a Google Account with the necessary Search Ads 360 permissions, which may include view or edit access to specific advertisers.\u003c/p\u003e\n"],["\u003cp\u003eTo upload conversion data, the API Conversion Service must be activated by a Search Ads 360 user with Agency Manager privileges.\u003c/p\u003e\n"],["\u003cp\u003eSet up a Google API Console project and obtain OAuth credentials for your client application to authenticate and authorize API access.\u003c/p\u003e\n"],["\u003cp\u003eInstall the provided \u003ccode\u003esa360Api.py\u003c/code\u003e utility script and familiarize yourself with REST and JSON basics if you plan to interact with the API directly without client libraries.\u003c/p\u003e\n"]]],["To start coding, create a Google Account and request Search Ads 360 permissions from an Agency Manager, who will grant view or edit access to advertisers. Activate the API conversion service via the Search Ads 360 UI. Next, create a Google API Console project and OAuth 2.0 credentials. Install Python 2.7, cURL, and the `sa360Api.py` utility script. Finally, understand REST basics and JSON formatting, crucial for interacting with the API using HTTP requests.\n"],null,["# Your First App: Prerequisites\n\nBefore you can start coding your first client application, there are a few things you\nneed to do, if you haven't done them already.\n\nCreate a Google Account and get Search Ads 360 permissions\n----------------------------------------------------------\n\nTo use the Search Ads 360 API, you need a Google Account and appropriate permissions\ngranted to that account from Search Ads 360:\n\n1. If you don't already have a Google Account, [create one](https://support.google.com/accounts/answer/27441).\n\n2. Ask a Search Ads 360 **Agency Manager** to [create a Search Ads 360 user](https://support.google.com/searchads/answer/6051717) for your Google Account.\n\n To download reports, you'll need **view permission** for the advertisers\n you'll be working with.\n\n To add or edit conversions, you'll need **edit permission** for the advertisers\n you'll be working with. In a\n [shared Floodlight configuration](https://support.google.com/searchads/answer/2458167),\n you need edit permission for each child advertiser you want to upload conversions into.\n You don't need access to the parent advertiser, nor do you need access to child advertisers\n that you're not uploading conversions into. If you use click IDs to\n [attribute\n conversions to visits](/search-ads/v2/how-tos/conversions/insert#attribute-a-conversion-to-a-specific-visit), make sure you have edit access to the advertiser that generated\n the click ID. If you specify a click ID from an advertiser you don't have edit access to,\n the request will not succeed.\n\n The Agency Manager can set up your account as an **Advertiser user** with\n access to specific advertisers,\n or set up your account with a higher level of access such as **Agency user**\n with access to all advertisers in the agency.\n\nActivate the API Conversion Service\n-----------------------------------\n\n\nIf you want to upload data about conversions, a Search Ads 360 user with **Agency\nManager** privileges needs to sign in to the Search Ads 360 UI and\n**activate the API conversion service** . See the\n[Search Ads 360\nhelp center](https://support.google.com/searchads/answer/2604604#activate) for instructions.\n\nCreate a Google API Console project and OAuth credentials for your client\n-------------------------------------------------------------------------\n\n1. Start the Google API Console [setup tool](https://console.cloud.google.com/start/api?id=doubleclicksearch&credential=client_key). \n The setup tool guides you through creating a project (or using an existing project), enabling the Search Ads 360 API, and creating OAuth 2.0 credentials.\n2. On the **Register your application** page, select an existing project or select **Create a project** . Then click **Continue**.\n3. After the Google API Console enables the Search Ads 360 API, click the **Go to credentials** button.\n4. On the **Create credentials** page, enter the following information:\n - **Which API are you using?**: Search Ads 360 API\n - **What data will you be accessing?**: User data\n5. Click the **Next** button.\n\n The setup tool now offers to help you create an **OAuth 2.0 client ID**.\n6. Follow the rest of the steps in the setup tool.\n\nInstall sa360Api.py\n-------------------\n\nSearch Ads 360 provides a utility script to facilitate the process of setting up\nauthorization. You can also use this script to send and receive data in the JSON format,\nif you want to try sending and receiving data before you design and write a full\napplication. You can copy many of the JSON examples in this documentation site and input\nthem directly to the script.\n\nTo install the script:\n\n1. [Install Python](http://www.python.org/getit/) 2.7. \n The script does not work with Python 3.x.\n2. [Install cURL](http://curl.haxx.se/download.html).\n3. [Download sa360Api.zip](https://www.google.com/help/hc/downloads/sa360/sa360Api.zip).\n4. Extract `sa360Api.py` from `sa360Api.zip`.\n5. Make `sa360Api.py` executable.\n\nLearn REST basics\n-----------------\n\nThere are two ways to invoke the API:\n\n- Using [client libraries](/search-ads/v2/libraries).\n- Sending HTTP requests and parsing the responses.\n\nIf you decide not to use client libraries, you'll need to understand the basics of\nREST.\n\nREST is a style of software architecture that provides a convenient and consistent approach to requesting and modifying data.\n\nThe term REST is short for \"[Representational State Transfer](https://en.wikipedia.org/wiki/Representational_state_transfer).\" In the context of Google APIs, it refers to using HTTP verbs to retrieve and modify representations of data stored by Google.\n\nIn a RESTful system, resources are stored in a data store; a client sends a request that the server perform a particular action (such as creating, retrieving, updating, or deleting a resource), and the server performs the action and sends a response, often in the form of a representation of the specified resource.\n\nIn Google's RESTful APIs, the client specifies an action using an HTTP verb such as `POST`, `GET`, `PUT`, or `DELETE`. It specifies a resource by a globally-unique URI of the following form: \n\n```\nhttps://www.googleapis.com/apiName/apiVersion/resourcePath?parameters\n```\n\nBecause all API resources have unique HTTP-accessible URIs, REST enables data caching and is optimized to work with the web's distributed infrastructure.\n\nYou may find the [method definitions](https://tools.ietf.org/html/rfc7231#section-4.3) in the HTTP 1.1 standards documentation useful; they include specifications for `GET`, `POST`, `PUT`, and `DELETE`.\n\n### REST in the Search Ads 360 API\n\nThe Search Ads 360 API operations map directly to REST HTTP verbs.\n\nThe specific format for Search Ads 360 API URIs is: \n\n```\nhttps://www.googleapis.com/doubleclicksearch/v2/resourcePath?parameters\n```\n\n\nThe full set of URIs used for each supported operation in the API is summarized in the [API Reference](/search-ads/v2/reference).\n\nLearn JSON basics\n-----------------\n\nIf you use REST, you'll need to use the JSON format for the request bodies. You can\nspecify that the responses be either in the JSON or CSV format.\n\n\n[JSON](http://en.wikipedia.org/wiki/JSON) (JavaScript Object Notation) is a common, language-independent data format that provides a simple text representation of arbitrary data structures. For more information, see [json.org](http://www.json.org/).\n\n\u003cbr /\u003e"]]