新しい Picker API と Library API の重要な変更点について説明します。詳しくは、
こちらをご覧ください。
REST Resource: sessions
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
リソース: PickingSession
ユーザーが Google フォトを使用して写真や動画を選択できるユーザー セッションを表します。
JSON 表現 |
{
"id": string,
"pickerUri": string,
"pollingConfig": {
object (PollingConfig )
},
"expireTime": string,
"pickingConfig": {
object (PickingConfig )
},
"mediaItemsSet": boolean
} |
フィールド |
id |
string
出力専用。このセッションの Google 生成 ID。
|
pickerUri |
string
出力専用。ユーザーを Google フォト(ウェブ)にリダイレクトして、現在のセッションの写真や動画を選択できるようにするために使用される URI。 このページを正常に表示するには、ユーザーがウェブブラウザでこのセッションを所有する Google アカウントにログインしている必要があります。 セキュリティ上の理由から、pickerUri を iframe で開くことはできません。
|
pollingConfig |
object (PollingConfig )
出力専用。アプリケーションが sessions.get をポーリングする際に使用する推奨構成。 このフィールドは、このセッションでメディア アイテムがまだ選択されていない場合にのみ入力されます(mediaItemsSet が false の場合)。
|
expireTime |
string (Timestamp format)
出力専用。このセッション(および選択したメディア アイテム)へのアクセスが期限切れになる日時。 RFC 3339 を使用します。生成された出力は常に Z 正規化され、小数点以下は 0、3、6、または 9 桁になります。「Z」以外のオフセットも使用できます。例: "2014-10-02T15:01:23Z" 、"2014-10-02T15:01:23.045123456Z" 、"2014-10-02T15:01:23+05:30" 。
|
pickingConfig |
object (PickingConfig )
省略可。このセッションでのユーザーの選択操作に関する写真選択の設定。 これは、sessions.create を呼び出すときにクライアント アプリによって指定され、事後(新しいセッションを作成せずに)変更することはできません。
|
mediaItemsSet |
boolean
出力専用。true に設定されている場合、このセッション用にメディア アイテムが選択されており、アプリは mediaItems.list を介して選択されたメディア アイテムのリストをリクエストできます。
|
PollingConfig
JSON 表現 |
{
"pollInterval": string,
"timeoutIn": string
} |
フィールド |
pollInterval |
string (Duration format)
出力専用。ポーリング リクエスト間の推奨時間。 s で終わる小数 9 桁までの秒単位の期間。例: "3.5s" 。
|
timeoutIn |
string (Duration format)
出力専用。クライアントがポーリングを停止するまでの時間。 値 0 は、クライアントがまだポーリングを停止していない場合は停止する必要があることを示します。 s で終わる小数 9 桁までの秒単位の期間。例: "3.5s" 。
|
PickingConfig
このセッション中のユーザーの選択操作に関するクライアント指定の構成。
JSON 表現 |
{
"maxItemCount": string
} |
フィールド |
maxItemCount |
string (int64 format)
省略可。このセッション中にユーザーが選択できるアイテムの最大数。指定しない場合のデフォルトは 2000 です。 指定しない場合や 0 に設定した場合は、最大 2, 000 個のアイテムを選択できます。2,000 を超える値は 2,000 に強制変換されます。負の値を指定すると、INVALID_ARGUMENT エラーが発生します。
|
メソッド |
|
新しいセッションを生成します。このセッション中に、ユーザーはサードパーティによるアクセス対象の写真や動画を選択できます。 |
|
指定されたセッションを削除します。 |
|
指定されたセッションに関する情報を取得します。 |
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-25 UTC。
[null,null,["最終更新日 2025-07-25 UTC。"],[[["\u003cp\u003eGoogle Photos Picker API provides sessions for users to select photos and videos.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ePickingSession\u003c/code\u003e resource represents the user's selection session, including a URI to redirect users to Google Photos for picking media.\u003c/p\u003e\n"],["\u003cp\u003eApplications can poll the API using the recommended \u003ccode\u003ePollingConfig\u003c/code\u003e to check for session updates and retrieve selected media items.\u003c/p\u003e\n"],["\u003cp\u003eSessions have an expiration time and can be programmatically created, retrieved, and deleted using the API methods.\u003c/p\u003e\n"]]],["A `PickingSession` represents a user's photo/video selection process in Google Photos, identified by a unique ID. It provides a `pickerUri` to direct users to Google Photos for media selection. `PollingConfig` defines API polling parameters with `pollInterval` and `timeoutIn`. A session expires at a specified `expireTime`, after which access ends. Once `mediaItemsSet` is true, selected media can be requested. Methods allow to `create`, `get` and `delete` sessions.\n"],null,["# REST Resource: sessions\n\n- [Resource: PickingSession](#PickingSession)\n - [JSON representation](#PickingSession.SCHEMA_REPRESENTATION)\n- [PollingConfig](#PollingConfig)\n - [JSON representation](#PollingConfig.SCHEMA_REPRESENTATION)\n- [PickingConfig](#PickingConfig)\n - [JSON representation](#PickingConfig.SCHEMA_REPRESENTATION)\n- [Methods](#METHODS_SUMMARY)\n\nResource: PickingSession\n------------------------\n\nRepresentation of a user session during which the user can pick photos and videos using Google Photos.\n\n| JSON representation |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"id\": string, \"pickerUri\": string, \"pollingConfig\": { object (/photos/picker/reference/rest/v1/sessions#PollingConfig) }, \"expireTime\": string, \"pickingConfig\": { object (/photos/picker/reference/rest/v1/sessions#PickingConfig) }, \"mediaItemsSet\": boolean } ``` |\n\n| Fields ||\n|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `id` | `string` Output only. The Google-generated identifier for this session. |\n| `pickerUri` | `string` Output only. The URI used to redirect the user to Google Photos (on web) so they can pick photos and videos for the current session. To view this page successfully, the user must be logged into the Google account that owns this session in their web browser. The `pickerUri` cannot be opened in an iframe due to security reasons. |\n| `pollingConfig` | `object (`[PollingConfig](/photos/picker/reference/rest/v1/sessions#PollingConfig)`)` Output only. The recommended configuration that applications should use while polling `sessions.get`. This field is only populated if media items have not yet been picked for this session (i.e., `mediaItemsSet` is false). |\n| `expireTime` | `string (`[Timestamp](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp)` format)` Output only. Time when access to this session (and its picked media items) will expire. Uses RFC 3339, where generated output will always be Z-normalized and uses 0, 3, 6 or 9 fractional digits. Offsets other than \"Z\" are also accepted. Examples: `\"2014-10-02T15:01:23Z\"`, `\"2014-10-02T15:01:23.045123456Z\"` or `\"2014-10-02T15:01:23+05:30\"`. |\n| `pickingConfig` | `object (`[PickingConfig](/photos/picker/reference/rest/v1/sessions#PickingConfig)`)` Optional. Photo-picking configuration for the user's picking experience during this session. This is specified by the client application when calling `sessions.create`, and cannot be modified after the fact (without creating a new session). |\n| `mediaItemsSet` | `boolean` Output only. If set to `true`, media items have been picked for this session and your application can request the list of picked media items via `mediaItems.list`. |\n\nPollingConfig\n-------------\n\nConfiguration for polling the API.\n\n| JSON representation |\n|---------------------------------------------------------|\n| ``` { \"pollInterval\": string, \"timeoutIn\": string } ``` |\n\n| Fields ||\n|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `pollInterval` | `string (`[Duration](https://protobuf.dev/reference/protobuf/google.protobuf/#duration)` format)` Output only. Recommended time between poll requests. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `\"3.5s\"`. |\n| `timeoutIn` | `string (`[Duration](https://protobuf.dev/reference/protobuf/google.protobuf/#duration)` format)` Output only. The length of time after which the client should stop polling. A value of 0 indicates that the client should stop polling if it hasn't already. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `\"3.5s\"`. |\n\nPickingConfig\n-------------\n\nClient-specified configuration for the user's picking experience during this session.\n\n| JSON representation |\n|------------------------------------|\n| ``` { \"maxItemCount\": string } ``` |\n\n| Fields ||\n|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `maxItemCount` | `string (`[int64](https://developers.google.com/discovery/v1/type-format)` format)` Optional. The maximum number of items that the user can pick during this session. Defaults to 2000 if not specified. If unspecified or set to 0, at most 2000 items can be picked. Values above 2000 will be coerced to 2000. Negative values will result in an `INVALID_ARGUMENT` error. |\n\n| Methods ------- ||\n|----------------------------------------------------------------|--------------------------------------------------------------------------------------------------|\n| ### [create](/photos/picker/reference/rest/v1/sessions/create) | Generates a new session during which the user can pick photos and videos for third-party access. |\n| ### [delete](/photos/picker/reference/rest/v1/sessions/delete) | Deletes the specified session. |\n| ### [get](/photos/picker/reference/rest/v1/sessions/get) | Retrieves information about the specified session. |"]]