REST Resource: sessions
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tài nguyên: PickingSession
Hình ảnh minh hoạ một phiên hoạt động của người dùng, trong đó người dùng có thể chọn ảnh và video bằng Google Photos.
Biểu diễn dưới dạng JSON |
{
"id": string,
"pickerUri": string,
"pollingConfig": {
object (PollingConfig )
},
"expireTime": string,
"pickingConfig": {
object (PickingConfig )
},
"mediaItemsSet": boolean
} |
Trường |
id |
string
Chỉ có đầu ra. Giá trị nhận dạng do Google tạo cho phiên này.
|
pickerUri |
string
Chỉ có đầu ra. URI dùng để chuyển hướng người dùng đến Google Photos (trên web) để họ có thể chọn ảnh và video cho phiên hiện tại. Để xem được trang này, người dùng phải đăng nhập vào Tài khoản Google sở hữu phiên này trong trình duyệt web của họ. Không thể mở pickerUri trong một iframe do lý do bảo mật.
|
pollingConfig |
object (PollingConfig )
Chỉ có đầu ra. Cấu hình đề xuất mà các ứng dụng nên sử dụng trong khi thăm dò ý kiến sessions.get . Trường này chỉ được điền nếu bạn chưa chọn mục nội dung nghe nhìn cho phiên này (tức là mediaItemsSet là false).
|
expireTime |
string (Timestamp format)
Chỉ có đầu ra. Thời điểm quyền truy cập vào phiên này (và các mục nội dung nghe nhìn đã chọn) sẽ hết hạn. Sử dụng RFC 3339, trong đó đầu ra được tạo sẽ luôn được chuẩn hoá theo Z và sử dụng 0, 3, 6 hoặc 9 chữ số thập phân. Các độ dời khác ngoài "Z" cũng được chấp nhận. Ví dụ: "2014-10-02T15:01:23Z" , "2014-10-02T15:01:23.045123456Z" hoặc "2014-10-02T15:01:23+05:30" .
|
pickingConfig |
object (PickingConfig )
Không bắt buộc. Cấu hình chọn ảnh cho trải nghiệm chọn ảnh của người dùng trong phiên này. Giá trị này do ứng dụng khách chỉ định khi gọi sessions.create và không thể sửa đổi sau khi thực hiện (mà không tạo phiên mới).
|
mediaItemsSet |
boolean
Chỉ có đầu ra. Nếu được đặt thành true , các mục nội dung đa phương tiện đã được chọn cho phiên này và ứng dụng của bạn có thể yêu cầu danh sách các mục nội dung đa phương tiện đã chọn thông qua mediaItems.list .
|
PollingConfig
Cấu hình để thăm dò ý kiến API.
Biểu diễn dưới dạng JSON |
{
"pollInterval": string,
"timeoutIn": string
} |
Trường |
pollInterval |
string (Duration format)
Chỉ có đầu ra. Thời gian đề xuất giữa các yêu cầu thăm dò ý kiến. Thời lượng tính bằng giây, có tối đa 9 chữ số thập phân, kết thúc bằng "s ". Ví dụ: "3.5s" .
|
timeoutIn |
string (Duration format)
Chỉ có đầu ra. Khoảng thời gian mà sau đó ứng dụng sẽ ngừng thăm dò ý kiến. Giá trị 0 cho biết ứng dụng phải ngừng thăm dò ý kiến nếu chưa dừng. Thời lượng tính bằng giây, có tối đa 9 chữ số thập phân, kết thúc bằng "s ". Ví dụ: "3.5s" .
|
PickingConfig
Cấu hình do ứng dụng chỉ định cho trải nghiệm chọn của người dùng trong phiên này.
Biểu diễn dưới dạng JSON |
{
"maxItemCount": string
} |
Trường |
maxItemCount |
string (int64 format)
Không bắt buộc. Số lượng mặt hàng tối đa mà người dùng có thể chọn trong phiên này. Giá trị mặc định là 2000 nếu không được chỉ định. Nếu không chỉ định hoặc đặt thành 0, bạn chỉ có thể chọn tối đa 2.000 mục. Các giá trị trên 2000 sẽ được ép thành 2000. Giá trị âm sẽ dẫn đến lỗi INVALID_ARGUMENT .
|
Phương thức |
|
Tạo một phiên mới, trong đó người dùng có thể chọn ảnh và video để bên thứ ba truy cập. |
|
Xoá phiên đã chỉ định. |
|
Truy xuất thông tin về phiên được chỉ định. |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 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. |"]]