با Picker API جدید و تغییرات مهم Library API آشنا شوید.
جزئیات اینجا
REST Resource: sessions
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
منبع: PickingSession
نمایش یک جلسه کاربر که در طی آن کاربر می تواند عکس ها و ویدیوها را با استفاده از Google Photos انتخاب کند.
نمایندگی JSON |
---|
{
"id": string,
"pickerUri": string,
"pollingConfig": {
object (PollingConfig )
},
"expireTime": string,
"pickingConfig": {
object (PickingConfig )
},
"mediaItemsSet": boolean
} |
فیلدها |
---|
id | string فقط خروجی شناسه ایجاد شده توسط Google برای این جلسه. |
pickerUri | string فقط خروجی URI برای هدایت کاربر به Google Photos (در وب) استفاده میشود تا بتواند عکسها و ویدیوها را برای جلسه فعلی انتخاب کند. برای مشاهده موفقیت آمیز این صفحه، کاربر باید به حساب Google که صاحب این جلسه در مرورگر وب خود است وارد شود. به دلایل امنیتی pickerUri در iframe باز نمی شود. |
pollingConfig | object ( PollingConfig ) فقط خروجی پیکربندی توصیه شده ای که برنامه ها باید هنگام نظرسنجی sessions.get استفاده کنند. این فیلد فقط در صورتی پر می شود که موارد رسانه هنوز برای این جلسه انتخاب نشده باشند (یعنی mediaItemsSet نادرست است). |
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
پیکربندی برای نظرسنجی API.
نمایندگی JSON |
---|
{
"pollInterval": string,
"timeoutIn": string
} |
فیلدها |
---|
pollInterval | string ( Duration format) فقط خروجی زمان پیشنهادی بین درخواستهای نظرسنجی مدت زمان در ثانیه با حداکثر نه رقم کسری که با ' s ' ختم می شود. مثال: "3.5s" . |
timeoutIn | string ( Duration format) فقط خروجی مدت زمانی که پس از آن مشتری باید نظرسنجی را متوقف کند. مقدار 0 نشان می دهد که مشتری باید نظرسنجی را متوقف کند اگر قبلاً این کار را نکرده است. مدت زمان در ثانیه با حداکثر نه رقم کسری که با ' s ' ختم می شود. مثال: "3.5s" . |
PickingConfig
پیکربندی مشخص شده توسط مشتری برای تجربه انتخاب کاربر در این جلسه.
نمایندگی JSON |
---|
{
"maxItemCount": string
} |
فیلدها |
---|
maxItemCount | string ( int64 format) اختیاری. حداکثر تعداد مواردی که کاربر می تواند در این جلسه انتخاب کند. اگر مشخص نشده باشد، پیشفرض 2000 است. اگر مشخص نشده باشد یا روی 0 تنظیم شود، حداکثر 2000 مورد می تواند انتخاب شود. مقادیر بالای 2000 به 2000 منتقل می شوند. مقادیر منفی منجر به خطای INVALID_ARGUMENT می شود. |
روش ها |
---|
| یک جلسه جدید ایجاد می کند که در طی آن کاربر می تواند عکس ها و فیلم ها را برای دسترسی شخص ثالث انتخاب کند. |
| جلسه مشخص شده را حذف می کند. |
| اطلاعات مربوط به جلسه مشخص شده را بازیابی می کند. |
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\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. |"]]