Gmail API クライアント ライブラリ
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Gmail API は HTTP と JSON を基に構築されているため、標準の HTTP クライアントであれば、この API にリクエストを送信してレスポンスを解析できます。
Google API クライアント ライブラリを利用すれば、言語が高度に統合され、セキュリティも強化されます。また、ユーザーの承認が必要な呼び出しもサポートされます。クライアント ライブラリは多くのプログラミング言語で利用できます。これを使用することにより、HTTP リクエストの設定やレスポンスの解析を手作業で行う必要がなくなります。
Java
このページには、Java 用 Google API クライアント ライブラリを使用して Gmail API の使用を開始するための情報が記載されています。詳しくは以下のドキュメントをご覧ください。
クライアント ライブラリをプロジェクトに追加する
以下のタブからビルド環境(Maven または Gradle)を選択します。
.NET
このページには、.NET 用 Google API クライアント ライブラリを使用して Gmail API の使用を開始するための情報が記載されています。詳細については、以下のドキュメントをご覧ください。
Python
このページでは、Python 用 Google API クライアント ライブラリ(v1/v2)を使用して Gmail API の使用を開始する方法について説明します。詳しくは以下のドキュメントをご覧ください。
クライアント ライブラリをインストールする
パッケージ マネージャーを使用するか、Python クライアント ライブラリを手動でダウンロードしてインストールできます。
マネージド インストール
pip または setuptools を使用してインストールを管理します。最初に sudo
を実行しなければならない場合があります。
- pip(推奨):
pip install --upgrade google-api-python-client
- setuptools:
easy_install --upgrade google-api-python-client
手動インストール
- 最新の Python 用クライアント ライブラリをダウンロードします。
- コードを解凍します。
- 以下をインストールします。
python setup.py install
App Engine
Python クライアント ライブラリは App Engine Python ランタイム環境にはインストールされていないため、サードパーティ ライブラリと同様にアプリケーションにコピーする必要があります。
Ruby
このページには、Ruby 用 Google API クライアント ライブラリを使用して Gmail API の使用を開始するための情報が記載されています。詳しくは以下のドキュメントをご覧ください。
google-api-client
gem をインストールする
システムによっては、このようなコマンドの前に sudo
を付ける必要があります。
Ruby 用の Google API クライアント ライブラリをまだインストールしていない場合は、RubyGems
を使用してインストールします。
gem install google-api-client
gem がすでにインストールされている場合は、最新バージョンにアップデートします。
gem update -y google-api-client
Ruby 用 Google API クライアント ライブラリを使ってみる
最初のリクエストをする方法については、スタートガイドをご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-03-24 UTC。
[null,null,["最終更新日 2025-03-24 UTC。"],[],[],null,["# Gmail API Client Libraries\n\nThe Gmail API is built on HTTP and JSON, so any standard HTTP client can\nsend requests to it and parse the responses.\n\nHowever, the Google APIs client libraries provide better language integration,\nimproved security, and support for making calls that require user authorization.\nThe client libraries are available in a number of programming languages; by\nusing them you can avoid the need to manually set up HTTP requests and parse the\nresponses. \n\n### Go\n\nGet the latest [Gmail API client library for Go ()](https://github.com/google/google-api-go-client). Read the\nclient library's [developer's guide](https://github.com/google/google-api-go-client).\n\n### Java\n\n\u003cbr /\u003e\n\n\nThis page contains information about getting started with the Gmail API by using\nthe Google API Client Library for Java. For more information, see the following documentation:\n\n- Browse the [Javadoc reference for the Gmail API](https://googleapis.dev/java/google-api-services-gmail/latest/).\n- Read the [Developer's Guide for the Google API Client Library for Java](https://github.com/googleapis/google-api-java-client/).\n\nAdd the client library to your project\n--------------------------------------\n\nSelect your build environment (Maven or Gradle) from the following tabs:\n\n\nMaven\n\nAdd the following to your `pom.xml` file:\n\n```\nRefreshing Maven content...\n```\n\nSee [all versions available on the Maven Central Repository](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.google.apis%22%20AND%20a%3A%22google-api-services-gmail%22).\nGradle\n\nAdd the following to your `build.gradle` file:\n\n```\nRefreshing Gradle content...\n```\n\nSee [all versions available on the Maven Central Repository](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.google.apis%22%20AND%20a%3A%22google-api-services-gmail%22).\n\n### JavaScript\n\nRead the client library's [developer's guide](/api-client-library/javascript/start/start-js).\n\n### .NET\n\n\nThis page contains information about getting started with the Gmail API by using\nthe Google API Client Library for .NET. For more information, see the following documentation:\n\n- Browse the [.NET reference documentation for the Gmail API](https://googleapis.dev/dotnet/Google.Apis/latest/api/Google.Apis.html).\n- Read the [Developer's guide for the Google API Client Library for .NET](/api-client-library/dotnet/get_started).\n\nDownloading the library\n-----------------------\n\nInstall the NuGet package:\n[Google.Apis](https://www.nuget.org/packages/Google.Apis).\n\n### Node.js\n\nGet the latest [Gmail API client library for Node.js](https://github.com/google/google-api-nodejs-client/). Read the\nclient library's [developer's guide](https://github.com/google/google-api-nodejs-client/).\n\n### Obj-C\n\nGet the latest [Gmail API client library for Objective-C](https://github.com/google/google-api-objectivec-client-for-rest). Read the\nclient library's [developer's guide](https://github.com/google/google-api-objectivec-client-for-rest/wiki).\n\n### PHP\n\nGet the latest [Gmail API client library for PHP](https://github.com/google/google-api-php-client). Read the\nclient library's [developer's guide](/api-client-library/php).\n\n### Python\n\n\nThis page contains information about getting started with the Gmail API by using\nthe Google API Client Library for Python (v1/v2). For more information, see the following documentation:\n\n- Browse the [PyDoc reference for the Gmail API](https://googleapis.github.io/google-api-python-client/docs/dyn/gmail_v1.html).\n- Read the [Developer's guide for the Google API Client Library for Python (v1/v2)](/api-client-library/python).\n\nSystem requirements\n-------------------\n\n- Operating systems:\n - Linux\n - macOS X\n - Windows\n- [The v1 client library requires Python 2.7 or higher. The v2 client library requires 3.7 or higher.](http://python.org/download/)\n\nInstall the client library\n--------------------------\n\nYou can either use a package manager or manually download and install the Python client library:\n\n### Managed install\n\nUse pip or setuptools to manage your installation. You might\nneed to run `sudo` first.\n\n- [pip](http://pypi.python.org/pypi/pip) (preferred): \n\n ```\n pip install --upgrade google-api-python-client\n ```\n- [Setuptools](http://pypi.python.org/pypi/setuptools): \n\n ```\n easy_install --upgrade google-api-python-client\n ```\n\n### Manual install\n\n1. [Download the latest client\n library for Python](https://pypi.python.org/pypi/google-api-python-client/).\n2. Unpack the code.\n3. Install: \n\n ```\n python setup.py install\n ```\n\n### App Engine\n\nBecause the Python client libraries aren't installed in the\n[App Engine Python runtime environment](https://cloud.google.com/appengine/docs/python/),\nyou must [copy them into your application](https://cloud.google.com/appengine/docs/python/tools/libraries27#vendoring) just like third-party libraries.\n\n\u003cbr /\u003e\n\n### Ruby\n\n\nThis page contains information about getting started with the Gmail API by using\nthe Google API Client Library for Ruby. For more information, see the following documentation:\n\n- Read the [Get started guide for the Google API Client Library for Ruby](/api-client-library/ruby/start/get_started).\n\nInstall the `google-api-client` gem\n-----------------------------------\n\n\nDepending on your system, you might need to prepend these commands with `sudo`.\n\n\nIf you haven't installed the Google API Client Library for Ruby before, install by using `RubyGems`: \n\n```\ngem install google-api-client\n```\n\n\u003cbr /\u003e\n\n\nIf you already have the gem installed, update to the latest version: \n\n```\ngem update -y google-api-client\n```\n\n\u003cbr /\u003e\n\nGet started with the Google API Client Library for Ruby\n-------------------------------------------------------\n\n\nTo learn how to make your first request, see the\n[Get started guide](/api-client-library/ruby/start/get_started).\n\n\u003cbr /\u003e"]]